Programming and Scripting :: Making CD/DVD images



Quote
hd.iso
I think the standard is .img for hd images?

Quote
I belive it writes all the data back to it (boot sector, partition table, contents, etc...)?
Maybe, but I think using 'dd' again will be a better idea (switch the if and of parameters) which will do so.

Quote
But if I create image from a partition (for example /dev/hda1) it includes only the contents of that partition (excluding partition info, bootsector; but including file permissions)?
Yes.

You can, however, avoid the use of doing all of hda (since that's usually Huge) by using the partition method - and still have the mbr by using bs=512 (and count=1 i think) parameter to dd (not too sure of this number... don't remember exactly - might depend on your device setup)

I have only done 'real' testing using usb storage devices though.

Not sure about your question about CD's though.  I have used multi-track sessions on them, but do not know if they are the same as regular hd partitions.  Hybrid Audio/Data CD's are an example afaik.

Making an image of an existing cd is *almost* as simple as pointing dd at /dev/cdrom - but not quite!

You can get a coaster if exactly the right number of blocks are not read, or if the last block is not read properly.  Happens.

For eg: if the cd has a logical block size of 2048, and the volume size is 329989, then there are 329989 blocks on the cd each of which is 2048 bytes. So:

dd if=/dev/cdrom of=cdimage.img bs=2048 count=329989

will exactly copy all the blocks, and it will be fine.

Unfortunately dsl doesn't seem to have the utility isoinfo, which will give you these numbers.   These are no doubt available some other way though.

I happened to stumble upon this: http://en.wikipedia.org/wiki/Dd_%28Unix%29#Examples
Nice examples indeed.

You'll find plenty of examples where they don't set the block size or count for copying cds, and that can work.  But it's sloppy, making the assumption that dd's default block size works with that of the media, and it can fail.  Set the block size and count to be sure.

From the little reference library on my hd, see:

http://www.troubleshooters.com/linux/coasterless.htm

You can read this post which will give you all modern use of the dd command : disk/floppy/cd images with/without compression and some other nice things.

It's cool and very complete. Besides, its author does answer to  nearly every message you post there!

Next Page...
original here.