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

Re: df and du disagree, or "How to get 1.1GB of data onto a 650MB CD"



On Fri, 22 Sep 2006 09:14:37 +0100, re2823 wrote:

> I have a strange problem: I have an iso image file which (according to ls)
> is 569M in size:
> 
> ...
> 
> Now for the problem...
> The relevant line from "df -h":
> poota:~# df -h
> Filesystem            Size  Used Avail Use% Mounted on /root/image.iso    
>   569M  569M     0 100% /root/temp
> 
> And the result from running "du -sh": poota:~# du -sh temp/
> 1.1G    temp/
> 
> Just to really baffle me, I've burnt this iso image onto a 650MB CD-ROM,
> mounted it, and it too has 1.1GB of data on it:
> 
> poota:~# du -sh /media/cdrom0
> 1.1G    /media/cdrom0
> 
> But the "df -h" output seems more reasonable: server:~# df -h
> Filesystem            Size  Used Avail Use% Mounted on /dev/hdd           
>   569M  569M     0 100% /media/cdrom0
> 
> Could anyone please tell me how there can be such a huge difference
> between the output from df and du?

Are you using some kind Live CD? This is actually quite normal for Live
CDs.

> My real problem comes when I want to remove one small file from the file
> system, and turn it back into an iso - the resulting iso image is 1.1GB
> (and I can no longer write it to a CD!)

It maybe helpful if you had indicated what CD you are using. They must
be using some kind of compression. So, 

df count on file size reported by OS (HD/CD sectors), while du count on
file sizes reported by themselves (byte count), thus, df reports
compressed file sizes while du reports uncompressed file sizes. 

Check out the mkisofs -z option, for example.

,-----
|  -z     Generate  special  RRIP  records  for  transparently  compressed
|         files.  This is only of use and interest for hosts that  support
|         transparent  decompression,  such as Linux 2.4.14 or later.  You
|         must specify the -R or -r options to enable RockRidge, and  gen-
|         erate compressed files using the mkzftree utility before running
|         mkisofs.  Note that transparent  compression  is  a  nonstandard
|         Rock  Ridge  extension.   The resulting disks are only transpar-
|         ently readable if used on Linux.  On other operating systems you
|         will need to call mkzftree by hand to decompress the files.
`-----

Most Live CDs use other kind of compression, eg, squashfs.


HTH

tong





Reply to: