Contact Support : +64 220 256 070

Aimvm
Blog

Why /home/virtfs consuming more space on the server?

Posted on: October 25, 2014

What is VirtFs?

The /home/svirtf directory which contains configuration files, utilities and binaries or bind mounts is a feature from panel, which allows jailed shell access for all the users to their respective home directories on the server. The term jailed access means all the users will be prevented access to other files outside their own home directories. Users with a jailed shell will have bind-mount to the directory /home/virtfs/username/usr/bin.

Why is it consuming more space?

During an active session all the jailed users will be bind-mounted on the server. A bind mount is a transparent link between two places in the file system. For example, if a user views the contents of the /home/virtfs/username/usr/bin file the user actually sees the contents of /usr/bin. However, mounted directories sometimes will never get unmounted even the jailed access session ended. Such mounts are called orphaned VirtFs mounts.

Example:

spark [~]#df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/simfs      200G   99G  102G  50% /
none            2.0G  4.0K  2.0G   1% /dev
/dev/simfs      200G   99G  102G  50% /home/virtfs/ginagov/lib
/dev/simfs      200G   99G  102G  50% /home/virtfs/ginagov/usr
none            2.0G  4.0K  2.0G   1% /home/virtfs/ginagov/dev
/dev/simfs      200G   99G  102G  50% /home/virtfs/ginagov/home/ginagov
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/lib
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/bin
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/sbin
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/opt
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/usr
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/var
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/var/spool
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/var/log
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/etc/mail
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/tmp
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/var/tmp
none            2.0G  4.0K  2.0G   1% /home/virtfs/fuzehost/dev
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/usr/sbin
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/usr/local/cpanel/3rdparty/mailman
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/usr/local/cpanel/3rdparty/mailman/logs
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/usr/local/cpanel/3rdparty/mailman/locks
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/usr/local/cpanel/3rdparty/mailman/lists

 

What we need to do?

To check if a directory is still bind-mounted run the following on the server:

grep -i username /proc/mounts

In our example it is:

grepi ginagov /proc/mounts
/dev/simfs /home/virtfs/ginagov/lib simfs ro,nosuid,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/ginagov/usr simfs ro,nosuid,relatime,usrquota,grpquota 0 0
none /home/virtfs/ginagov/dev devtmpfs rw,nosuid,noexec,relatime,mode=755 0 0
/dev/simfs /home/virtfs/ginagov/home/ginagov simfs rw,relatime,usrquota,grpquota 0 0

and

spark [~]grepi fuzehost /proc/mounts
/dev/simfs /home/virtfs/fuzehost/lib simfs ro,nosuid,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/bin simfs ro,nosuid,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/sbin simfs ro,nosuid,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/opt simfs ro,nosuid,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/usr simfs ro,nosuid,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/var simfs ro,nosuid,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/var/spool simfs rw,nosuid,noexec,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/var/log simfs rw,nosuid,noexec,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/etc/mail simfs rw,nosuid,noexec,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/tmp simfs rw,nosuid,noexec,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/var/tmp simfs rw,nosuid,noexec,relatime,usrquota,grpquota 0 0
none /home/virtfs/fuzehost/dev devtmpfs rw,nosuid,noexec,relatime,mode=755 0 0
/dev/simfs /home/virtfs/fuzehost/usr/sbin simfs ro,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/usr/local/cpanel/3rdparty/mailman simfs ro,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/usr/local/cpanel/3rdparty/mailman/logs simfs rw,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/usr/local/cpanel/3rdparty/mailman/locks simfs rw,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/usr/local/cpanel/3rdparty/mailman/lists simfs rw,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/usr/local/cpanel/3rdparty/mailman/qfiles simfs rw,relatime,usrquota,grpquota 0 0
/dev/simfs /home/virtfs/fuzehost/home/fuzehost simfs rw,relatime,usrquota,grpquota 0 0
none /home/virtfs/fuzehost/proc proc rw,relatime 0 0

We need to manually unmount all the above orphaned mounts. Make sure that no users have jailed shell access in the “Manage Shell Access” interface. Run the following command on the server:

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

 

However, in some cases you cannot unmount those directories as they are still running instances. See the below example.

spark [~]# for i in `cat /proc/mounts | awk ‘/virtfs/ {print $2}’`; do umount $i;done
umount: /home/virtfs/ginagov/lib: 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/ginagov/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/ginagov/dev: 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/ginagov/home/ginagov: 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/fuzehost/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/fuzehost/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/fuzehost/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))

In such cases you can make use of the cPanel script clear_orphaned_virtfs_mounts. The /scripts/clear_orphaned_virtfs_mounts script will remove the contents of the /home/virtf/$user/etc directory. The script will also remove the account’s /home/ virtfs / $user directory.

spark [~]# /scripts/clear_orphaned_virtfs_mounts  — clearall
— Begin user ‘ginagov
No action needed
— End user ‘ginagov

— Begin user ‘fuzehost
No action needed
— End user ‘fuzehost

spark [~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/simfs      200G   99G  102G  50% /
none            2.0G  4.0K  2.0G   1% /dev
/dev/simfs      200G   99G  102G  50% /home/virtfs/ginagov/lib
/dev/simfs      200G   99G  102G  50% /home/virtfs/ginagov/usr
/dev/simfs      200G   99G  102G  50% /home/virtfs/ginagov/home/ginagov
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/usr
/dev/simfs      200G   99G  102G  50% /home/virtfs/fuzehost/var

Now that all the orphaned and inactive mounts have been successfully unmounted on the server.

 

 

 

 

 

 

 

 

 

Search Blog