Huge /home/virtfs folders (185Gb!)

postcd

Well-Known Member
Oct 22, 2010
721
21
68
Hello,

i found this on my WHM VPS:

# du -h --max-depth=0 /home
185G ./home/virtfs
207G ./home

so virtfs is much bigger than normal folders...

Here are biggest accounts in virtfs:
3.3M ./home/virtfs/zn******
3.3M ./home/virtfs/zv******
3.4M ./home/virtfs/am******
3.4M ./home/virtfs/aw******
3.4M ./home/virtfs/pu******
3.7M ./home/virtfs/ba******
20G ./home/virtfs/ca******
20G ./home/virtfs/ct******
20G ./home/virtfs/va******
20G ./home/virtfs/zn******
21G ./home/virtfs/ch******
21G ./home/virtfs/io******
21G ./home/virtfs/ku******
21G ./home/virtfs/zt******
25G ./home/virtfs/pr******
185G ./home/virtfs

i looked into biggest 25GB folder:
/home/virtfs/pr******

and it has standard linux structure, not sure why?

0 ./proc
4.0K ./dev
4.2M ./etc
7.5M ./bin
7.9M ./sbin
11M ./lib
27M ./lib64
51M ./opt
51M ./tmp
4.9G ./home
7.9G ./usr
12G ./var
25G .

So big is VAR folder i found for example /home/virtfs/pr******/var/lib/mysql
contains mysql databases of different accounts here, not only pr******

please can anyone let me know why these virtfs are so big? i would like to somehow decrease size of the:
20G ./home/virtfs/ca******
20G ./home/virtfs/ct******
20G ./home/virtfs/va******
20G ./home/virtfs/zn******
21G ./home/virtfs/ch******
21G ./home/virtfs/io******
21G ./home/virtfs/ku******
21G ./home/virtfs/zt******
25G ./home/virtfs/pr******

Thank you for help/advice
 

nisamudeen97

Well-Known Member
Jul 7, 2010
60
5
58
Cochin
cPanel Access Level
Root Administrator
Hi,

As you have enabled jailed shell for users you are coming across this issue. /home/virtfs/cpaneluser : This directory structure is created when user access jail shell.

You can enable and disable shell access for each users via whm WHM >> Manage Shell Access and enable/disable Jailed Shell for users.

When any capnel usr which have access to jail shell for his account login to shell and failed to properly logout from his session this issue occur.
because the bind (virtual) mount for his directory are recreated and not properly release.
[Mod Edit - Removed unsafe instructions]
 
Last edited by a moderator:

postcd

Well-Known Member
Oct 22, 2010
721
21
68
Hi, thank You for advices. In WHM, Manage Shell Access i had shell "Disabled" for all accounts.

When i do: # cat /proc/mounts | grep mycpanelusername
i see numerous mount points

when i do: # ps aufx | grep mycpanelusername |grep jailshell"
i see nothing, even when i do "ps aufx | grep mycpanelusername" there is nothing shown

But Your unmounting command returns "device is bussy" errors:
Code:
# for i in `cat /proc/mounts |grep virtfs |grep pr*****|awk '{print$2}'`; do umount $i; done
umount: /home/virtfs/pr*****/usr: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
umount: /home/virtfs/pr*****/var: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
umount: /home/virtfs/pr*****/usr/local/cpanel/3rdparty/mailman: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
# fuser pr*****
shows:
Code:
Cannot stat file /proc/13302/fd/0: Permission denied
Cannot stat file /proc/13302/fd/1: Permission denied
Cannot stat file /proc/13302/fd/2: Permission denied
Cannot stat file /proc/13302/fd/3: Permission denied
Cannot stat file /proc/13302/fd/4: Permission denied
Cannot stat file /proc/13302/fd/7: Permission denied
Cannot stat file /proc/13302/fd/10: Permission denied
please what do you suggest to check/do?
 
Last edited:

cPanelNick

Administrator
Staff member
Mar 9, 2015
3,481
35
208
cPanel Access Level
DataCenter Provider
Please use


# /scripts/clear_orphaned_virtfs_mounts --help

Unmount any virtfs mounts whose users no longer exist or whose shell is not currently jailshell/noshell


/scripts/clear_orphaned_virtfs_mounts [--help] [--errorsonly] [--inactiveonly] [--clearall] [--user=<user>]


/scripts/clear_orphaned_virtfs_mounts --help - this screen

/scripts/clear_orphaned_virtfs_mounts --user=<user> - Only cleanup the specified user

/scripts/clear_orphaned_virtfs_mounts --errorsonly - Do not have any output unless there are errors

/scripts/clear_orphaned_virtfs_mounts --inactiveonly - Only cleanup for users with no running processes

/scripts/clear_orphaned_virtfs_mounts --clearall - Unmount all virtfs mounts regardless of user's jailshell/noshell status
 

postcd

Well-Known Member
Oct 22, 2010
721
21
68
cPanelNick: thx, i did: # /scripts/clear_orphaned_virtfs_mounts --user=pr*****
Code:
-- Begin user 'pr*****' --
No action needed
-- End user 'pr*****' --
(instead of ***** i used valid account name)

then: # du -h /home/virtfs/pr***** --max-depth=0
Code:
du: cannot access `/home/virtfs/pr*****/proc/18134': No such file or directory
du: cannot access `/home/virtfs/pr*****/proc/18403/task/18403/fd/4': No such file or directory
du: cannot access `/home/virtfs/pr*****/proc/18403/task/18403/fdinfo/4': No such file or directory
du: cannot access `/home/virtfs/pr*****/proc/18403/fd/4': No such file or directory
du: cannot access `/home/virtfs/pr*****/proc/18403/fdinfo/4': No such file or directory
25G     /home/virtfs/pr*****
tried also ---clearall switch, but did not cleared anything..
 

postcd

Well-Known Member
Oct 22, 2010
721
21
68
Here is the reply of the server admin who taken a look on that:

VirtFS is provided by cPanel and is a core functionality of the jailed system. Whether or not you provide shell access, VirtFS is still required to allow those users without full shell access the ability to use autoresponders, cron jobs, etc. These VirtFS directories are simply mirrors of the actual user's paths on the server, and should not take up space other then the actual space used by the actual files in /home.

The following is the accurate disk usage of the server:
/dev/simfs 235G 181G 55G 77% /

I am not seeing that VirtFS is actually using space. It was previously reported as :

86G /home/virtfs

Which is not the true space, as clearing the mounts brings down the reported usage:
46G /home/virtfs

However it does not lower or increase the disk space available:

[09:43:49 hostname root@6329935 ~]***# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/simfs 235G 181G 55G 77% /