Fix for file system quotas /dev/root symlink breaks

Last Updated on Saturday, 27 April 2013 03:22pm Written by spunky Saturday, 27 April 2013 03:22pm

This is a solution to a confusing problem when performing quota checks on CentOS 6.x using Linode/Xen.

When you try quotacheck you get this error:
Copy Code

root@server [~]# quotacheck -a
quotacheck: Cannot stat() mounted device /dev/root: No such file or directory

In troubleshooting the solution, you should check to see if “/dev/root” exists:
Copy Code

ll /dev/root

If it does not exist, create a symbolic link to /dev/xvda by running this:
Copy Code

ln -s /dev/xvda /dev/root

After the symbolic link is created, you can run your quote check function again. In cPanel this function is :
Copy Code

/scripts/fixquotas

All good now. But in some cases, you will reboot your VPS only to find the symbolic link is totally GONE! This is probably caused by a bug in CentOS 6.x on Xen servers.

The fix for this particular problem is to create the link before the code is executed in startup file /etc/rc.sysinit:
Copy Code

# Update quotas if necessary
if [ X"$_RUN_QUOTACHECK" = X1 -a -x /sbin/quotacheck ]; then
action $"Checking local filesystem quotas: " /sbin/quotacheck -anug
fi

if [ -x /sbin/quotaon ]; then
action $"Enabling local filesystem quotas: " /sbin/quotaon -aug
fi

Open /etc/rc.sysinit and search for the code mentioned above. Now place the code below directly before the code mentioned above executes.

Code:
Copy Code

# Create link to /dev/root for quota fix
ln -s /dev/xvda /dev/root

This will create the symbolic link right before the quota checks are performed.
Tags: centos 6, cpanel, dev root, file system quotas, fixquotas, start up, startup, symbolic link, symlink, whm

This entry was posted on Saturday, April 27th, 2013 at 3:22 pm and is filed under code. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.