1833790 Members
2725 Online
110063 Solutions
New Discussion

Disk copy

 
SOLVED
Go to solution
Tim Stallman
Advisor

Disk copy

Hi,
What is the best way to do a disk copy? I am wanting to clone a disk and I'm looking for the quickest way to do this (and I do not want to use ignite).

Thx,
Tim
10 REPLIES 10
Robert-Jan Goossens
Honored Contributor

Re: Disk copy

Hi Tim,

Not quite sure what you would like to do but,

dd if=/dev/rdsk/c?t?d? of=/dev/rdsk/c?t?d? bs=1024k

will copy the disk.

Hope it helps,

Robert-Jan.
John Palmer
Honored Contributor

Re: Disk copy

If the disks are identical, dd will do the trick...

dd if=/dev/rdsk/??? of=/dev/rdsk/??? bs=64k

Make sure you have the correct output disk though ;-)

Regards,
John
melvyn burnard
Honored Contributor

Re: Disk copy

dd does work, but be aware it is a bit-by-bit copy, and if the source has errors, it will copy those across as well.
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
MANOJ SRIVASTAVA
Honored Contributor

Re: Disk copy

dd is device to device copy , you can copy disk to disk using it , however if u ahve mirror ux then u can also use lvm to do the job ,

in case you have EMC then there are ltos of time finder option to do the same.



Manoj Srivastava
Tim Stallman
Advisor

Re: Disk copy

does it matter what bs I use or can I take the default. My file systems are hfs with the default block size.

Thx,
Tim
Tom Jackson
Valued Contributor

Re: Disk copy

Hi Tim:

I have a cron job that copies disks every night here's the code:

#!/bin/ksh
echo "starting mirror_cathm208 at `date`" > /tmp/mirror_208data 2>&1
echo "dd the disks..." >> /tmp/mirror_208data 2>&1
/usr/bin/dd if=/dev/vg01/rlvol1 of=/dev/vg03/rlvol1 bs=64k >> /tmp/mirror_208dat
a 2>&1
/usr/bin/dd if=/dev/vg01/rlvol2 of=/dev/vg03/rlvol2 bs=64k >> /tmp/mirror_208dat
a 2>&1
/usr/bin/dd if=/dev/vg01/rlvol3 of=/dev/vg03/rlvol3 bs=64k >> /tmp/mirror_208dat
a 2>&1

echo "fsck the disks..." >> /tmp/mirror_208data 2>&1
/usr/sbin/fsck -F vxfs -y /dev/vg03/rlvol1 >> /tmp/mirror_208data 2>&1
/usr/sbin/fsck -F vxfs -y /dev/vg03/rlvol2 >> /tmp/mirror_208data 2>&1
/usr/sbin/fsck -F vxfs -y /dev/vg03/rlvol3 >> /tmp/mirror_208data 2>&1

echo "done at `date`" >> /tmp/mirror_208data 2>&1

The above code is for data disks. I have another script for my system disk. The system disk requires some additional steps. Let me know if you're interested.

Tom

John Palmer
Honored Contributor

Re: Disk copy

The block size you tell dd is the buffer size it will use for I/O, nothing to do with the filesystem blocksize.

If you default it, dd uses 512 bytes which is slooooooow. From experiment, anything above 8k appears to give optimal performance.

Regards,
John
Robert-Jan Goossens
Honored Contributor
Solution

Re: Disk copy

Hi Tim,

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x464d5c7609e9d61190050090279cd0f9,00.html

discussion about blocksize.

Kind regards.

Robert-Jan.

James R. Ferguson
Acclaimed Contributor

Re: Disk copy

Hi Tim:

To add to John's suggestions, just make sure to use the character disk device (/dev/rdsk). You don't want to impose needless overhead through LVM.

Regards!

...JRF...
Oleg Zieaev_1
Regular Advisor

Re: Disk copy

Tim,

applying dd to rdsk is also much faster.
This is also true for rlvols.

Hope this helps.
0leg
Professionals will prevail ...