Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-20-2009, 03:47 PM
|
#1
|
LQ Newbie
Registered: Apr 2009
Posts: 2
Rep:
|
checking disk space
I am trying to figure out why my disk space usage is so high. I recently was having issues because the disk space usage hit 100%, so I reverted to an old backup to get things running and to investigate (the backup image was from about 24 hours before), I have a VPS server, running centos 5.x.
Anyways here are a couple ssh commands I ran..
Code:
[root@ses01 /]# cd /
[root@ses01 /]# du -sh
1.6G .
[root@ses01 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.4G 8.8G 148M 99% /
none 129M 0 129M 0% /dev/shm
I changed to the / directory, and running du -sh (which I read in another post here should get me the disk space usage of THAT directory), but using the command I am more accustomed to (df -h) it says I'm using 8.8 gb, and it is all on the /dev/sda1 filesystem.
Is there something that du can't pick up that df can? Is there a good utility to use to find the source of my disk usage problems? I am beginning to expect that my server has been compromised, but the only evidence I have to support that is how my disk usage seems to have sky rocketed out of nowhere.
thanks for your help.
|
|
|
04-20-2009, 03:59 PM
|
#2
|
Senior Member
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109
Rep:
|
Hi.
Yup, files which have been rm'ed (unlinked), but which are still open won't show up in 'du' totals, but will be counted in 'df'.
Try 'lsof | grep deleted' as root to see if there are any open, unlinked files.
Dave
|
|
|
04-20-2009, 04:41 PM
|
#3
|
LQ Newbie
Registered: Apr 2009
Posts: 2
Original Poster
Rep:
|
Code:
~]# lsof | grep deleted
mysqld 4035 mysql 4u REG 8,1 0 1229633 /tmp/ibORtCyo (deleted)
mysqld 4035 mysql 5u REG 8,1 0 1229634 /tmp/ibKkjYff (deleted)
mysqld 4035 mysql 6u REG 8,1 0 1229635 /tmp/ibIYpkX5 (deleted)
mysqld 4035 mysql 7u REG 8,1 0 1229636 /tmp/ib3uDCHW (deleted)
mysqld 4035 mysql 11u REG 8,1 0 1229637 /tmp/ibZlRLIO (deleted)
I installed lsof using yum and ran the command you wrote, and this is the output. I tried using the -s parameter to show the file sizes, but the output is the same. They look like they are mysql records that didn't get deleted for whatever reason, so I woulnd't expect for them to be large.
|
|
|
04-20-2009, 05:32 PM
|
#4
|
Senior Member
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109
Rep:
|
Hmmm. That's a bit disappointing - the files listed are pretty small (column 8 is the file size in bytes, if memory serves).
Do you have a lot (thousands? millions?) of small files? Depending on the filesystem, a smaller-than-block-size file will take up a full block, giving a discrepancy between df and du.
Alternatively, it could be something weird going on with the virtualisation - maybe the hypervisor is lying about the disk image size?
If nothing springs to mind, and you can afford the downtime, it might be worth running an fsck on your disk.
Dave
Last edited by ilikejam; 04-20-2009 at 05:33 PM.
|
|
|
04-20-2009, 05:59 PM
|
#5
|
Member
Registered: Sep 2004
Location: Old York, North Yorks.
Distribution: Debian 7 (mainly)
Posts: 653
Rep:
|
Another thing to try would be debugfs (assuming the filesystem is ext2/3). I don't believe df shows the whole story. For instance, one of my partitions is shown as:
Code:
/dev/sda6 7.9G 7.0G 476M 94% /home/rob/Music
... but 7.0 / 7.9 is more like 89%, so where's the remaining space? Running sudo debugfs /dev/sda6 and then executing the stats command, shows (among other things):
Code:
Block count: 2070369
Reserved block count: 103518
Free blocks: 225202
So the Free block count equates with 89% usage (roughly), but the Reserved block count is about 5% of the Block count (which would make up the difference). Running debugfs's ffb (find_free_blocks) command gives a free block count of 124815, which is around 6% free / 94% usage.
A little confusing, but seems that free block counts are a little like unemployment statistics - it depends how you count them.
From man mke2fs
Code:
-m reserved-blocks-percentage
Specify the percentage of the filesystem blocks reserved for
the super-user. This avoids fragmentation, and allows root-
owned daemons, such as syslogd(8), to continue to function
correctly after non-privileged processes are prevented from
writing to the filesystem. The default percentage is 5%.
Rob
Last edited by Robhogg; 04-20-2009 at 06:02 PM.
|
|
|
04-21-2009, 03:20 PM
|
#6
|
Member
Registered: Nov 2008
Location: USA
Distribution: Arch 64-bit
Posts: 159
Rep:
|
You could always try a program like Filelight or Baobab to find where all your space is being eaten up on a drive. They make very easy-to-read, interactive graphical charts to display disk usage.
|
|
|
All times are GMT -5. The time now is 02:42 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|