I have local disk with 2T capacity attached to a host. Nearly 60 user home directories are stored on this disk.

Currently no disk quotas are enabled.

I need monitor the disk usage of individual users with the regards to this disk. I have tried du and find with the --max-depth=1 option, but these commands take too long to finish.

Is there any way to monitor (using a script) the per user disk usage without affecting the performance of the host?

  • 1
    Short answer is no. Using find or actually any kind of monitoring will affect disk performance. But here are a couple ideas: could you turn individual home directories into mounts (by using LVM for example) or run your monitoring script during low user activity? If your users aren't changing a lot, then LVM solution might be feasible, and it allows you to do your monitoring with df. – user48669 Dec 2 '13 at 6:14
  • 1
    Any kind of disk usage tallying is going to have some overhead. The question is, is it going to be noticeable. Quotas have been around since 4BSD, when disks were 2 orders of magnitude slower than they are today and CPUs were 3 orders of magnitude slower, and many sites found the overhead to be unobjectionable even back then. I'd recommend trying it. – Mark Plotnick Dec 2 '13 at 10:55
  • 6
    enable quotas, that's exactly what they're for. – Stéphane Chazelas Dec 2 '13 at 19:55

If you don't mind changing your file system type and a full backup/restore of your data, a "zero overhead" solution is possible by creating a ZFS pool on your 2TB disk and then one file system per user.

The "zfs list" command will then tell you in real time the disk usage for each user without requiring you to enable disk quota. ZFS will also allow enabling disk quotas if you want to cap the usage par user, reservation if you want to guarantee some space par user, snapshots to allow rollbacks and back-in-time file access, compression to save disk space and generally improve performance.

Most and probably all of these features are also possible with btrfs

| improve this answer | |

The short answer is No

It's impossible to add features without degrading performance.

you could perhaps try some sort of inode scan instead of a directory scan, but I'm not aware of any software that does that.

quotas are likely to be the cheapest option.

Individual mount per user will be almost as cheap, but you'll get hit by increased memory usage and seek times.

| improve this answer | |

You can find the approximate usage size of the users, there is a tool Disk Usage Analyzer with this you can have tree view of the directories which will help finding the approximate usage size.

| improve this answer | |
  • 2
    Disk Usage Analyzer is just some gnome's tools, so if you use some different de or perhaps no de or even gui at all, then installing that program pulls in many unneeded dependencies. – Risto Salminen Dec 2 '13 at 11:02
  • I agree @RistoSalminen – Ruban Savvy Dec 2 '13 at 11:03
  • this will be no faster than using find – Jasen Jan 2 '16 at 4:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.