Operating System - HP-UX
1833461 Members
3075 Online
110052 Solutions
New Discussion

Re: copying raw devices with command dd

 
SOLVED
Go to solution
uadm26
Super Advisor

copying raw devices with command dd

Hi all!!

I have this hard task that copy raw devices into another vg. I have to duplicate a Informix BD, the raw devices have differents sizes.
I think the best command to do this is dd, but is importante the size of block size? And can you give any suggestions?
Thanks.
8 REPLIES 8
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: copying raw devices with command dd

As long as the destination raw device is at least as large as the source device, you will be fine. The blocksize does not matter as to the integrity of the copy but it does matter a great deal as to the speed of the copy. The default (512 bytes) is much too small. It should be at least 64k and 1024k is quite good. You also need to use the character (rdsk) device nodes rather than the block (dsk) device nodes because you want to bypass the buffer cache.


dd if=/dev/rdsk/c1t5d0 bs=1024k of=/dev/rdsk/c2t6d0

If using LVM, then make sure that you use the rlvol device nodes.
If it ain't broke, I can fix that.
Hein van den Heuvel
Honored Contributor

Re: copying raw devices with command dd

You really want to request s significant block size for optimal performance.
There are dramatic improvements prossible as you go fromteh default to 8kb to 16k to 64kb and such. After that, the benefits diminish, but are still there.
so i woudl pick bs=1024k for 1mb/io.
That also helps to do the final count :-0.
Or pick bs=262144 or such for 256KB per io

fwiw,
Hein.
uadm26
Super Advisor

Re: copying raw devices with command dd

Ok,
but what is rlvol device nodes?
Thanks.
A. Clay Stephenson
Acclaimed Contributor

Re: copying raw devices with command dd

Devices nodes under the control of the Logical Volume Manager (e.g. /dev/vg01/rlvol1). Typically, rather than using raw disks for databases, one uses raw logical volumes so if you are copying those, you would use the raw character device nodes (rlvol1, rlvol2, rlvolwhatever) rather then the raw block device nodes (lvol1,lvol2,lvolwhatever).
If it ain't broke, I can fix that.
uadm26
Super Advisor

Re: copying raw devices with command dd

Ok, but i don' need to copy the block device, that's write?
only i have to do is create the other lv in other vg and use the command dd, something like this:

lvcreate -n lvol3 -L 2056 vgxp

dd if=/dev/vg01/rlvol3 bs=1024k of=/dev/vgxp/rlvol3

... and nothing more
TwoProc
Honored Contributor

Re: copying raw devices with command dd

Joel,
The block device and the raw device both point to the same data, so you don't need or even want to copy both. You don't want to use the block device for the copy via dd because it just goes way too slow. Using dd on the raw(character) device is the best way to do this.
We are the people our parents warned us about --Jimmy Buffett
A. Clay Stephenson
Acclaimed Contributor

Re: copying raw devices with command dd

I'm beginning to suspect that you are not a UNIX guy but one of those DBA types. The character (rlvol,rdsk) and block (lvol,dsk) device nodes refer to exactly the same logical or physical devices. You can use either but the character devices will be much faster because you are deliberately bypassing the UNIX buffer cache. The overhead of writing blocks to the cache and checking for the availability of a block in the cache for reads does no good when EVERY block must be read and written.
If it ain't broke, I can fix that.
uadm26
Super Advisor

Re: copying raw devices with command dd

A. Clay Stephenson, I know tna lvol (block device) and rlvol (raw or character device) is the same. I simple asked about the importance of block size in the copy of a raw device with dd.
Thanks for all your suggestions...