0

I'm trying to figure out (1) how much actual space is in use on my server and (2) what will happen if I use more of it. I originally posted a version of this question on ServerFault, but they kicked me over here.

Background: I am running a server that uses virtfs (thanks to cPanel), and seeing very high disk usage compared to the amount of data actually uploaded/created by each user. I am getting warning emails telling my that I am using nearly all of my available space.

The following is the output of df -h /:

Filesystem      Size  Used Avail Use% Mounted on
/dev/simfs       30G   25G  5.9G  81% /

I ran du -h / | grep "[0-9][MG]" | sort -n -r to generate a list of the paths using the most space. This was the output:

68G    /
44G    /home
43G    /home/virtfs
11G    /home/virtfs/john
11G    /home/virtfs/paul
11G    /home/virtfs/george
11G    /home/virtfs/ringo
11G    /backup
5.3G   /usr
5.3G   /home/virtfs/john/usr
5.3G   /home/virtfs/paul/usr
5.3G   /home/virtfs/george/usr
5.3G   /home/virtfs/ringo/usr
5.2G   /var
5.2G   /home/virtfs/john/var
5.2G   /home/virtfs/paul/var
5.2G   /home/virtfs/george/var
5.2G   /home/virtfs/ringo/var
4.6G   /var/lib
4.6G   /home/virtfs/john/var/lib
4.6G   /home/virtfs/paul/var/lib
4.6G   /home/virtfs/george/var/lib
4.6G   /home/virtfs/ringo/var/lib
4.3G   /home/virtfs/paul/usr/local
4.2G   /usr/local
4.2G   /home/virtfs/john/usr/local
4.2G   /home/virtfs/george/usr/local
4.2G   /home/virtfs/ringo/usr/local
3.8G   /usr/local/cpanel
3.8G   /home/virtfs/john/usr/local/cpanel
3.8G   /home/virtfs/paul/usr/local/cpanel
3.8G   /home/virtfs/george/usr/local/cpanel
3.8G   /home/virtfs/ringo/usr/local/cpanel
3.0G   /var/lib/mysql.orig
3.0G   /home/virtfs/john/var/lib/mysql.orig
3.0G   /home/virtfs/paul/var/lib/mysql.orig
3.0G   /home/virtfs/george/var/lib/mysql.orig
3.0G   /home/virtfs/ringo/var/lib/mysql.orig
2.6G   /backup/weekly
2.2G   /backup/cpbackup
2.1G   /var/lib/mysql.orig/ringo_demo
2.1G   /home/virtfs/john/var/lib/mysql.orig/ringo_demo
2.1G   /home/virtfs/paul/var/lib/mysql.orig/ringo_demo
2.1G   /home/virtfs/george/var/lib/mysql.orig/ringo_demo
2.1G   /home/virtfs/ringo/var/lib/mysql.orig/ringo_demo
1.9G   /cpanel_backups
1.7G   /backup/monthly
1.6G   /var/lib/mysql
1.6G   /home/virtfs/john/var/lib/mysql
1.6G   /home/virtfs/paul/var/lib/mysql
1.6G   /home/virtfs/george/var/lib/mysql
1.6G   /home/virtfs/ringo/var/lib/mysql
1.2G   /usr/local/cpanel/bin
1.2G   /home/virtfs/john/usr/local/cpanel/bin
1.2G   /home/virtfs/paul/usr/local/cpanel/bin
1.2G   /home/virtfs/george/usr/local/cpanel/bin
1.2G   /home/virtfs/ringo/usr/local/cpanel/bin
1.1G   /root

(No, my users aren't actually all named for the Beatles...) It looks like nearly all of the disk usage is due to the virtfs redundancy, such as redundant references to system files like /usr/local/cpanel/....

None of my users is actually using as much space as reported. For example, none of them alone uses the full 1.6 GB reported above for /var/lib/mysql. And when I look at cPanel's own reports in the web interface, I see that the disk usage for these accounts ranges from essentially zero to no more than 237 MB: nowhere near the 11 GB reported.

So, my questions:

  1. How can I determine how much space is actually being used?
  2. What happens if I add another, say, 10 GB of data to the server? Will it have some sort of meltdown because df will think I'm using 35 out of 30 GB? Or will everything work just fine because I'm still using less than 30 GB?

Please note: this question is not about cPanel; it's about virtfs and what tools I can use to determine my available disk space.

0

It is possible that the space consumed by VirtFS is due to orphaned VirtFS mounts.

You can use the following command to unmount any bind-mounted directories:

for i in `cat /proc/mounts | awk '/virtfs/ {print $2}'`; do umount $i;done

Or, since you are using cPanel, you can use their script for doing this:

/scripts/clear_orphaned_virtfs_mounts --clearall

Try a df -h after this.

It might be worth your time to read more about cPanel's implementation of VirtFS and Jailed Shell here.

As for your second question, if you add more space it should not automatically be mounted to VirtFS, so you should be fine.

  • Thanks for your answer, but I have already tried this (using the cPanel script), and there are no orphaned mounts to clear up. I get the same usage as before with df -h. I have also read the information at the link you shared, but it doesn't have anything to say about my questions. Also, I'm not using jailed shells; shell access is disabled for all users. Regarding the second question: what do you mean by "add more space?" I'm talking about what happens when I use more of my existing storage (i.e., under existing accounts), not about adding new storage. – Ed Cottrell Sep 15 '15 at 20:59
0

I have found my answer. I am, indeed, using nearly all of my server's space, in part due to excessive on-disk storage of backups. That's easily fixed.

For those who run into the same problem: here's how you can tell how much disk space you are using.

First, df will give you accurate information regarding the space used by a file system; my version of cPanel (11.50) has not actually broken that. This means that the emails I have been receiving regarding my disk usage are accurate. As of today, df gives me:

Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/simfs      31457280 27281568   4175712  87% /
none             3145728        4   3145724   1% /dev

The way I investigated where those numbers came from is to run two commands:

# get the per-directory usage for /
du --max-depth=1 / 2>> /dev/null

# get the per-directory usage for /home
du --max-depth=1 /home 2>> /dev/null

These commands produce a lot of output, of which just a few lines were relevant:

$ du --max-depth=1 / 2>> /dev/null

    ...
    44294300 /home
    ...
    13223520 /backup
    70300192 /

$ du --max-depth=1 /home 2>> /dev/null

    227176   /home/george
    ...
    43093568 /home/virtfs
    ...
    44294844 /home

(There's a little variation in the size of /home between these commands just because of changes to the filesystem while they were executing.)

Here's what this tells me:

  1. My total usage is actually 27 GB,
  2. /home/virtfs makes du report 42 GB more than actually exists, thanks to overcounting system files, etc.,
  3. I have a lot of backups on my disk that I don't really need. Time to relocate those.

I hope someone finds this helpful. If you have any questions, please ask them in the comments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.