Operating System - HP-UX
1833163 Members
3182 Online
110051 Solutions
New Discussion

Using dd to copy raw data

 
Richard Low
Advisor

Using dd to copy raw data

Hi,

I need to copy raw data from some lvols in a vg (eg vgA)to another vg (vgB) within the same server. The original data should still remain.

The source device is a SAN LUN consisting of only 1 vg, which has 7 lvols, each ontaining raw database for filenet.

Q1) Can I use the "dd" command to copy?
Q2) Which device name should I use in the dd command: the raw device path (/dev/rdsk/xxxxx), the vg name (/dev/vgX) or the lvol name?
Q3) Do I need to follow-up with other commands (eg vgimport) after the copy?
Q4) If can't use "dd", which command can I use?

Thanks for your responses.
15 REPLIES 15
Ludovic Derlyn
Esteemed Contributor

Re: Using dd to copy raw data

Hi,

other command you can use is pvmove

pvmove diska diskb


regards

L-DERLYN
Richard Low
Advisor

Re: Using dd to copy raw data

Hi,

Does the pvmove command preserve the original source data? I need to maintain the original source data as a fallback, in case the copying goes wrong or something.

thanks.
Ludovic Derlyn
Esteemed Contributor

Re: Using dd to copy raw data

hi,

no preservation, it's a physical move

regards

L-DERLYN
A. Clay Stephenson
Acclaimed Contributor

Re: Using dd to copy raw data

1) Yes
2) Use the /dev/vgX/rlvolXX devices nodes for both if= and of= devices and also specify a blocksize (e.g. bs=256k) otherwise the default blocksize of 512 bytes will be painfully slow.
3) No, because you have already created your new VG with corresponding LVOLS as your destination VG. The only requirement is that the destination LVOL's be at least as large as the source LVOL's.
4) n/a

The most important criterion is that you correctly specify the if=src_device and of=dest_device device nodes correctly because if you get those backwards even once, you have destroyed data. If this were me, I would write a small script, examione it carefully, and run it rather than doing the dd's interactively.
If it ain't broke, I can fix that.
Richard Low
Advisor

Re: Using dd to copy raw data

Hi Clay,

I have not created the destination lvol yet, only the vg. I thought that I might be able to copy the whole vg over & do a vgimport to get back the lvol structures.
Ludovic Derlyn
Esteemed Contributor

Re: Using dd to copy raw data

hi again richard,

for me, vgimport will not work because vg destination is different to source

vgexport and vgimport are used for import or export vg information for same vg on different servers , not for import on a different vg

regards

L-DERLYN
A. Clay Stephenson
Acclaimed Contributor

Re: Using dd to copy raw data

Then think again. You could do dd's at the /dev/rdsk/xxx level to copy LUN to LUN and that would create a copy of the VG. You could then run vgchgid to change the VGID of the VG copy and then vgimport the copy. It's more straightforward to create the destination VG and LVOL's and then copy on an LVOL by LVOL basis. No vgchgid or vgimport would then be needed.
If it ain't broke, I can fix that.
Richard Low
Advisor

Re: Using dd to copy raw data

Hi All,

Thanks for your advice.

Clay, I will try it out on a test system when I get back to office in a day or two. I'm concern on how the filenet application reference those raw data.

After the copy, I plan to deactivate & rename the original VG so that the filenet application will reference only the new copy.

I'm not familar with raw partitions, so correct me if I'm wrong: Does most applications reference their data in the raw partition using the raw lvol name?

Thanks.
A. Clay Stephenson
Acclaimed Contributor

Re: Using dd to copy raw data

How raw devices are addressed is solely dependent upon the application. Bear in mind that it is entirely possible to create links (either hard or soft) for a device node, so even in the case of a hard-coded (very dumb) name in an application, it is still possible to out-bushwhack it via links.
If it ain't broke, I can fix that.
Steven E. Protter
Exalted Contributor

Re: Using dd to copy raw data

Shalom,

I tried this once with adabas raw disks. It did not work. There are preparation steps seem to be destroyed by the dd process.

So it will not work for all applications.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ramones
Frequent Advisor

Re: Using dd to copy raw data

Hi all

I am sorry to "interrupt" with my own questions.
It's about Clay Stephenson statement:

"You could do dd's at the /dev/rdsk/xxx level to copy LUN to LUN and that would create a copy of the VG. You could then run vgchgid to change the VGID of the VG copy and then vgimport the copy"

In this case you would have to diferent vg's with the same VGID in the same machine. Is this possible?


Regards,
STP
A. Clay Stephenson
Acclaimed Contributor

Re: Using dd to copy raw data

In this case you would have to diferent vg's with the same VGID in the same machine. Is this possible?

This is why I said he needs to run the vgchgid command on the copied LUN's. It changes the VGID so that otherwise identical copies of a VG can peacefully coexist on the same system. You should also note that I actually suggested that he do an LVOL to LVOL copy with both VG's already existing.



If it ain't broke, I can fix that.
Ramones
Frequent Advisor

Re: Using dd to copy raw data

Hi

Yes..indeed.
Sorry for the stupid question, I misunderstood.


Thanks,
STP
Richard Low
Advisor

Re: Using dd to copy raw data

Hi All,

thanks for your suggestions.

I've managed to test the copying successfully using Clay's suggestions.

Regards.
Richard Low
Advisor

Re: Using dd to copy raw data

Thanks for the replies.