Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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. – Sami Laine 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

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. Hope it helps.

share|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 at 4:42

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.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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