Operating System - HP-UX
1834766 Members
3331 Online
110070 Solutions
New Discussion

Re: Can I clone vg01 to vg02

 
SOLVED
Go to solution
Basheer Azeemuddin
Occasional Advisor

Can I clone vg01 to vg02

vg01 has 1 Disk(4GB) allocated to 2 file systems /u and /image

vg02 Has a Disk (18GB)
I want to have /u /image (of vg01) in vg02 so I can have lot of space

What is the best way to do this
Basheer
5 REPLIES 5
Helen French
Honored Contributor
Solution

Re: Can I clone vg01 to vg02

Hi,

Try this:

1) Create New logical volumes in VG02, with proper sizes:
eg: lvcreate -L 2048 /dev/vg02 (this will create 2GB LV)

2) Create filesystems on the new LVS:
eg: newfs -F vxfs /dev/vg02/rlvol1

3) Create temperary mount points:
eg: mkdir /test1

3) Mount the new file systems:
eg: mount /dev/vg02/lvol1 /test1

4) Copy the old file system to the new one:
eg: find /u -depth | cpio -pdlmuva /test1

5) umount /u
6) mount /dev/vg02/lvol1 /u

Repeat the same steps for /image

HTH,
Shiju
Life is a promise, fulfill it!
S.K. Chan
Honored Contributor

Re: Can I clone vg01 to vg02


Say you wanted to have /u (6GB) and /image (8GB). You would do this ..

# lvcreate -L 6000 -n lvol1 /dev/vg02
# lvcreate -L 8000 -n lvol2 /dev/vg02
# newfs -F vxfs /dev/vg02/rlvol1
# newfs -F vxfs /dev/vg02/rlvol2
# mkdir /new-u
# mkdir /new-image
# mount /dev/vg02/lvol1 /new-u
# mount /dev/vg02/lvol2 /new-image
# cd /u
# find . |cpio -pdumx /new-u
# cd /image
# find . |cpio -pdumx /new-image
# cd /
# umount /u
# umount /image
# umount /new-u
# umount /new-image
# rmdir /new-u
# rmdir /new-image
# vi /etc/fstab
===> replace the appropriate entries
# mount -a
===> clean vg01 at your leaisure
Basheer Azeemuddin
Occasional Advisor

Re: Can I clone vg01 to vg02

Thanku all

Hey Chan
The last 2 shoud be rmdir /u and rmdir /image
is that right
Basheer
Helen French
Honored Contributor

Re: Can I clone vg01 to vg02

Hi,

It depends. If you want to keep the old name and the new file system, then remove new-u and new-image OR for a new name and new file system, remove u and image.

It doesn't matter, it's just a mount point. But if you have scripts / programs that refer to the old directory name, then better keep the old name.

HTH,
Shiju
Life is a promise, fulfill it!
Basheer Azeemuddin
Occasional Advisor

Re: Can I clone vg01 to vg02

Thanks a lot for your Help.
Here is what I did, Hey It Worked

1)lvcreate -L 9000 -n lvimage /dev/vg02
2)newfs -F hfs /dev/vg02image/rlvimage
3)mkdir /imagebak
4)mount /dev/vg02/lvimage /imagebak
Since I am new, I used SAM to do Steps 1 thru 4

5) cd /imagebak
6) find . -depth | cpio -pdlxmuva /imagebak > cp.log 2&1 &
7) shutdown to singleuser ( because I was not able to umount /1MAGE
8) umount /imgaebak
9) vi /etc/fstab
(Old one commented, new one added)
#/dev/vg01/new-image /1MAGE hfs rw,suid 0 2
/dev/vg02image/lvimage /1MAGE hfs rw,suid 0 2

Re-Booted

Everything Worked
Basheer