How to set Quotas to /home partition till fix arrives

There are known issue with any server using /home as the primary mount partition.

The solution would be to reset quotas and assign them to that particular mount as quotas within the script are mounted to /

This fix isn’t too terribly complicated and will be built into a future version.

In the meantime, try this out:

quotaoff -a
service quota stop
mount -o remount /home
quotacheck -auMF vfsv1
quotaon -uv /home
service quota start

It is possible you will need to edit the /etc/fstab file as well to ensure that repquota is on the /home mount.
Type cat /etc/fstab

Some installations will look like the following (Please note - this is an example, but you should get the idea ;))

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda6 during installation
UUID=b648cd9d-ca40-4648-b0d1-c4052d6694e3 /               ext4    usrquota,errors=remount-ro 0       1
# /home was on /dev/sda1 during installation
UUID=464103ce-e884-40bf-8911-b0d1aead74f1 /home           ext4    defaults        0       2
# swap was on /dev/sda5 during installation
UUID=841ed6d3-97b6-4d51-a021-8b915cc93d97 none            swap    sw              0       0

Notice the line
UUID=464103ce-e884-40bf-8911-b0d1aead74f1 /home ext4 defaults 0 2

This is the line you will need to edit. This is simple.
Just change defaults to usrquota,errors=remount-ro, then save and close the file.

You will additionally need to make a quick adjustment to the diskspace plugin within rutorrent as follows:

Navigate to the file action.php at /srv/rutorrent/plugins/diskspace/action.php

Change the lines:

$total = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u / | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf $4*1024}'");
$free = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u / | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf ($4-$3)*1024}'");

-to-

$total = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u /home | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf $4*1024}'");
$free = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u /home | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf ($4-$3)*1024}'");

Now, make some quick adjustments to the disk_data widget (disk_data.php) to update the proper mount for use on your QuickBox dashboard. This file is located at: /srv/rutorrent/home/widgets/disk_data.php

Change the lines: located at lines #45-48

if (file_exists('/usr/sbin/repquota')) {
      $dftotal = shell_exec("sudo /usr/sbin/repquota /|/bin/grep ^".$username."|/usr/bin/awk '{printf \$4/1024/1024}'");
      $dffree = shell_exec("sudo /usr/sbin/repquota /|/bin/grep ^".$username."|/usr/bin/awk '{printf (\$4-\$3)/1024/1024}'");
      $dfused = shell_exec("sudo /usr/sbin/repquota /|/bin/grep ^".$username."|/usr/bin/awk '{printf \$3/1024/1024}'");
      $perused = sprintf('%1.0f', $dfused / $dftotal * 100);

-to-

if (file_exists('/usr/sbin/repquota')) {
      $dftotal = shell_exec("sudo /usr/sbin/repquota /home|/bin/grep ^".$username."|/usr/bin/awk '{printf \$4/1024/1024}'");
      $dffree = shell_exec("sudo /usr/sbin/repquota /home|/bin/grep ^".$username."|/usr/bin/awk '{printf (\$4-\$3)/1024/1024}'");
      $dfused = shell_exec("sudo /usr/sbin/repquota /home|/bin/grep ^".$username."|/usr/bin/awk '{printf \$3/1024/1024}'");
      $perused = sprintf('%1.0f', $dfused / $dftotal * 100);

For good measure, let’s restart quotas with service quota restart followed by service apache2 restart

Now your quotas should be able to get the proper assignments on the proper mounts. You may need to run the setdisk command once more on the user in question to update their quotas properly.

Before running setdisk

After running setdisk

2 Likes