Operating System - HP-UX
1845029 Members
1909 Online
110233 Solutions
New Discussion

Moving logical volumes from one vg to another

 
SOLVED
Go to solution
Jeff Ohlhausen
Frequent Advisor

Moving logical volumes from one vg to another

Hi,
I'm looking to release disks from one of the systems I'm looking after. The problem is the logical volumes are too large. I can allocate extra disk equal in size to the volume group.

I was thinking that I should create another volume group and somehow copy the data. Any suggestions?

Thanks
jeff
Do or do not - there is no try.
10 REPLIES 10
Pete Randall
Outstanding Contributor

Re: Moving logical volumes from one vg to another

Jeff,

With logical volumes, there is no convenient, direct method from moving them. The best you can do is to create a new logical volume in another VG and then copy the contents of the original into it with cp or a backup/restore operation.


Pete

Pete
RAC_1
Honored Contributor

Re: Moving logical volumes from one vg to another

You can not move LVs across the the VGs.

What you can do it create a new LV(in another VG) and mount it and copy the contents of old LV to new LV.

Or you can back up your data, delete LV, create new one and restore.
There is no substitute to HARDWORK
Elmar P. Kolkman
Honored Contributor

Re: Moving logical volumes from one vg to another

In that case create the new lvol (EXACTLY the same size), unmount the old lvol and do:
dd if= of= bs=4096k

Then try mounting the new lvol on the mountpoint of the old lvol and it should work...

If the lvol is not filled up, copying using tar, pax, ftio, etc might be faster, depending on the number of files, etc.
Every problem has at least one solution. Only some solutions are harder to find.
Fabio Ettore
Honored Contributor

Re: Moving logical volumes from one vg to another

Hi Jeff,

check this thread:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=384747

Anyway the crucial command is

# cd /fv24
# find . -xdev -print | cpio -pdmvux /fv24.new

fv24 is old filesystem and fv24.new is the new one.

Best regards,
Ettore
WISH? IMPROVEMENT!
Karthik S S
Honored Contributor

Re: Moving logical volumes from one vg to another

But why dont you extend the Volume group with the new disk then extend the LV and the filesystem (vgextend,lvextend,fsadm)

-Karthik S S
For a list of all the ways technology has failed to improve the quality of life, please press three. - Alice Kahn
Jeff Ohlhausen
Frequent Advisor

Re: Moving logical volumes from one vg to another

Hi,
If I create the second vg with the same logical volume names what can I do about the filesystems? Obviously I have to preserve the name of the old file systems. Is there a way to copy and then rename?

Part of this is that I have to resize the logical volumes as well.

Jeff
Do or do not - there is no try.
Helen French
Honored Contributor
Solution

Re: Moving logical volumes from one vg to another

You don't need to rename the file systems. After you create new LVs mount it in a temporary directory and then move data. Once that's done, unmount both file systems and mount the new one in to the original file system name. Update your /etc/fstab too.

You need to make sure that the newly created LVs are capable of carrying the data (enoug space available). These might be the steps:

1) Create new VGs and LVs
2) Mount it on temp. directories
3) Copy data
4) Unmount both new and old file systems
5) Update /etc/fstab to mount new LVs on old file system names
6) mount -a
Life is a promise, fulfill it!
Pete Randall
Outstanding Contributor

Re: Moving logical volumes from one vg to another

Jeff,

The file system mount points are easy - just change /etc/fstab and reboot (or umount each and then mount -a).

Change

/dev/vg01/lvol1 /myfs vxfs delaylog 0 2

-to-

/dev/vg02/lvol1 /myfs vxfs delaylog 0 2


Pete

Pete
Tim Sanko
Trusted Contributor

Re: Moving logical volumes from one vg to another

Jeff,

What do you mean they are too large. A volume group may be full, and then you can extend them with vgextend. You can have 100 GB VGs with no real issue (except the backup. If you use Veritas and then one trail is 100 GB, it is annoying that the VG takes so long to back up...

What is your issue, backup, full, need to redistribute data better. Size seems to me to be a questionable issue.

Technically you would back up the data,
vgreduce the pv in question, make a new VG up to the limit of 256. Make sure your maxVGs in the kernel parameters will not be exceeded. After mounting the drive, recover your data.

That being said, is there a software problem that fills up the drive? where it is currently mounted?

Tim
Tim Sanko
Trusted Contributor

Re: Moving logical volumes from one vg to another

These Sharks are fast and have sharp teeth. Everybody got to the core of the issue...

Tim