Making CD/DVD images
Forum: Programming and Scripting
Topic: Making CD/DVD images
started by: Zucca
Posted by Zucca on Feb. 23 2007,17:14Am I assuming right if it's this simple:
Or as compressed:
Is any of those the right way?
Posted by mikshaw on Feb. 23 2007,20:32it's generally done either with dd or mkisofs. Using the methods you mention (with the exception of cat, perhaps?) do not properly keep the filesystem and file permissions/ownership intact, so you're essentially just making a backup of the files themselves.
"dd if=/dev/cdrom of=cdimage.iso" is probably the simplest way.
Posted by Zucca on Feb. 23 2007,21:53Ok.
So with command dd it's for sure. dd makes exact copies?
Actually 7zip would be the best to archive best compression.
< http://warp.povusers.org/ArchiverComparison >
Posted by mikshaw on Feb. 23 2007,22:38As far as I can tell you, dd makes exact copies.
I've only used it maybe 6 or 7 times in my life, but it seems to be pretty much a cloning tool
Your code sample looks like it should work as expected.
Posted by Zucca on Feb. 23 2007,23:00Some things in UNIX world just are more simple than in Windows world. =)
But on to next question:
I have my hard disk image named hd.iso.
I want to put all the data back from it to hda.
I have made the image like this:
If I do this:
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)?
Back in the days when I used Macintosh I could create CD:s with partitions more than one. So if I had 650Mb hard disk around here divided to two or more partitions and I make image of it. Then burn to CD. The CD would have those partitions? If so, how would the partitions be shown in /dev?
Posted by ^thehatsrule^ on Feb. 24 2007,00:22
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.
Posted by WDef on Feb. 24 2007,12:34Making 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.
Posted by Zucca on Feb. 24 2007,23:26I happened to stumble upon this: < http://en.wikipedia.org/wiki/Dd_%28Unix%29#Examples >
Nice examples indeed.
Posted by WDef on Feb. 25 2007,21:54You'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 >
Posted by blackeyedboy on Mar. 26 2007,20:16You 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!