Re: Copying one hard drive to another
> the contents from one to another, I do use dd
> (dd if=/dev/hda of=/dev/hdc bs=102400), and it works
> miraculausly well:). I do suppose it will fail if the
I regularly backup win95 partitions with dd. To be more
accurate: I am not backing up the whole partition, but only
the used space. First I defragment the win95 partition, and
then check the used space. Then switch to linux and mount
the disk where the backup will be created (hda3 for example),
and then give the following command:
dd if=/dev/hda1 bs=512 count=NNN | gzip -cf >/mnt/backup.img.gz
hda1 is the partition that is being backed up,
/mnt/backup.img.gz is the ziped backup file. Now about NNN.
NNN should be the used space divided by 512 (since bs=512),
but win95 stores some special files in such a way that not
even after a defragmentation are they moved to the beginning
of the disk, but they are left just where they are. Usually
they get to be after the defragmented part of the disk. You
have to find out what is the last sector used (not the used
space). If the last sector is within lets say 800Mb then NNN
should be 800/512 (it is a good custom to add a few 10Mb-s
more, so let it be 850/512).
To restore the backup:
gzip -dcf /mnt/backup.img.gz|dd of=/dev/hda1 bs=512
The biggest trick is how to find out where is the last
sector used in the partition. For win95 it is easy, you can
(usually) see it in the program that you are using for
defragmentation. For linux... I do not know.
How can I find out what is the last sector used in a
partition in linux?