Bill Jonas on Sat, 23 Mar 2002 13:37:27 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Linux Bootable CD


On Sat, Mar 23, 2002 at 11:25:09AM -0500, Doug Crompton wrote:
> I guess I misunderstood. I thought that someone had said that dd from a
> device would copy the entire device image without regard to what was on
> the device. I stand corrected.

It does.

> So dd works from a directory like cat or cp? If the medium were fragmented
> it would not copy blank space? Sounds like a good way to defrag!

No, it copies blank space.

The fundamental difference between hard drives and CD-ROM drives is that
hard drives *can have blank space*.  CD-ROM discs don't.

With a CD, there's no empty space on the disc.  There are *unburned* (or
unpressed) areas of the disc, but there's no blank space *in the
filesystem*.  This is the important difference.

When you burn a CD, the disc gets "fixated".  If you're reading the
image off the disc (with your tool of choice), the kernel device driver
returns EOF when it hits this point.

When you read a floppy or hard disk device, the blank space is *in the
filesystem*, so it gets read along with the data.

If you want to defrag your disk, you need to do the following (assuming
you don't have a defragmentation tool handy): "tar -cpf
/some/place/safe/file.tar /path/to/filesystem && umount
/path/to/filesystem && mke2fs /dev/$DEVICE && mount /dev/$DEVICE
/path/to/filesystem && cd / && tar -xpf /some/place/safe/file.tar".
That's how you'd go about reading just the data and not the empty space
in the filesystem.  An ISO9660 filesystem, on the other hand, has no
provision for storing blank space since it's not needed (write-once,
write-only medium and all that); there may be an unused portion of the
disc, but there's no empty space in the filesystem.

Clearer?

-- 
Bill Jonas    *    bill@billjonas.com    *    http://www.billjonas.com/

Developer/SysAdmin for hire!   See http://www.billjonas.com/resume.html

Attachment: pgpsomA9M21xg.pgp
Description: PGP signature