[root@localhost ~]# ls -lh bigfile
-rw-r--r-- 1 root root 200M Dec 22 14:53 bigfile
[root@localhost ~]# lsof|grep bigfile vi 23824 root 3r REG 3,2 209715200 2052534 /root/bigfile vi 23824 root 4u REG 3,2 4096 2052542 /root/.bigfile.swp At this point, both df and du would have the same output:
[root@localhost ~]# df -h / Filesystem Size Used Avail Use% Mounted on /dev/hda2 19G 8.8G 8.4G 51% /
[root@localhost ~]# du -sh / 8.8G / Now the discrepancy in output shows once bigfile is deleted:
[root@localhost ~]# rm -f bigfile
[root@localhost ~]# df -h /
Filesystem Size Used Avail Use% Mounted on /dev/hda2 19G 8.8G 8.4G 51% /
[root@localhost ~]# du -sh / 8.6G / Killing the vi process that has opened bigfile resolves the discrepancy:
[root@localhost ~]# kill 23824
[root@localhost ~]# df -h / Filesystem Size Used Avail Use% Mounted on /dev/hda2 19G 8.6G 8.6G 50% /
[root@localhost ~]# du -sh 8.6G /
No comments:
Post a Comment