-   Linux - Software (
-   -   How to create a floppy image under 1440k w/ dd (

jgombos 11-07-2006 09:05 AM

How to create a floppy image under 1440k w/ dd
I've found a floppy image that is only 110592 bytes in size (SBM), and was wondering how that could have been made with dd, considering dd reads every bit literally. Or if it was not made with dd, what tool might have made it?

pixellany 11-07-2006 09:31 AM

dd is in fact literal--it will copy exactly the number of bytes you tell it.

For example, to put your image file on a floppy:

dd if=filename of=/dev/fd0 bs=110592 count=1

Or, if you prefer:
dd if=filename of=/dev/fd0 bs=27648 count=4

dd if=filename of=/dev/fd0
(With no parameters specified, dd just goes to the end of file)

jgombos 11-07-2006 10:21 AM

Imaging only the useful content
Ah, so the trick is knowing where the content ends. Here's the reason I'm digging into this:

I often image bootable partitions for backup purposes using dd. Rather than use a commercial tool that knows what to ignore for a given filesystem type, I'm trying to find ways to do this the GNU way without wasting too much space.

One way is to use dd to pad all the empty space with zeros (ie. dd if=/dev/zero of=/mnt/target_drive/zero.pad), so that after the drive is imaged, it compresses nicely.

Another way might be to use a defragmentation tool to pack all the data to the front of the partition, then specify a size to dd that includes the last bit of meaningful content while excluding the trailing empty space. How would I know what size to specify?

Are there any filesystems that necessarily have meaningful content at the end of a partition?

The second approach is superior because compression may not be necessary, and the restore partition can be smaller.

All times are GMT -5. The time now is 01:34 PM.