LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   Copy data from one hard disk to another hard disk (https://www.linuxquestions.org/questions/linux-desktop-74/copy-data-from-one-hard-disk-to-another-hard-disk-745489/)

vino87 08-06-2009 02:21 AM

Copy data from one hard disk to another hard disk
 
I have sata hard disk it has 4 partitions, I need to copy the data from that hard disk to another sata hard disk with the same partition in the new hard disk ?

Ipolit 08-06-2009 07:51 AM

If both disks have same size you can use dd command for cloning the first disk
Code:

dd if=/dev/sda of=/dev/sdb
If the second one is bigger you can do the same exercise and you'll have some space left on the disk which later you can partition.

If the first one is bigger but you think that the data can fit on the second, you can use gparted and to resize partitions on the first disk in the manner to fit on the second and to use dd for each partition

Code:

dd if=/dev/sda1 of=/dev/sdb1
dd if=/dev/sda2 of=/dev/sdb2
dd if=/dev/sda3 of=/dev/sdb3
dd if=/dev/sda4 of=/dev/sdb4

And if we are talking about linux system which you want to start from the second disk you'll have to clone the MBR with

Code:

dd if=/dev/sda of=/dev/sdb bs=512 count=1
This is for the third case, in first two the MBR is included

moekad 08-06-2009 08:32 AM

Quote:

Originally Posted by Ipolit (Post 3633533)
If both disks have same size you can use dd command for cloning the first disk
Code:

dd if=/dev/sda of=/dev/sdb
If the second one is bigger you can do the same exercise and you'll have some space left on the disk which later you can partition.

If the first one is bigger but you think that the data can fit on the second, you can use gparted and to resize partitions on the first disk in the manner to fit on the second and to use dd for each partition

Code:

dd if=/dev/sda1 of=/dev/sdb1
dd if=/dev/sda2 of=/dev/sdb2
dd if=/dev/sda3 of=/dev/sdb3
dd if=/dev/sda4 of=/dev/sdb4

And if we are talking about linux system which you want to start from the second disk you'll have to clone the MBR with

Code:

dd if=/dev/sda of=/dev/sdb bs=512 count=1
This is for the third case, in first two the MBR is included

hey
sorry need to ask about :
dd if=/dev/sda of=/dev/sdb bs=512 count=1
i know this mean copy from /dev/sda to /dev/sdb
but the bs and count for what exactly use for ?

Thanks

Ipolit 08-06-2009 08:58 AM

copy portion of 512 bytes once or the first 512 bytes and nothing more

vino87 08-06-2009 11:37 PM

Thanks


All times are GMT -5. The time now is 07:53 PM.