C O N O S C E N Z A
web data management
Il nostro è un team che si occupa ormai da piu' di un decennio della risoluzione delle problematiche informatiche, in particolare ci piace poter offrire la nostra competenza in ambito telematico, dalla progettazione su misura della vostra infrastruttura web, alla realizzazione del vostro software e dei vostri portali.
Could DF have a different value than DU?

server

Could DF have a different value than DU?

02/12/2011
df = disk free
du = disk usage

On linux this two commands are used to show the disk space.

Since some days ago my server had the /root partion quite full, I looked around in it but I couldn't find the really big directory with anomaly files to purge. Usually I use du to determine the space in the single directory and df only for the total hds space.

Today I noted about 3gb of difference between the two methods.

I understood, finding two good posts on the internet that this could be happen due a deletion of files still in use by some applications.

For example, I've a big log file and I decide to delete it brutally without restarting the log processor application.

The file appears deleted, you can't see it anymore in the file system, du doesn't calculate it, but in effect it still persists on our hard disk

The next command will show all the files marked as deleted

lsof | grep "deleted"


as noted in the attached screen-shots I had a couple of very big log files that I thought were already deleted.

Using the next command I'll see the pid of each process that still uses those files.


lsof | grep "deleted" | awk '{print $2}'


Restart the process and you'll see your 'lost space' again :)

That's All



DU - DF [usage notes]


[root@machine var]# du -sh
4.3G /var

[root@machine ~]# df -h
File system Dim. Usati Disp. Uso% Montato su
/dev/sda2 92G 4,3G 83G 5% /


Could DF have a different value than DU? Could DF have a different value than DU? Could DF have a different value than DU? Could DF have a different value than DU?