Quota like its 1999 – Device or resource busy
It has been a very long time since I did anything with Linux Quotas. To be fair I think the last time I went anywhere near them I was also useing NIS/YP+ and NFS day in day out in 2002. Today - 2018 and I am enabling quotas for Parallels Plesk Onyx to keep handy track of user space and "do not allow overuse" - to avoid the nasty surprise that is being suspended being the first thing you know about it (short of the warnings, the usage totals, and so on... however you need an admin to activate you again... so lets not do that).
The two different /etc/fstab changes I was making were to the line that delivers the user's space. It differed depending on the filesystem that was being used:
ext4 - usrjquota=aquota.user,jqfmt=vfsv0
xfs - usrquota
So the addition looks a little like this:
UUID=123458789-1234-1234-1234-1234567890 /var/www ext4 defaults,usrjquota=aquota.user,jqfmt=vfsv0 0 2
or
UUID=123458789-1234-1234-1234-1234567890 /var/www xfs defaults,usrquota 0 2
As to why the two are different - I do not know - however, I am happy to keep the standard ongoing here - no need to rock the boat and create surprises.
The issue however that I was seeing was consistently a pain for both types.
So -
yum install quota
vim /etc/fstab
mount -o remount /var/www
(or reboot if you are having to do this to the / directory)
quotacheck -avugmf
quotaon -avu
....and at this point you either get the joyous:
[root@plesk999 ~]# quotaon -avu
/dev/mapper/vg_plesk61-lv_root [/]: user quotas turned on
OR in my case every other host would give you something painful like this:
[root@plesk999 ~]# quotaon -avu
quotaon: using /var/www/aquota.user on /dev/sdb1 [/var/www]: Device or resource busy
This is a very big deal, and generally unpleasant.
I spent a bunch of time trying to focus on the DEVICE OR RESOURCE BUSY - as you imagine that the mechanism is at fault - something is holding open a file, or a device is too busy, or something like that you know?
WRONG.
I happened across this in a forum and it works a treat:
[root@plesk999 ~]# quotaon -avu
quotaon: using /var/www/aquota.user on /dev/sdb1 [/var/www]: Device or resource busy
[root@plesk999 ~]# quotaoff -a
[root@plesk999 ~]# quotaon -avu
/dev/sdb1 [/var/www]: user quotas turned on
Yes - turning off the already off quota mechanism means that you are then able to turn it on.
Miraculous.
Day improved. Achievement unlocked. NEXT!