1827752 Members
3291 Online
109969 Solutions
New Discussion

dd command

 
malki_3
Frequent Advisor

dd command

I will changing a disk that contains data because theres a lot af anoamlies with it
I want know if the following command is correct
#dd if=/dev/dsk/c0t11d0 of=/dev/dsk/cxtdz
On the end I will puting the new disk on tha emplacement of the old one and I want know if I muts do some things for that this action will tranparent for ths system..!!
Thanks
7 REPLIES 7
Pete Randall
Outstanding Contributor

Re: dd command

Malki,

First, add a block size (bs=1024k) to the end of your command - otherwise it will take forever.

Second, is the new disk identical to the old? You can have problems if not.

Pete

Pete

Re: dd command

Malki, this will also duplicate all the data in the old disks bad block table to the new disk - If this disk contains a file system you'd be better to back that up and restore to the new disk after creating the necessary logical volumes etc.

Cheers

Duncan

I am an HPE Employee
Accept or Kudo
Sebastian Galeski_1
Trusted Contributor

Re: dd command

If You specify Block Size at the end of this command ican be done faster, it depends on storage system.

#dd if=/dev/dsk/cxtxdx of=/dev/dsk/cxtxdx bs=1024k

You can use block devices as well as character devices, sometimes block are much faster than character.

hope it help You
harry d brown jr
Honored Contributor

Re: dd command

Why not use "pvmove"? Or better yet, back the data up to tape and restore it?

live free or die
harry
Live Free or Die
PIYUSH D. PATEL
Honored Contributor

Re: dd command

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
Bill McNAMARA_1
Honored Contributor

Re: dd command

You need to watch out doing dd's like that especially if the disks are LVM disks, you will dd LVM headers from one disk to another... then LVM will start thinking that there are two disks with the same header (it may think its an alternate path)

In any case, if you are going to physically remove the (if input file) disk and replace it with the of (output file) disk there will not be a problem..

But pvmove as suggested works just as well!!

Later,
Bill

It works for me (tm)
Shahul
Esteemed Contributor

Re: dd command

Hi

As others suggested, I won't suggest U to go for dd. dd is suitable when U want to restore one HDD's data when U are not able to mount that file system because of some bad block or some other reason.

If U are able to mount ur file system, then back and restore the data or do direct dumb, Or even U can use pvmove... it is up to U.

Best of luck
Shahul