/home/virtfs eating up space - not using jailshell

PWSowner

Well-Known Member
Nov 10, 2001
2,901
4
343
ON, Canada
The use jailshell on new account creation is not ticked.

The manage shells shows nobody with jailshell, but some of my own accounts have normal shell.

Those first 2 statements don't even matter though, as you'll see below. I only included them because searching for this issue has brought that up frequently.


I use sftp to ftp to my accounts, and every one that I have sftp'd to now has /home/virtfs/username dir using 4GB each. Many threads and sources elsewhere say /home/virtfs doesn't actually use space, but on my server it either is using space, or my server thinks it is.

According to "du -h --max-depth=1 /" and "du -h --max-depth=1 /home" for more detail, the virtfs subdirectory is using up 45GB of space.

Using "df -h" verifies it is using actual space.

Code:
[email protected] [/]# du -h --max-depth=1 /home
321M    home/oneuser
444K    home/anotheruser
...
45G     home/virtfs
18M    home/moreusers
...
144G    home/
All /home/users totaled 98GB so du says virtfs is using space.

I got a warning email this morning that / was running out of space.

Code:
[email protected] [/]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      287G  196G   27G  91% /
/dev/sda1              99M   19M   76M  20% /boot
tmpfs                1001M     0 1001M   0% /dev/shm
/usr/tmpDSK           485M   11M  449M   3% /tmp
So I deleted some huge files (50GB worth) that I didn't need but wanted, and can get again later, so now I have 77GB free.


Is virtfs supposed to use up actual space? If not, why is it?
Is sftp'ing supposed to create the virtfs dir even though jailshell is off?
How can I stop those virtfs dirs from being created?
 

PWSowner

Well-Known Member
Nov 10, 2001
2,901
4
343
ON, Canada
That says
The /home/virtfs directory will be created on a user's first jailed shell login. This login can occur via SSH or through SFTP.
I don't have any users set to use jailed shell, but as I said, if I use sftp for some of my accounts, it creates the virtfs. I did notice though that some of my accounts that I use sftp for don't have a virtfs folder, so I looked into that and found that on accounts I have set to use normal shell, that's not created. The ones that do create that, are not set to use normal or jailed shell, so it appears if neither is set, sftp automatically acts as if jailed shell was set.

So, now I know that I just have to enable normal shell on any accounts I want to sftp to and those folders won't be created.

I'll just enable normal shell for all my own sites and customer sites that I do the design for. Using sftp isn't an issue for clients who do their own design because I have it set to a different port, so anyone wishing to use sftp has to contact me first.
 

erick_paper

Well-Known Member
Apr 19, 2005
245
0
166
I'm trying to do the same. I want to clear /virtfs/ folder for most of my accounts. Eating up needless space. (Didn't know jailshell required so much space to enable!)

I read this:
VirtFS < AllDocumentation/WHMDocs < TWiki

But "umount /...usr/bin" does nothing.

When I try to remove the virtfs folder after setting the user to normal shell, it tells me a whole lot of processes that are going on, and doesn't delete the virtfs folder.

What's up? How to get rid of this stupid folder and recover GBs of hard disk space?
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
I'm trying to do the same. I want to clear /virtfs/ folder for most of my accounts. Eating up needless space. (Didn't know jailshell required so much space to enable!)

I read this:
VirtFS < AllDocumentation/WHMDocs < TWiki

But "umount /...usr/bin" does nothing.

When I try to remove the virtfs folder after setting the user to normal shell, it tells me a whole lot of processes that are going on, and doesn't delete the virtfs folder.

What's up? How to get rid of this stupid folder and recover GBs of hard disk space?
For future reference, here's the documentation for disabling and removing virtfs properly:

VirtFS < AllDocumentation/WHMDocs < TWiki
 

david510

Well-Known Member
Aug 22, 2004
473
0
166
To see if any user has virtfs mounted, use the following command.

Code:
 cat /proc/mounts | grep virtfs
If you see any you can umount them. That will solve the issue.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
There are some improvements coming in cPanel 11.25 that will address this. For example account termination will remove the virtfs entry for the account ( if one existed ). Also a /scripts utility will allow you to remove virtfs entries in a safe manner.
 

WebGraf

Member
Feb 13, 2010
18
0
51
users do not have Jailshell
but virtfs is not deleted

unmount /home/virts/username/usr/bin
-bash: unmount: command not found

How to delete virtfs?
 

Infopro

Well-Known Member
May 20, 2003
17,075
524
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
users do not have Jailshell
but virtfs is not deleted

unmount /home/virts/username/usr/bin
-bash: unmount: command not found

How to delete virtfs?
Please read the documentation a bit closer, you've got a typo in your command.
VirtFS < AllDocumentation/WHMDocs < TWiki

You can safely remove VirtFS directories after unmounting them. To unmount a bind mounted directory, you can use the umount command. For example, if you wanted to unmount /home/virtfs/user/usr/bin, simply run the following command:
•umount /home/virtfs/user/usr/bin

To completely remove the jailed shell environment, all bind mounts under /home/virtfs/user/ must be unmounted. Once all bind mounts are unmounted for a user, the user directory under /home/virtfs for that user can be removed. To see if a directory is still bind mounted, search for the username in the contents of /proc/mounts.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
/scripts/clear_orphaned_virtfs_mounts will remove the virtfs directories for:

1. users that no longer exist
2. users that no longer use jailshell

This script also takes a --clearall parameter which will remove all virtfs mounts regardless of the prior two conditions. Please exercise care when using this parameter.
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator

mike25

Well-Known Member
Aug 29, 2003
83
0
156
Raleigh NC, USA
After running the script, and seeing that virtfs is gone, the disk usage displayed via df is unchanged. Is a reboot required or is there a simpler method to free up the space ?
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,544
13
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
After running the script, and seeing that virtfs is gone, the disk usage displayed via df is unchanged. Is a reboot required or is there a simpler method to free up the space ?
You may trigger usage of disk quotas to be recalculated using the following command via root SSH access; however, as with any maintenance, I would only consider running this during off-peak hours while no other users are logged in via SSH or SFTP:
Code:
# /scripts/fixquotas
 

mike25

Well-Known Member
Aug 29, 2003
83
0
156
Raleigh NC, USA
No luck with that. I have also tried restarting all the main services with no luck. I will reboot if need be, but I am always weary of rebooting a live server that has an unknown issue .. especially since I just messed with the mounts and such. I did this one the long way before reading the entire thread and seeing a script now existed to complete the task, but I did run the script on another server and have the same issue on it as well.
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,544
13
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
No luck with that. I have also tried restarting all the main services with no luck. I will reboot if need be, but I am always weary of rebooting a live server that has an unknown issue .. especially since I just messed with the mounts and such. I did this one the long way before reading the entire thread and seeing a script now existed to complete the task, but I did run the script on another server and have the same issue on it as well.
Please submit a support request so that we may inspect the precise circumstances involved and assist with further, in-depth investigation. When available, please to let me know the ticket ID number of your new support request so that we may follow-up internally; you are welcome to send me a private message (PM) with the ticket ID number.
 
Last edited:

sirdopes

Well-Known Member
PartnerNOC
Sep 25, 2007
141
0
66
Unless I am mistaken, most of the files that you see in /home/virtfs are hardlinks to files somewhere else. You are not going to see a decrease in diskspace since the files already exist on the server in another location. When you umount virtfs, you are just removing a hardlink to the file. Please correct me if I am wrong.