Imaging with DD

From 68kMLA Wiki
Revision as of 19:28, 13 October 2010 by ChristTrekker (talk | contribs) (cleanup)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

In most, if not all, Unices, the dd command allows for the relatively painless retrieval of raw data from a device. When used in the form of ddrescue it is also capable, to a limited extent, of salvaging data that might otherwise be lost.

In order to use a computer's in-built floppy drive, it is the author's experience that one should run dd as root or using sudo.

dd is filesystem-agnostic - that is, it will produce a raw representation of the disc. This is important to note - any problems with the integrity of the filesystem will not be seen and thus will be transferred to the image.

It is best to use dd for data recovery on the BSDs as they possess raw devices, Linux does not. If you merely wish to preserve undamaged disks before they go bad, Linux will be fine.

Imaging a Compact Disc

Note: under BSD, the device name will be /dev/cd0 whereas under Linux it will most likely be /dev/cdrom (or /dev/sr0 for the true device).

# dd if=/dev/cd0 of=AppleWorks5.iso 

If you have a HFS CD, you may want to distinguish it with a different filename extension than .iso ; .cd may be adequate.

Imaging a Floppy Disc

Note: under BSD, the device name will be /dev/fd0 - under Linux it is the same, however you may have the option of special devices like /dev/fd/fd01440 - ignore them.

# dd if=/dev/fd0 of='HyperCard Program Disk.img' bs=512  

Wasn't that simple? Note in this latter example that we use a filename with spaces in it. Most shells will handle this with the use of quotes, however some may require the use of the Unix escape (\) before each space. You may find it easier to use underscores to ensure compatibility with older shells and filesystem implementations.

Writing a DiskCopy image using dd

It is possible to write DiskCopy images to disks on machines that do not have a copy of DiskCopy using dd. To do this, we simply ignore the DiskCopy information stored in the header by overlooking the first 84 bytes.

# dd if=System50.img of=/dev/fd0 bs=21 skip=4  

Like a dd image, a DiskCopy image is a raw representation of the disk—errors present in the filesystem itself will not be flagged, nor will they be repaired.

Hopefully you'll be able to easily get faithful reproductions of your old media using these commands or similar. Of course, on most systems, man dd will be able to provide further information should you require it.