Disk images with dd

Gary W. Swearingen garys at opusnet.com
Wed Apr 12 19:18:04 UTC 2006


Daniel Carrera <daniel.carrera at zmsl.com> writes:

> Hello all,
>
> Alright, I've made an OEM installation I'm happy with. The next step is to make a disk image, and figure out how to
> apply it to other disks.

Can't help much with that, but...

> 1) Make a disk image:
> This is the easy part.
>
> dd if=/dev/hda1 | gzip -c > ubuntu_oem.img.gz

The "dd" default, IIRC, is to copy 512 byte blocks, and I've seen
considerably faster speeds by using a "bs" of the size of a disk
cylinder or track (usually 16*63*512, these days).  This also avoids
worry about a missing partial block at the end, which I've seen,
though not recently.

(BTW, I see kubuntu installs without support for "info dd".  Grrr.)

You might like gzip's "--fast" for this usage.

> 2) Put the image into another hard disk.
> This is the hard part.
>
> gzip -c -d < ubuntu_oem.img.gz | dd of=/dev/hdb1
>
> Questions:
> * What if the partition hdb1 is not identical to hda1?

Depends.  You might get something workable, failure, or disaster.

> * I still need to make the swap by hand with fdisk, right?

Unsure of the question.  MBR must reflect partition size and type, of
course.  And you need to consider the low-level boot code like grub or
lilo.  You can put it (lilo, at least) on the partition and use the
default MBR boot loader to boot the partition (though you might have
1024 cylinder-limit problems) or install it to the hdb disk (grub goes
in MBR, some of first track, some of the partition, IIRC) so it will
boot the OS directly.  You have to configure it to work when installed
as hda, of course.

> * What about the MBR in hdb? (remember, hdb is destined for another computer).

As long as you're not using it's boot code now (your OS is on hda),
you can mess with hdb's MBR, etc., in preparation for its use as hda.




More information about the ubuntu-users mailing list