LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   find hidden disk usage (https://www.linuxquestions.org/questions/linux-software-2/find-hidden-disk-usage-829545/)

nuliknol 08-31-2010 10:37 AM

find hidden disk usage
 
Hi,
I have a productive sever (very old, 1500 days without restart or software update, gentoo distro) and i have a weird disk usage there:
Code:

gentoo / # du -sk *|sort -n
0      sys
2      service
6      mnt
16      lost+found
724    dev
6270    sbin
6714    bin
6980    etc
10266  boot-before-change-kernel
10338  boot
29734  lib
85372  tmp
102740  opt
125552  ram0
922507  proc
965076  root
2914551 media
5421810 home
8393788 var
14351916        usr
gentoo / # du -skc
du: `./media/Gentoo/proc/4976': No such file or directory
du: `./media/Gentoo/proc/4984': No such file or directory
33380291        .
33380291        total
gentoo / # df
Filesystem          1K-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p1    67463492  61372500  2663794  96% /
udev                  1037576      724  1036852  1% /dev
shm                    1037576        0  1037576  0% /dev/shm
/dev/ram0              130612    125552      5060  97% /ram0
gentoo / #

You see that on 'df' i have 67 GB on the disk and 2.6GB avaiable, but du is confirming only 33GB of usage. What uses the other 34GB ?
I can't install fancy graphical disk usage programs there, is there any way I can find what is consuming the 34GB of disk using command line tools and standard linux programs? (like debugfs or something like that)

Thanks in advance

suprstar 08-31-2010 11:11 AM

They measure 2 different things. du only measures the space used by files and folders. df measures space used by the entire filesystem, including journaling, inode tables, etc.

Guttorm 08-31-2010 11:47 AM

Hi

Could also be programs writing to files that has been deleted. You don't see them with du, but they still take space.

To see them:

lsof |grep '(deleted)'

Restarting those program should free up some space.

dazdaz 08-31-2010 02:34 PM

Does that work on both Solaris and Linux ?

nuliknol 09-01-2010 07:29 AM

Quote:

Originally Posted by Guttorm (Post 4083747)
Hi

To see them:

lsof |grep '(deleted)'

Restarting those program should free up some space.

wow , you rock! I found a 30GB qmail log file! how can it be that large? I thought the limit was 2GB.

Code:

qmail-sen 14201 qmails    0w      REG      104,1 30655949063    921647 /var/qmail/queue/nohup.out (deleted)
mysqld_sa 23489  root    1u      CHR      136,5                      7 /dev/pts/5 (deleted)
mysqld_sa 23489  root    2u      CHR      136,5                      7 /dev/pts/5 (deleted)

haven't restarted qmail in 5 years. Now I did it and I have got 'extra' space, thanks a lot!
Code:

gentoo ~ # df
Filesystem          1K-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p1    67463492  31330160  32706134  49% /
udev                  1037576      724  1036852  1% /dev
shm                    1037576        0  1037576  0% /dev/shm
/dev/ram0              130612    125454      5158  97% /ram0
gentoo ~ #


hxcan 09-01-2010 08:03 AM

Amazing
 
That's wonderful .

justflea 08-30-2013 09:24 AM

Thank you very much man!
 
This save my life and I learn something in the process.

I found a 6gb (deleted) file with this lsof trick.


Quote:

Originally Posted by Guttorm (Post 4083747)
Hi

Could also be programs writing to files that has been deleted. You don't see them with du, but they still take space.

To see them:

lsof |grep '(deleted)'

Restarting those program should free up some space.



All times are GMT -5. The time now is 12:36 AM.