PDA

View Full Version : Analyzing disk usage: inconsistent results from du, df



yang
22nd November 2006, 12:28 AM
on my /, 'df' and 'du' are reporting very different numbers:


$ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 20G 19G 171M 100% /
$ sudo du -shx /
11G /


i'd understand if there was a difference of <1GB due to many small files, but where is half my entire disk going?

i also checked if there were large open-but-deleted files, but i'm not entirely sure how to do this, since 'lsof -ns | grep DEL' doesn't actually report any file sizes:



$ lsof -ns | head -1
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
$ lsof -ns | grep DEL
bash 2583 yang DEL REG 8,2 489666 /lib/libtermcap.so.2.0.8.#prelink#.sY3pmZ
bash 2583 yang DEL REG 8,2 558470 /usr/lib/locale/locale-archive
evince 3056 yang DEL REG 0,8 793903159 /SYSV00000000
evince 3056 yang DEL REG 0,8 793870384 /SYSV00000000
evince 3056 yang DEL REG 8,2 428322 /tmp/FxZLFp
evince 3056 yang DEL REG 8,2 428321 /tmp/ADsRWz
evince 3056 yang DEL REG 8,2 428319 /tmp/giR2hK
evince 3056 yang DEL REG 8,2 428318 /tmp/2sJrIU
evince 3056 yang DEL REG 8,2 428316 /tmp/qD45c5
evince 3056 yang DEL REG 8,2 428312 /tmp/Tq0yLf
evince 3056 yang DEL REG 8,2 428300 /tmp/yKLrf5
evince 3056 yang DEL REG 8,2 428287 /tmp/C5wpxd
evince 3056 yang DEL REG 8,2 428274 /tmp/VJDq3l
evince 3056 yang DEL REG 8,2 428267 /tmp/cRgPzu
evince 3056 yang DEL REG 8,2 428266 /tmp/2ZsQ7D
evince 3056 yang DEL REG 8,2 428265 /tmp/qZA8FN
evince 3056 yang DEL REG 8,2 428261 /tmp/WvLp96
evince 3056 yang DEL REG 8,2 428258 /tmp/W7qapi
evince 3056 yang DEL REG 8,2 428255 /tmp/LkguMt
evince 3056 yang DEL REG 8,2 428253 /tmp/sgceaF
evince 3056 yang DEL REG 8,2 428252 /tmp/fcRcyQ
evince 3056 yang DEL REG 8,2 428251 /tmp/CYCPW1
evince 3056 yang DEL REG 8,2 428250 /tmp/IIy2Te
evince 3056 yang DEL REG 8,2 428249 /tmp/Y6RDRr
evince 3056 yang DEL REG 8,2 428263 /tmp/2uKGpX
evince 3056 yang DEL REG 8,2 428248 /tmp/MDlR2a
evince 3056 yang DEL REG 8,2 428246 /tmp/qFVIfU
evince 3056 yang DEL REG 8,2 428245 /tmp/SM3NAD
evince 3056 yang DEL REG 8,2 428244 /tmp/PFGs3m
evince 3056 yang DEL REG 8,2 428243 /tmp/FlfZx6
evince 3056 yang DEL REG 8,2 428236 /tmp/VbXT3P
evince 3056 yang DEL REG 8,2 428241 /tmp/Qas0Az
bash 3220 yang DEL REG 8,2 489841 /lib/libnss_files-2.4.so.#prelink#.2lcoI2
gnome-ses 4571 yang DEL REG 0,8 563019781 /SYSV00000000
metacity 4647 yang DEL REG 0,8 563380251 /SYSV00000000
metacity 4647 yang DEL REG 0,8 563314713 /SYSV00000000
metacity 4647 yang DEL REG 0,8 563281941 /SYSV00000000
gnome-pan 4653 yang DEL REG 0,8 563052554 /SYSV00000000
nautilus 4657 yang DEL REG 0,8 563150861 /SYSV00000000
nautilus 4657 yang DEL REG 0,8 563183630 /SYSV00000000
notify-da 4666 yang DEL REG 0,8 563085323 /SYSV00000000
pam-panel 4676 yang DEL REG 0,8 792723535 /SYSV00000000
wnck-appl 4689 yang DEL REG 0,8 563445797 /SYSV00000000
wnck-appl 4689 yang DEL REG 0,8 563413020 /SYSV00000000
wnck-appl 4689 yang DEL REG 0,8 563118092 /SYSV00000000
mixer_app 4705 yang DEL REG 0,8 563216399 /SYSV00000000
gnome-ter 4734 yang DEL REG 0,8 563249170 /SYSV00000000
firefox-b 4774 yang DEL REG 0,8 563478575 /SYSV00000000
firefox-b 4774 yang DEL REG 0,8 563347482 /SYSV00000000
firefox-b 4774 yang DEL REG 0,8 563544118 /SYSV00000000
bash 4993 yang DEL REG 8,2 489666 /lib/libtermcap.so.2.0.8.#prelink#.sY3pmZ
bash 4993 yang DEL REG 8,2 558470 /usr/lib/locale/locale-archive
bash 5173 yang DEL REG 8,2 489841 /lib/libnss_files-2.4.so.#prelink#.2lcoI2
artsd 5296 yang DEL REG 8,2 489841 /lib/libnss_files-2.4.so.#prelink#.2lcoI2
artsd 5296 yang DEL REG 8,2 560969 /usr/lib/libartsgslplayobject.so.0.0.0;454b24fd
artsd 5296 yang DEL REG 8,2 560985 /usr/lib/libvorbisfile.so.3.1.1.#prelink#.6WE0ky
artsd 5296 yang DEL REG 8,2 560965 /usr/lib/libartsbuilder.so.0.0.0.#prelink#.eDNW4D
artsd 5296 yang DEL REG 8,2 560996 /usr/lib/libsoundserver_idl.so.1.0.0;454b24fd
artsd 5296 yang DEL REG 8,2 559859 /usr/lib/libartsflow.so.1.0.0.#prelink#.3GMPCG
bash 7614 yang DEL REG 8,2 489666 /lib/libtermcap.so.2.0.8.#prelink#.sY3pmZ
bash 7614 yang DEL REG 8,2 558470 /usr/lib/locale/locale-archive
bash 11640 yang DEL REG 8,2 489666 /lib/libtermcap.so.2.0.8.#prelink#.sY3pmZ
bash 11640 yang DEL REG 8,2 558470 /usr/lib/locale/locale-archive
bash 12135 yang DEL REG 8,2 489666 /lib/libtermcap.so.2.0.8.#prelink#.sY3pmZ
bash 12135 yang DEL REG 8,2 558470 /usr/lib/locale/locale-archive
bash 13085 yang DEL REG 8,2 489666 /lib/libtermcap.so.2.0.8.#prelink#.sY3pmZ
bash 13085 yang DEL REG 8,2 558470 /usr/lib/locale/locale-archive
bash 13351 yang DEL REG 8,2 489666 /lib/libtermcap.so.2.0.8.#prelink#.sY3pmZ
bash 13351 yang DEL REG 8,2 558470 /usr/lib/locale/locale-archive
bash 15312 yang DEL REG 8,2 489841 /lib/libnss_files-2.4.so.#prelink#.2lcoI2
ssh 16051 yang DEL REG 8,2 489841 /lib/libnss_files-2.4.so.#prelink#.2lcoI2
bash 16059 yang DEL REG 8,2 489841 /lib/libnss_files-2.4.so.#prelink#.2lcoI2
artsd 22746 yang DEL REG 8,2 489841 /lib/libnss_files-2.4.so.#prelink#.2lcoI2
artsd 22746 yang DEL REG 8,2 560969 /usr/lib/libartsgslplayobject.so.0.0.0;454b24fd
artsd 22746 yang DEL REG 8,2 560996 /usr/lib/libsoundserver_idl.so.1.0.0;454b24fd
bash 32624 yang DEL REG 8,2 489841 /lib/libnss_files-2.4.so.#prelink#.2lcoI2

giulix
22nd November 2006, 01:11 AM
What's on /dev/sda1 ? Try removing the x from 'sudo du -shx /'

yang
22nd November 2006, 05:37 AM
if i remove the -x then the command will take forever to terminate since there are gargantuan remote file systems mounted.

i'm actually not sure how to tell what's on /dev/sda1:

$ ll /dev/sda1
brw-r----- 1 root disk 8, 1 Jun 29 11:10 /dev/sda1
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 24797412 9152664 14364772 39% /
/dev/sdb1 156171836 82062408 74109428 53% /data
/dev/shm 515508 580 514928 1% /dev/shm
paihia.lcs.mit.edu:/export/home/vladb
50395008 27344160 20490880 58% /.automount/paihia.lcs.mit.edu/export/home/vladb
nms.lcs.mit.edu:/export/home/yang
307071872 114007072 193064800 38% /.automount/nms.lcs.mit.edu/export/home/yang

yang
30th November 2006, 07:27 AM
*bump*

I re-ran the lsof as root, but it still didn't display any file sizes...

http://paste.lisp.org/display/30985