1833017 Members
2146 Online
110048 Solutions
New Discussion

dd of logical volume

 
Sharon Bi_1
New Member

dd of logical volume

Dear all,

Due to out LVM setup, I need to dd some logical volumes to a new set of disk. These logical volumes are not used as raw volume on the server. They are mounted as VxFS file system. My question is how do I dd these logical volumes? Do I need to dd both character and block device?

Thanks!

Sharon
8 REPLIES 8
Pete Randall
Outstanding Contributor

Re: dd of logical volume

Helen French
Honored Contributor

Re: dd of logical volume

I would do any of the following:

1) Mirror the LVs with Mirror-UX and once done, remove the mirror.

2) Run cpio to copy all data to the new file system:

# cd source_dir
# find . -depth | cpio -pdlmuva /dest_dir
Life is a promise, fulfill it!
A. Clay Stephenson
Acclaimed Contributor

Re: dd of logical volume

My preference would be to do a logical copy with cpio -p after doing a newfs on the new lvol but you can do a dd of the old lvol to the new lvol - if the new lvol is at least as big as the old. Choose only the raw or the cooked device, not both. This will copy all the filesystem data structures. You should umount the original first.

Here is one method:

dd if=/dev/vg01/rlvol2 of=/dev/vg03/rlvol5 bs=64k

Now, don't overlook that you could (and probably should) use pvmove, if both of these LVOL's are in the same VG. Also, don't forget to update your /etc/fstab.

If it ain't broke, I can fix that.
Sharon Bi_1
New Member

Re: dd of logical volume

For me, MirrorUX is not an option. Because I already have 16 PVs in my volume group. I can not add any more disks. One of the file system I need to copy has 150G and I only have 6 hours down time. I am afraid that cpio will take long than that. Is dd logical volume, not disk, possible? ( Because then I can dd those twenty some logical volume at the same time)
Sandip Ghosh
Honored Contributor

Re: dd of logical volume

I would do the cpio to copy the data. If you do dd, in that case you have to have both the lv of same size.

You can do pvmove also. Add the new disk to the existing volume group and do a pvmove.

Sandip
Good Luck!!!
Arockia Jegan
Trusted Contributor

Re: dd of logical volume

There are so many ways to do this.

1. Mirroring the volume with the new disk and then break the mirror
2. Use cpio, dd, tar or fbackup commands to copy the data from the volume to the new disk
PIYUSH D. PATEL
Honored Contributor

Re: dd of logical volume

Hi,

Use

#pvmove /dev/dsk/c1t0d0 /dev/dsk/c2t0d0
First one is old disk...next one is new disk.

#pvmove -n /dev/vg01/lvol2 /dev/dsk/c1t0d0 /dev/dsk/c2t0d0
( if you want to move physical extents of lvol2 from one disk to another)

You can use dd if you have a raw filesystem and if both the disk capacities are same.

Or else you can create a new VG and Filesystem and then use this command to copy the data

#cd /source-dir
#find . -depth -print | cpio -pdlmuv /target-dir

Hope this helps.

Piyush

Re: dd of logical volume

Don't assume that dd will be quicker than cpio! Remember that dd is going to copy all the empty space on your file systems as well as all the files. cpio is pretty quick at this - I have done a copy of the size you are talking in about 40 minutes using cpio (OK it was from an EMC to a XP so it *should* be quick!)

HTH

Duncan

I am an HPE Employee
Accept or Kudo