When to run quotacheck?
By user12625760 on Dec 27, 2006
Not quite as often as seeing someone run fsck on a live UFS file system and then regretting it but often enough someone will run quotacheck on a live file system and be surprised by the results. As usual the clue is in the manual for quotacheck:
quotacheck expects each file system to be checked to have a quota file named quotas in the root directory. If none is present, quotacheck will not check the file system. quotacheck accesses the character special device in calcu- lating the actual disk usage for each user. Thus, the file systems that are checked should be quiescent while quota- check is running.
The first paragraph implies that the file system must be mounted (and it must). The second that it is inactive.
So when can you run quotacheck?
In single user mode. Mount the file system and then run it. If you are using UFS logging you should never need to run it if you manage your users correctly. That is to say if you create a users quota before they can create any file in the file system. If you want to retrospectively add quotas then you have to drop to single user, run quota check, then boot multi user.
Once you have quotas enabled and the system is up and running the kernel will keep track of the quotas so you don't need to check them and like the fsck case if you do check them you will just introduce a corruption.
Suddenly the ZFS model of a quota for a file system and a file system per user seems like a much better way.