Mailinglist Archive: opensuse (4053 mails)

< Previous Next >
Re: [SLE] How to make exact HD copy in Linux
  • From: Alexandr Malusek <Alexandr.Malusek@xxxxxxxxxx>
  • Date: 08 Aug 2001 00:27:55 +0200
  • Message-id: <86r8unjyj8.fsf@xxxxxxxxxxxxxxxxxxxxx>
Juergen Braukmann <juergen.braukmann@xxxxxxxxxxxx> writes:

> Steven Hatfield wrote:
> >
> > dd if=/dev/hda of=/dev/hdb
> >
> > where /dev/hda is the drive to be backed up (the input file) and
> > /dev/hdb is the drive to get the copy (the output file).
> >
>
> Will this also work with a different HD geometry?

IMHO, it works for Linux since Linux doesn't use C/H/S addressing but
I'm not sure about DOS:

<man fdisk>
In a DOS type partition table the starting offset and the
size of each partition is stored in two ways: as an abso­
lute number of sectors (given in 32 bits) and as a Cylin­
ders/Heads/Sectors triple (given in 10+8+6 bits). The for­
mer is OK - with 512-byte sectors this will work up to 2
TB. The latter has two different problems. First of all,
these C/H/S fields can be filled only when the number of
heads and the number of sectors per track are known. Sec­
ondly, even if we know what these numbers should be, the
24 bits that are available do not suffice. DOS uses C/H/S
only, Windows uses both, Linux never uses C/H/S.
</man fdisk>

If the target disk has a different capacity then partition sizes
should be changed e.g. via GNU Parted. A slightly more kosher way is
to copy partitions separately, e.g.:

# dd if=/dev/hda1 of=/dev/hdb1

In this case, the partition table on hdb is preserved.

> I'd preffer the tar option, or "cp -ax / /mnt"

I sometimes use dd to copy partitions but for beginners who lack basic
background knowledge about partition tables the "dd" method is a bit
dangerous.

"cp -ax" is easy to use but I had some problems with it in the past.
(It just hanged when copying a named pipe or something like that). It
is probably OK nowadays.

--
Alexandr.Malusek@xxxxxxxxxx




< Previous Next >