Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian User (http://www.linux-archive.org/debian-user/)
-   -   df and du don't seem to agree ? (http://www.linux-archive.org/debian-user/696361-df-du-dont-seem-agree.html)

Camaleón 08-21-2012 03:32 PM

df and du don't seem to agree ?
 
On Tue, 21 Aug 2012 16:45:35 +0200, David Cho-Lerat wrote:

> this might be a newbie question, but can anyone tell me why "du" and
> "df" don't seem to agree :
>
> server:~# df -h /var
> Filesystem Size Used Avail Use% Mounted on
> /dev/mapper/vg00-var 5.0G 4.1G 624M 87% /var
> server:~# du -h -s /var
> 1.6G /var
>
> ("/var" is on a partition of its own.)
>
> "du" says 1.6G are used, while "df" reports 4.1G. Any idea why ?
>
> I know some amount of space is supposed to be "reserved for the
> super-user", but that's typically around 5%, right ?

Right.

Google returns:

http://superuser.com/questions/289678/du-vs-df-output

> By the way, is there a command to see how big this reserved space
> actually is on a given partition/disk ?

With a simple math calculation ;-P

5% of 5 GiB are ~256 MiB of reserved space.

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/k109ml$agf$11@ger.gmane.org

Denis Witt 08-21-2012 04:14 PM

df and du don't seem to agree ?
 
Hi David,


By the way, is there a command to see how big this reserved space
actually is on a given partition/disk ?


tune2fs -l /dev/md0 | grep "Reserved block count"

Replace /dev/md0 with the device you want to check.

Bye.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 5033B3F6.70001@concepts-and-training.de">http://lists.debian.org/5033B3F6.70001@concepts-and-training.de

Denis Witt 08-21-2012 04:17 PM

df and du don't seem to agree ?
 
On 21.08.2012 18:14, Denis Witt wrote:


By the way, is there a command to see how big this reserved space
actually is on a given partition/disk ?



tune2fs -l /dev/md0 | grep "Reserved block count"


Sorry, I forgot to mention that the result will be in Blocks. You can
get the block size (in Bytes) with:


tune2fs -l /dev/md0 | grep "Block size"

Bye.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 5033B489.3000107@concepts-and-training.de">http://lists.debian.org/5033B489.3000107@concepts-and-training.de

David Cho-Lerat 08-22-2012 08:13 AM

df and du don't seem to agree ?
 
Google returns:

http://superuser.com/questions/289678/du-vs-df-output


oops, should have had a look :P

this pointed me to :

server:~# lsof | grep "/var" | grep "deleted"
smbd 2926 root 2w REG 254,1 2665
65406 /var/log/samba/log.smbd.1 (deleted)
smbd 2926 root 6w REG 254,1 2665
65406 /var/log/samba/log.smbd.1 (deleted)
proftpd 14060 nobody 7w REG 254,1 2807896675
49066 /var/log/proftpd/proftpd-trace.log (deleted)
pbms-pbhi9:~# ls -Falh /var/log/samba/log.smbd.1
/var/log/proftpd/proftpd-trace.log

ls: cannot access /var/log/samba/log.smbd.1: No such file or directory
ls: cannot access /var/log/proftpd/proftpd-trace.log: No such file or
directory


Yes ! Looks like they just need to restart the ProFTPD and Samba
services to free up around 2.7G !


Thanks all, this was very helpful !

David.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 503494A1.2020408@asterion.fr">http://lists.debian.org/503494A1.2020408@asterion.fr

David Cho-Lerat 08-22-2012 08:17 AM

df and du don't seem to agree ?
 
tune2fs -l /dev/md0 | grep "Reserved block count"


Sorry, I forgot to mention that the result will be in Blocks. You can
get the block size (in Bytes) with:


tune2fs -l /dev/md0 | grep "Block size"

Bye.


cool. So :

server:~# tune2fs -l /dev/mapper/vg00-var | grep "Reserved block count"
Reserved block count: 65471
server:~# tune2fs -l /dev/mapper/vg00-var | grep "Block size"
Block size: 4096

So I guess there's around 255M of reserved space.

Thanks !


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 50349585.6000301@asterion.fr">http://lists.debian.org/50349585.6000301@asterion.fr

Bob Proulx 08-22-2012 08:22 AM

df and du don't seem to agree ?
 
David Cho-Lerat wrote:
> >Google returns:
> >http://superuser.com/questions/289678/du-vs-df-output

I will also mention the GNU faq entry for it. Perhaps then it will
rank higher in the search engine space. :-)

http://www.gnu.org/software/coreutils/faq/#df-and-du-report-different-information

> smbd 2926 root 2w REG 254,1 2665
> 65406 /var/log/samba/log.smbd.1 (deleted)
> smbd 2926 root 6w REG 254,1 2665
> 65406 /var/log/samba/log.smbd.1 (deleted)
> proftpd 14060 nobody 7w REG 254,1 2807896675
> 49066 /var/log/proftpd/proftpd-trace.log (deleted)
> ...
> Yes ! Looks like they just need to restart the ProFTPD and Samba
> services to free up around 2.7G !

When I want to free up disk space used in a log file instead of
removing the file, which creates the above situation of large files
that no longer have a directory entry, instead of removing the file I
truncate it.

$ : > somelargefile

By truncating the file it is immediately reduced and the disk blocks
freed. The file isn't removed and therefore won't be lost from the
filesystem where du can't find it anymore. Any daemon that is still
writing to the file will still keep its file handle to it and will
continue to write to the file.

Bob

David Cho-Lerat 08-22-2012 08:30 AM

df and du don't seem to agree ?
 
I will also mention the GNU faq entry for it. Perhaps then it will
rank higher in the search engine space. :-)

http://www.gnu.org/software/coreutils/faq/#df-and-du-report-different-information



thanks, I will send this link to the sysadmin.

When I want to free up disk space used in a log file instead of
removing the file, which creates the above situation of large files
that no longer have a directory entry, instead of removing the file I
truncate it.

$ :> somelargefile

By truncating the file it is immediately reduced and the disk blocks
freed. The file isn't removed and therefore won't be lost from the
filesystem where du can't find it anymore. Any daemon that is still
writing to the file will still keep its file handle to it and will
continue to write to the file.

Bob



nice trick, they probably should have done that instead ;) Will keep
that in mind.

Thanks,
David.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 503498A6.6030306@asterion.fr">http://lists.debian.org/503498A6.6030306@asterion.fr

David Cho-Lerat 08-22-2012 08:51 AM

df and du don't seem to agree ?
 
a restart of the ProFTPD daemon reduced the amount of used space
on /var from 90% to 34%. Phew ! Thanks all for your help, this is
one command I'll definitely use again :

lsof | grep "deleted"



Le 22/08/2012 10:13, David Cho-Lerat a écrit :



Google returns:

http://superuser.com/questions/289678/du-vs-df-output


oops, should have had a look :P

this pointed me to :

server:~# lsof | grep "/var" | grep "deleted"
smbd 2926 root 2w REG 254,1 2665
65406 /var/log/samba/log.smbd.1 (deleted)
smbd 2926 root 6w REG 254,1 2665
65406 /var/log/samba/log.smbd.1 (deleted)
proftpd 14060 nobody 7w REG 254,1 2807896675
49066 /var/log/proftpd/proftpd-trace.log (deleted)
pbms-pbhi9:~# ls -Falh /var/log/samba/log.smbd.1
/var/log/proftpd/proftpd-trace.log

ls: cannot access /var/log/samba/log.smbd.1: No such file or directory
ls: cannot access /var/log/proftpd/proftpd-trace.log: No such file or
directory


Yes ! Looks like they just need to restart the ProFTPD and Samba
services to free up around 2.7G !


Thanks all, this was very helpful !

David.




--
David Cho-Lerat
Mobile : +33 623 057 174


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 50349D80.7070907@asterion.fr">http://lists.debian.org/50349D80.7070907@asterion.fr


All times are GMT. The time now is 04:51 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.