1826388 Members
4569 Online
109692 Solutions
New Discussion

LVM Migrate!

 
SOLVED
Go to solution
Sunny Chen
Occasional Advisor

LVM Migrate!

Hi, I am a new guy on hp-ux, any help will be very appreciate. I have VG00, and I created by 2 disk /dev/dsk/c0t5d0 and /dev/dsk/c0t6d0, I want to migrate /home and /opt LVM to disk /dev/dsk/c0t6d0, since /dev/dsk/c0t5d0 is full, the reason why I need to do that, just for testing. My idea is create a new LVM on /dev/dsk/c0t6d0, than "cp" /home to the new LVM /mountdir, then "rm" /home and "home" LVM, but I don't want to do like that, because if the "/home" include the DB, that may cause data corrupt, is there any good solution or command I can migrate LVM to another disk directly? thanks a lot.
Life is 10 percent what you make it and 90 percent how you take it.
7 REPLIES 7
Victor BERRIDGE
Honored Contributor

Re: LVM Migrate!

what size disk are you using?, my advice would be: keep all system related in vg00 and put the rest in vgXX... like that when it comes to migrating or upgrade or system recovery you know what disks are concerned...
now copying a filesystem somewhere else is best done with cpio:
find . -print | cpio -pduml ~/dir2

Regards
Victor
CHRIS_ANORUO
Honored Contributor

Re: LVM Migrate!

Backup your system first.
Create temporary filesystems /home1 and /opt1
Copy over opt and home to opt1 and home1 respectively( find .(opt or home) |cpio -dumplv /opt1 or /home1
modify /etc/fstab(/opt to /opt1 vice versa), reboot.
When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
John Palmer
Honored Contributor
Solution

Re: LVM Migrate!

Sunny,

You need to get your system in a state where both filesystems /home and /opt are not being used by anything. This may involve (especially for /opt) dropping into single user mode (shutdown 0) or booting into single user mode.

Create your new logical volumes (lvcreate) and filesystems (mkfs) and mount them at temporary mountpoints.

Ensure that /home and /opt are mounted (if in single user mode) then you can either move the contents to the new volumes (using mv) or copy the contents with something like cpio (cd ; find . -xdev -depth -print | cpio -puxdm ).

Then unmount your old /home and /opt, edit /etc/fstab to change the volume names and test mount them with mount -a.

If all is well, the new volumes will be mounted.

Reboot and your new volumes should be in use. You can then remove the old volumes with lvremove.

Regards,
John
Sunny Chen
Occasional Advisor

Re: LVM Migrate!

Thank you Victor, Sorry to let you feel confusion. I just want to play and do some test. I have 2 disks on that HP, and I am using hp-ux 11.0, one disk is 1.2G, another one is 2G, I created vg00 for first and created vg01 for second, it works fine. Then, I try to play, I want to create a LVM across 2 disks, so I have to rm vg01, and combine this disk with vg00, right now, I got one VG with 2 disks, after this, I want to create a new LVM across 2 disks, but I found the 1.2G dsk is full, so I just think I can migrate the "home" and "opt" to the second dsk, and I can get space from dsk1, maybe it is a stupid way, but just want to do some test. Thank you very much!
Life is 10 percent what you make it and 90 percent how you take it.
Sunny Chen
Occasional Advisor

Re: LVM Migrate!

Dear All:

How about command pvmove? any idea? Thanks
Life is 10 percent what you make it and 90 percent how you take it.
Victor BERRIDGE
Honored Contributor

Re: LVM Migrate!

since youre in test mood go ahead with pvmove, I never had trouble with this command, works fine but last time I used it was more than a year ago...
Sunny Chen
Occasional Advisor

Re: LVM Migrate!

Thanks, and I did use "pvmove", it is perfect.
Life is 10 percent what you make it and 90 percent how you take it.