1833755 Members
3007 Online
110063 Solutions
New Discussion

vg rebuild

 
Scott Ransted
Occasional Contributor

vg rebuild

Hello,

I need to re-build a vg (the max PE per PV is to small). I need to bring in some larger disks into this vg. Can I re-build the vg, and then somehow 'import' the original disks back in?
5 REPLIES 5
Michael Tully
Honored Contributor

Re: vg rebuild

Hi,

No you would need to create a new VG. You can't add a larger disk to an existing volume group larger than the first disk that was added. You can't actually export/import to a different group name either. The best method would be to create a new volume group and logical volumes of equivalent size or bigger, create new filesystems on them, copy the data and then re-mount the new logical volumes on the old mount point names.

Cheers
~Michael~
Anyone for a Mutiny ?
S.K. Chan
Honored Contributor

Re: vg rebuild

Unfortunately you can't do the vgimport stuff. The only way is to recreate the VG with the larger disks first from scratch. Typically this would be the process.. (say vg03)
a) Backup of all data in vg03.
b) Take note of these ..
- LV configuration
- FS configuration
c) Umount all FS that of vg03.
d) Remove vg03 (using vgexport is the fastest)
# vgchange -a n /dev/vg03
# vgexport /dev/vg03
e) Create back your vg03.
# pvcreate /dev/rdsk/cXtYdZ
# mkdir /dev/vg03
# mknod /dev/vg03/group c 64 0x030000
# vgcreate /dev/vg03 /dev/dsk/cXtYdZ
==> use the largest disk here
# vgextend /dev/vg03 /dev/dsk/cAtBdC
==> repeat for the rest of the disks
# lvcreate -n -L /dev/vg03
==> repeat for the rest
# newfs -F /dev/vg03/rlvolX
==> recreate FS

Finally mount them and restore the data.
Having said all that I think it is simply much easier to just use those larger disks and create a separate VG.
Scott Van Kalken
Esteemed Contributor

Re: vg rebuild

You can then rename the VG with the following. Just for neatness sake.


# vgchange -a n /dev/vg01
==> umount the FS and deactivate it

# vgexport ???m /tmp/mapfile /dev/vg01
# mkdir /dev/vg02
# mknod /dev/vg02/group c 64 0x020000
# vgimport ???m /tmp/mapfile /dev/vg02 /dev/dsk/ /dev/dsk/ ..
# vgchange -a y /dev/vg02
# vgcfgbackup /dev/vg02


To copy file systems I use the following method:

dump 0f - /usr | (cd /mnt; restore xf -)

of vxdump if vxfs

This is in the man page for restore if you can't remember it.

John Dvorchak
Honored Contributor

Re: vg rebuild

After you create the new vg and want to copy the old files I prefer to use cpio in the followin format:

mount /dev/vg0xxx/lvolxx /old_filesystem

cd /old_filesystem

find . -depth | cpio -dumpx /new_mount_point

This way all perms etc. are retained.
Good luck
If it has wheels or a skirt, you can't afford it.
Sanjay_6
Honored Contributor

Re: vg rebuild

Hi Scott,

You cannot do that. Maybe this link can explain a few things for you.

http://support2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000054370942

Hope this helps.

Regds