cp /dev/hda3 /dev/hdb3

smurf_www at xs4all.nl smurf_www at xs4all.nl
Mon Oct 11 03:28:39 UTC 2004


I needed to backup a partition on a faulty harddrive (well it only runs
with some tricks) on a new hd that I bought. Both partitions (hda3 and
hdb3) are +/-20GB however the first one was not full. Also hda3 is a ntfs
partition and hdb3 is ext2.

So I issued the command that I found on usenet and prefered it over dd or
tar. I did a test run on the command and after a few seconds I interupted
it. I checked hdb3 and it had already the directory layout of hda3. So it
looked promising.

Before I was ready to run the cp command I deleted the hdb3 partition and
recreated at 20GB. I was not sure how the cp command works on devices so
like using dd I made the target partition almost the same size as the
source.

Now after a reboot I ran again cp /dev/hda3 /dev/hdb3 and after an hour I
checked. In the shell window the command was done. So I looked at the
partitions but hdb3 was empty. Then I looked at hdba3 and it had now the
same structure as hbb3. So the copy command coppied the files from hdb3 to
hdba. How come?

Now I was looking for how to restore my ntfs partition but didn't find any
solution. For I don't know why I did an fdisk -l and fdisk tells me that
hda3 is still a ntfs partition. Thank god, there must be hope to restore
it I think.
(/dev/hda3            2456        4983    20306160    7  HPFS/NTFS
)

So my questions are:

A)Why did cp /dev/hda3 /dev/hdb3 mess up hda3
B)How do I fix the partition table or what ever so that linux knows its an
ntfs partition?

Thanks in advance




More information about the ubuntu-users mailing list