1827293 Members
2646 Online
109717 Solutions
New Discussion

moving logical volumes

 

moving logical volumes

I am replacing 3 - 18 GB drives with a 72 GB drive. I need to combine several logical volumes from 3 volume groups to a single volume group in order to do disk mirroring on the new drive. I would want to maintain the same mount points and would want to delete the no longer used volume groups. What is the best procedure for accomplishing this?
8 REPLIES 8
Steven E. Protter
Exalted Contributor

Re: moving logical volumes

Back it all up with fbackup or your tool of choice.

unmount the filesystems.

lvremove the logical volumes.

vgreduce the disks out of each volume group except the last one.

vgexport the volume groups

Shut the system down (optional for hot swap) and remove the old disks.

Install the new disks.

Boot your system.

insf -C if the disks are hot swap and you missed the boot.

pvcreate -f each new disk or lun

cd /dev
mkdir vg01
mknod vg01/group c 64 0x010000

adjust your numbers indluding the last 1 in the mknod to the actual volume group name.

vgcreate /dev/vg01 /dev/dsk/c#t#d#
# use a real disk name

lvcreate the logical volumes
newfs -F vxfs -o /dev/vg01/rlvol1
# adjust as needed

restore the backup.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sundar_7
Honored Contributor

Re: moving logical volumes

if you want to avoid backup and restore than create the volume group, mount the logical volumes to a temp mountpoint, copy the data from the old lvs to the new lvs. unmount the old lvs, remove lv/volume group.

Hope you are aware you need Mirror-UX/DX to to be able to mirror the logical volumes

Learn What to do ,How to do and more importantly When to do ?
SS_6
Valued Contributor

Re: moving logical volumes

Safe and faster way is to do as Sundar suggested.You can check you data and than take out the old disks. Let us know if you want the detailed commands to do this. An additional tape backup is always helpful.
By providing solutions I am helping myself
Sunil Sharma_1
Honored Contributor

Re: moving logical volumes

Hi,

Best way is.
1 create logical volume in new disk
2. mount this new volume on temperory mount point.
3. tranfer data from old volume to new volume using cp or cpio
4.unmount both volume
5 mount new volume in old mount point and test data and application
6.remove old volume using lvremove
7. take disk out of old volume group using vgreduce.

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
Steven Brown_1
New Member

Re: moving logical volumes

When you get to the transfer point you can also use, say to copy /usr FS to new /mnt FS):

vxdump 0f - /usr | (cd /mnt; vxrestore xf -)
Preparation is an important key to success ... train hard ... perform(fight) easy ....

Re: moving logical volumes

# Scenario:
# 4 internal 18GB drives
# /dev/dsk/c1t0d0
# vg00 - lvol1, lvol2, lvol3, ldata4 (mount point - ldata4), lvol5, lvol6, lvol7, lvol8
# /dev/dsk/c1t2d0
# vg01 - ldata1 (mount point ldata1), ldata5 (mount point ldata5)
# /dev/dsk/c2t2d0
# vg02 - ldata2 (mount point ldata2)
# /dev/dsk/c0t2d0
# vg03 ldata3 (mount point ldata3)

# 2 external 72 GB drives
# /dev/dsk/c4t0d0
# /dev/dsk/c4t2d0

# Goal 1
# move ldata{1-5} to /dev/dsk/c4t0d0

# create volume group vg04 on /dev/dsk/c4t0d0
pvcreate /dev/dsk/c4t0d0
mkdir /dev/vg04
mknod /dev/vg04/group c 64 0x040000
vgcreate /dev/vg04 /dev/dsk/c4t0d0

# create volume groups lvol01-lvol05 and mount points
lvcreate /dev/vg04/lvdata01
# mount point = /dev/dsk/c4t0d0/ldata1a
lvcreate /dev/vg04/lvdata02
# mount point = /dev/dsk/c4t0d0/ldata2a
lvcreate /dev/vg04/lvdata03
# mount point = /dev/dsk/c4t0d0/ldata3a
lvcreate /dev/vg04/lvdatat04
# mount point = /dev/dsk/c4t0d0/ldata4a
lvcreate /dev/vg04/lvdata05
# mount point = /dev/dsk/c4t0d0/ldata5a

# mount -a

cd /ldata1
find * -print | cpio -pvdumx /ldata1a
cd /ldata3
find * -print | cpio -pvdumx /ldata2a
cd /ldata3
find * -print | cpio -pvdumx /ldata3a
cd /ldata4
find * -print | cpio -pvdumx /ldata4a
cd /ldata5
find * -print | cpio -pvdumx /ldata5a
#edit /etc/fstab

/dev/vg04/lvdata01 /ldata1 vxfs rw,suid,nolargefiles,delaylog,datainlog 0 2
/dev/vg04/lvdata02 /ldata2 vxfs rw,suid,nolargefiles,delaylog,datainlog 0 2
/dev/vg04/ldvata03 /ldata3 vxfs rw,suid,nolargefiles,delaylog,datainlog 0 2
/dev/vg04/ldata04 /ldata4 vxfs rw,suid,nolargefiles,delaylog,datainlog 0 2
dev/vg04/lvdata05 /ldata5 vxfs rw,suid,nolargefiles,delaylog,datainlog 0 2

# reboot

#Cleanup
lvremove /vg00/data4
lvremove /vg01/ldata1
lvremove /vg01/ldata5
lvremove /vg02/ldata2
lvremove /vg03/ldata3

vgremove /vg01
vgremove /vg02
vgremove /vg03

Install 2 18 GB drive in external cabinet
Install 2 72 GB drives in internal cabinet

Configure mirror/ux to mirror all drives.

Robert-Jan Goossens
Honored Contributor

Re: moving logical volumes

Hi,

-----
# Scenario:
# 4 internal 18GB drives
# /dev/dsk/c1t0d0
# vg00 - lvol1, lvol2, lvol3, ldata4 (mount point - ldata4), lvol5, lvol6, lvol7, lvol8
# /dev/dsk/c1t2d0
# vg01 - ldata1 (mount point ldata1), ldata5 (mount point ldata5)
# /dev/dsk/c2t2d0
# vg02 - ldata2 (mount point ldata2)
# /dev/dsk/c0t2d0
# vg03 ldata3 (mount point ldata3)

# 2 external 72 GB drives
# /dev/dsk/c4t0d0
# /dev/dsk/c4t2d0

# Goal 1
# move ldata{1-5} to /dev/dsk/c4t0d0

# create volume group vg04 on /dev/dsk/c4t0d0
pvcreate /dev/dsk/c4t0d0
mkdir /dev/vg04
mknod /dev/vg04/group c 64 0x040000
vgcreate /dev/vg04 /dev/dsk/c4t0d0

# create volume groups lvol01-lvol05 and mount points
lvcreate /dev/vg04/lvdata01
# mount point = /dev/dsk/c4t0d0/ldata1a
lvcreate /dev/vg04/lvdata02
# mount point = /dev/dsk/c4t0d0/ldata2a
lvcreate /dev/vg04/lvdata03
# mount point = /dev/dsk/c4t0d0/ldata3a
lvcreate /dev/vg04/lvdatat04
# mount point = /dev/dsk/c4t0d0/ldata4a
lvcreate /dev/vg04/lvdata05
# mount point = /dev/dsk/c4t0d0/ldata5a

# mount -a

cd /ldata1
find * -print | cpio -pvdumx /ldata1a
cd /ldata3
find * -print | cpio -pvdumx /ldata2a
cd /ldata3
find * -print | cpio -pvdumx /ldata3a
cd /ldata4
find * -print | cpio -pvdumx /ldata4a
cd /ldata5
find * -print | cpio -pvdumx /ldata5a

Are you shore you do not have subdirs ?
# find . | cpio -pcmudv /newdir

#edit /etc/fstab

/dev/vg04/lvdata01 /ldata1 vxfs rw,suid,nolargefiles,delaylog,datainlog 0 2
/dev/vg04/lvdata02 /ldata2 vxfs rw,suid,nolargefiles,delaylog,datainlog 0 2
/dev/vg04/ldvata03 /ldata3 vxfs rw,suid,nolargefiles,delaylog,datainlog 0 2
/dev/vg04/ldata04 /ldata4 vxfs rw,suid,nolargefiles,delaylog,datainlog 0 2
dev/vg04/lvdata05 /ldata5 vxfs rw,suid,nolargefiles,delaylog,datainlog 0 2

# reboot
Not needed but can not harm :-)


#Cleanup
lvremove /vg00/data4
lvremove /vg01/ldata1
lvremove /vg01/ldata5
lvremove /vg02/ldata2
lvremove /vg03/ldata3

vgremove /vg01
vgremove /vg02
vgremove /vg03

# vgchange -a n /vg01
# vgchange -a n /vg02
# cgchange -a n /vg03
# vgexport vg01
# vgexport vg02
# vgexport vg03

Install 2 18 GB drive in external cabinet
Install 2 72 GB drives in internal cabinet

Configure mirror/ux to mirror all drives.

Added some comments,

Hope this helps,

Robert-Jan

Re: moving logical volumes

Thanks everyone! This has been very helpful.