Operating System - HP-UX
1822107 Members
3722 Online
109640 Solutions
New Discussion юеВ

Re: What is the technical reason you shouldn't/can't use dd to copy one LV to another LV ?

 
SOLVED
Go to solution
John Knapp
Advisor

What is the technical reason you shouldn't/can't use dd to copy one LV to another LV ?

I got the run around from IBM technical support over the merits of using the dd command to copy the contents of a logical volume of a source filesystem over to another logical volume of a target filesytem.

Assumption is that both source/target filesystems are unmounted for the dd command.

Any gurus care to enlighten this neophyte ???
Thanks :-)

PS: I did use dd on LVs and it appears to work successfully (at least on AIX LVs)
12 REPLIES 12
Clemens van Everdingen
Honored Contributor

Re: What is the technical reason you shouldn't/can't use dd to copy one LV to another LV ?

HI,

You could use dd to copy one disk to an other exact same size disk.
I guess it will be different with lv's.
They use the LVM structure which is on the disk.
Also how would you point to the correct lv to copy.
This as dd will use blocks to copy over.
It will also be difficult to assign to blocks to the correct lv.
So seems to me almost impossible to do.

Regards,
C.
The computer is a great invention, there are as many mistakes as ever, but they are nobody's fault !
Jeff Schussele
Honored Contributor

Re: What is the technical reason you shouldn't/can't use dd to copy one LV to another LV ?

Hi John,

One implication, noting that dd is a bit-by-bit copy, would be doing a dd of a root disk LV that contains HW paths config info.
This info would now be incorrect on the destination if the destination LV is a different disk.

*Generally* speaking performing a dd on application *data* is usually safe - but not necessarily so when you dd OS *data*.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Bill McNAMARA_1
Honored Contributor
Solution

Re: What is the technical reason you shouldn't/can't use dd to copy one LV to another LV ?

There could have been bad blocks on the disk.
The bad block relocation information is stored on the LVM disk headers. You don't dd that when you dd an lv... so potentially you could get data corruption.

Later,
Bill
It works for me (tm)
David Burgess
Esteemed Contributor

Re: What is the technical reason you shouldn't/can't use dd to copy one LV to another LV ?

I just tried :-

lvcreate -L 10 -n test1 /dev/vg00
lvcreate -L 10 -n test2 /dev/vg01
newfs -F vxfs /dev/vg00/rtest1
newfs -F vxfs /dev/vg01/rtest2

mkdir /test1 /test2
mount /dev/vg00/test1 test1

cp -pR /etc /test1

dd if=/dev/vg00/rtest1 of=/dev/vg01/rtest2 bs=1024k

fsck /dev/vg01/rtest2

mount /dev/vg01/test2 /test2

ll -R | wc -l /test1
1438

ll -R | wc -l /test2
1438


Everything looks ok.

To be safe back up the filesystem and restore it to the new lv.

HTH

Dave.
John Knapp
Advisor

Re: What is the technical reason you shouldn't/can't use dd to copy one LV to another LV ?

Clemens .... try this on a "crash & burn" machine with the FS unmounted ...

dd if=/dev/vg01/lvol1 of=/dev/vg02/lvol2 bs=64b

We have a situation with an AIX server that has 750+ GBs worth of user filesystems that contain 250,000+ files and are over 32GBs each. Using find/cpio on these deep directory structures is too much overhead on the FS buffer & O/S.

I have used dd on those types of filesystem (LVs) with apparently success but other technical folks have told me I couldn't do it unless the filesystems were NOT made through an LVM.

No one up to this point could give me a true technical reason why ... except for Bill McNamara ... read it ... it seems reasonable.
pap
Respected Contributor

Re: What is the technical reason you shouldn't/can't use dd to copy one LV to another LV ?

Hi John,

It is very simple thing to understand that dd copies the data in hardware fashion means it will not look for the actual data written on the disk and format of data.

While LVM is spreaded over many disks and it manages data in a logical way. Hence it is not possible at all.

-pap
"Winners don't do different things , they do things differently"
John Knapp
Advisor

Re: What is the technical reason you shouldn't/can't use dd to copy one LV to another LV ?

Bill ... thank you for offering that cautionary note on the bad block issue with dd ...

Dave .... thank you for confirming that you could do what I had done ... might not be the safest utility but we can migrate a 32GB filesystem with 250K files in 110 minutes ... cpio took over 4 hours.

If anyone else can offer reasons why not to use dd ... I welcome them ....

thanks folks for great responses to a great forum ... answers in 10 minutes or less compared to a couple of days with AIX technical support .....
John Knapp
Advisor

Re: What is the technical reason you shouldn't/can't use dd to copy one LV to another LV ?

pap ...

I have successfully dd'd logical volumes spread over multiple disks serveral times on AIX .... it is possible at least on a RS/6000.

If someone could try it on an HP9000 over a couple of disks and see if it works or not ... that would be great.
Clemens van Everdingen
Honored Contributor

Re: What is the technical reason you shouldn't/can't use dd to copy one LV to another LV ?

Hi guys,

Learned something again.
I would not have come to this idea at all.
I would have copied the file over with ftp or something like that.
At least if the AIX server is still running.

Thanks,
C.
The computer is a great invention, there are as many mistakes as ever, but they are nobody's fault !
pap
Respected Contributor

Re: What is the technical reason you shouldn't/can't use dd to copy one LV to another LV ?

Hi John,
Thanks for the explanation . Actually I misunderstood your question. What I understood that you want to copy a disk image of a logical volume.

Sorry about that. Ofcourse you can do the same thing on HP too. Its completely possible.

Thanks,
-pap
"Winners don't do different things , they do things differently"
Helen French
Honored Contributor

Re: What is the technical reason you shouldn't/can't use dd to copy one LV to another LV ?

Hi John:

Just an addition - If you have already copied the "bad block directory area" from the source to destination file system, you can clear it with a utility called - 'bbdir'. You need to contact HP for getting this tool.

HTH,
Shiju
Life is a promise, fulfill it!
John Knapp
Advisor

Re: What is the technical reason you shouldn't/can't use dd to copy one LV to another LV ?

Folks ... make sure HP/Compaq doesn't make this forum a victim of the acquisition. This forum is so valuable to us folks in the trench that it would cost more to man more engineers on the front lines to address "simple" questions such as mine.

once again thanks to all.