Operating System - HP-UX
1829863 Members
2186 Online
109993 Solutions
New Discussion

How to change lvols from one vg to another vg

 
Carme Torca
Super Advisor

How to change lvols from one vg to another vg

Hi,

I need to change lvols from one vg (vg00), to another vg (vg01), with another disk.
What could I do?,

Thanks,
Carmen.
Users are not too bad ;-)
11 REPLIES 11
Michael Tully
Honored Contributor

Re: How to change lvols from one vg to another vg

You can't move a logical volume that is part of one group to another. You will need to create a new logical volume put a filesystem on it and copy the data, or remove the logical volume from vg00 and create it in vg01 and restore that data from tape/disk etc.

Regards
Michael
"When I have trouble spelling, it's called fat finger syndrome."
Anyone for a Mutiny ?
Ian Dennison_1
Honored Contributor

Re: How to change lvols from one vg to another vg

Create completely new lvols on the new VG, and copy the datafiles while the database is down.

Sorry, there is no easy method for this.

Share and Enjoy! Ian
Building a dumber user
Massimo Bianchi
Honored Contributor

Re: How to change lvols from one vg to another vg

hi,
there is no easy procedure.

option 1- reinstall the server with ignite (i know this takes long...)


option 2- if lvol are not in use, you can umount the lvol, create a new lvol exactly the same size in the vg01, copy with dd using the raw logical volume the content to the new lvol and mount it

if lvol are in use, you may trying going down to maintenance mode or single user...


Why do you want to move the lvol ? If it is for space needings, maybe a search of big files can help.

Can you give more details?

HTH,
Massimo



Carme Torca
Super Advisor

Re: How to change lvols from one vg to another vg

But,
I cannot do and vgexport from vg00 and a vgimport to vg01, and after remove the file systems in vg01 than are from so in vg00??

Users are not too bad ;-)
Bernhard Mueller
Honored Contributor

Re: How to change lvols from one vg to another vg

Carme,

you will need to create a new lvol and filesystem in vg01, mount it and then copy over the filesystem from vg00 (there should be no changes to the filesystem while you copy it).
finally change /etc/fstab to reflect the change
and remove the unused lvol from vg00.

vg00 is usually the root volume group, which lvol/filesystem do you want to move out?

first check with
fuser -cu /mount_point_of_lvol

whether there are processes that use this filesystem (you will have to stop them)

I assume you are not using the lvol as a raw volume...

Regards,
Bernhard
Carme Torca
Super Advisor

Re: How to change lvols from one vg to another vg

I have this:

#bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 204800 85000 118872 42% /
/dev/vg00/lvol1 295024 70008 195512 26% /stand
/dev/vg00/lvol8 4812800 476872 4302536 10% /var
/dev/vg00/lvol7 2150400 1018816 1122760 48% /usr
/dev/vg00/lvol6 204800 49776 154488 24% /tmp
/dev/vg00/lvol5 2150400 1029016 1112632 48% /opt
/dev/vg00/lvol4 24576 2320 22088 10% /home
/dev/vg00/lv_apps 23560192 13624296 9314905 59% /apps
/dev/vg00/lv_orafin
26624000 92972 26205396 0% /app/orafin
/dev/vg00/lv_ora9 3727360 3625309 95690 97% /app/oracle9
/dev/vg00/lv_ias9 3145728 809949 2189951 27% /app/ias9

And I want to move /apps, /app/orafin, /app/ias9 and /app/oracle9 to vg01.

Could I do this with vgexport and vgimport??

Thanks!
Users are not too bad ;-)
Jorge Pons
Trusted Contributor

Re: How to change lvols from one vg to another vg

Hi

Why do you need change vg?
more free space? it??s possible umount this lvol?..

The only way that I know is backup, create the new lvol in the other vg and restore

Regards

Jorge

Vicente Sanchez_3
Respected Contributor

Re: How to change lvols from one vg to another vg

Hello Carmen,

Exporting a vg means export all the configuration, so if you import vg00 into vg01, then you'd lost vg01 configuration.

There is no other solutions as mentined.

Regards, Vicente.
Michael Tully
Honored Contributor

Re: How to change lvols from one vg to another vg


We need to see if the unwanted volumes are on a separate disk.

Please post a copy of :

# vgdisplay -v /dev/vg00

for each volume you wish to move
# lvdisplay -v /dev/lv_ora9


Regards
Michael
"When I have trouble spelling, it's called fat finger syndrome."
Anyone for a Mutiny ?
Vicente Sanchez_3
Respected Contributor

Re: How to change lvols from one vg to another vg

Hello Carmen,

If you have space enought in vg01 you can do:

- rename mount directories to name.old.

- create the new volumes in vg01 with the original mount names (/apps...)

- copy from apps.old to apps and the same for other lvols.

- verify results.

- delete old vg00 lvols.

Regards, Vicente.
Jarle Bjorgeengen
Trusted Contributor

Re: How to change lvols from one vg to another vg

Vgexport/import only changes the vg_definitions in the operating system only. It does not move data between physical disks.

I.E. you can export a vg, and hence remove its entries in /etc/lvmtab, the /dev/vg... directory, the group file.

You can then re-create the /dev/vg(x)/group , and vgimport as anothe name, but the contetns will be the same.

You can't vgexport vg00.

So yes, the only way is to copy.

use
#cd dir_to_copy_from
#find .| cpio -pdumv dir_to_copy_to

Rgds Jarle