Forum Moderators: bakedjake
We have a web site(0.8GB) on a 2.5GB hosting package(a VPS). However, we're getting waring mails about having only 10% of disk space left, and we gzip and download our logs on a daily basis. And how do you use DU? We've tried to use it but we have to get into every single directory to check it, and we have TONS of folders...
Thanks in advance!
Another possibility is if there's a full snapshot as backup - which would really eat into your allotment.
Personally I'd email the provider and ask them where all the space is diappearing to...
Won't it go through the directories recursively?
For example,
# du /home ¦ sort -nr ¦ more
Should give you reverse numeric sorted space usage for every directory from /home down.
# du / ¦ sort -nr ¦ more
Should give you reverse numeric sorted space usage for the entire drive.
# du /home ¦ sort -nr > /du.txt
Should give you reverse numeric sorted space usage for the entire drive in a file /du.txt.
Put that in a cron job with >> and an echo $date and you should have a running log of what is going on.
-s means "just give me the summary for the named item"
-k means "give it to me in Kbytes, not bytes"
* means "for all of the subdirs immediately below my dir, but not their subdirs"
Cheers,
Andre
You may need to put the full path of a command. Use 'whereis xyz' to find something. Eg, 'whereis du' gives 'du: /usr/bin/du /usr/share/man/man1/du.1.gz'. This tells you that du is located in /usr/bin and has a man page in /usr/share/man/man1/. Do the same for sort, etc.
I tried to use the whereis command and it works but there's this warning:
Warning: couldn't stat file /usr/share/perl/man!
What does it mean?
I C&Ped a warning mail above(in a previous post)...
Here: I just tested this:
40 15 * * * /usr/bin/du / ¦ /usr/bin/sort -nr >> /path/to/file/dulog.`/bin/date +\%m\%d`.txt
This is the error message I got(I think it has something to do with the "¦")
du: ¦: No such file or directory
du: -nr: No such file or directory
Isn't there a way to have something like this:
root 45kb
folder1 56456kb
folder2 3435kb
folder3 8766kb
So I can see how much does each folder(and subfloder below it) has but not get it listed(just the parent), so I can see that (in the example) folder1 is obviously the one with the "burden"?
Thanks in advance!