Group: comp.os.linux.setup


Subject: varied output for df and du on the same file system
From: Unruh
Date: 12/11/2007 6:01:27 PM
bzaman <bzaman.laskar@gmail.com> writes: >Greetings, > When I run df -h /var , it displays the disk usage as > $ df -h /var/ > Filesystem Size Used Avail Use% Mounted on > /dev/sda9 4.8G 3.3G 1.3G 73% /var > But when I run the du -sh for the same file system , the result >varies . > du -sh /var/ > 3.2G /var/ > What is the reason for the difference in results ....... du adds up the lengths of the files. df reports the disk useage. a file can use more than its length since the disk memory allocated is quantized in discrete lumps ( 4K or 8 K or...depending on the size of your disk). Ie files require more disk space than their length. > With Thanks in Advance

Subject: varied output for df and du on the same file system
From: ibuprofin@painkiller.example.tld (Moe Trin)
Date: 12/11/2007 1:59:27 PM
On Tue, 11 Dec 2007, in the Usenet newsgroup comp.os.linux.setup, in article <a4303728-1469-419b-b42d-35891541fd00@e4g2000hsg.googlegroups.com>, bzaman wrote: NOTE: Posting from groups.google.com (or some web-forums) dramatically reduces the chance of your post being seen. Find a real news server. > When I run df -h /var , it displays the disk usage as > > $ df -h /var/ > > Filesystem Size Used Avail Use% Mounted on > /dev/sda9 4.8G 3.3G 1.3G 73% /var > > But when I run the du -sh for the same file system , the result >varies . > > du -sh /var/ > 3.2G /var/ > > What is the reason for the difference in results ....... 1. You are differing by one digit - that _could_ be a rounding error. Try using -k or -m to see more digits. 2. You don't mention the _type_ of file system used - you're forgetting about filesystem overhead. 3. Read the manual page ('man df' and 'man du') or info page ('info df' and 'info du') and see what the commands are trying to display. 4. 'du' counts the sum of directory entries - 'df' measures actual space in use at the moment which would include deleted (but in use) files. You are posting from a search engine - did you bother to try to look for this question? Web Results 1 - 10 of about 148,000 for "df du values differ". (0.20 seconds) Old guy