![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Can anyone think of a scenario in which size reported by ls -l is less than the size reported by du.
The other way round is possible, if the file has holes, ls -l will report a size more than du (since du calculates the actual disk usage) But I cannot understand why du reports a size more than ls -l. For e.g: % ls -l file12MB.pdf -rw-r--r-- 1 vqwe 11650342 Apr 19 16:34 file12MB.pdf % du -k file12MB.pdf 11404 file12MB.pdf du shows file size is 11404 Kb. ls shows file size is 11650342 bytes = 11377.2 Kb How is this possible ? Is it that du counts the space occupied by Indirect blocks as well ??? awaiting your response ![]() |
|
|||||
|
Quote:
Btw, your second case is often called "sparse files". |
|
||||
|
I have an even more interesting case of ls disagreeing with du:
Code:
[server1-/var/crash]# ls -lh 10.1.1.100-2009-01-05-14:01 total 1018M -rw------- 1 netdump netdump 332K Jan 5 14:56 log -rw------- 1 netdump netdump 16G Jan 5 14:52 vmcore [server1-/var/crash]# du -h 10.1.1.100-2009-01-05-14:01/* 336K 10.1.1.100-2009-01-05-14:01/log 1017M 10.1.1.100-2009-01-05-14:01/vmcore So it basically looks like I have a 16GB file that only occupied about 1GB of disk space. Is vmcore a so-called "sparse file"? I've only seen something similar once before, those were vmlog files created by vmware ESX host on an NFS mount (du would report 0 but ls would show a 1GB file). |
| Sponsored Links | ||
|
|