Tag Archives: Quota

The Curious Case of Missing Quota Report on Volume

A week ago one of my old colleagues ask some help with an error he has on one of his servers, I was happy to oblige.

He had several servers all working exactly the same, same hardware, same OS and same configuration (apart from IP’s).
One of his server crashed and after the reboot one of his batch scripts stopped working specifically on this server.
The script tried to determind if a specific volume (for example: /mnt/volA) exist and have enougth free space,
This he did by invoking the “df” command and the “quota” command (Or their equivalent in the specific language).

What he found was:
While running: “df -k /mnt/volA” he got the correct line and response,
But on the other hand when he tried to run “quota -v |grep “/mnt/volA” the quota command didn’t return the volume.
This was particulary wierd because this volume was NFS volume with specified quota (set on the NFS server) – moreover the volume did apeer on the other servers when you looked for it when you’ve used “quota” Continue reading The Curious Case of Missing Quota Report on Volume

Storage handling with users in Linux – or – The Land of Forgotten Inodes

In my years in IT I’ve handled a lot of storage (proprietary and open source solutions).
But one of the main issues that I had (beside design of large storage and backup) is the rouge user/script/program – sometime one of them will act up and fill the storage with large amount of files or one massive file (for example a big log file).

From time to time someone comes to me and say “Well my script isn’t working” – one of the first things I do is running “quota -u <USERNAME>” and 90% of the time We both see that the user filled his size or inodes quota and hist script fail.
From time to time I collected a lot of scripts and one liners to help me search for the problematic dir/file that contain the issue.

Here are some nice one-liners that can help you find the culprit:

Beware! Using some of this one liners on a directory that have under it local or NAS mount (example: nfs) won’t yield the correct result!
Make sure you run this lines where the you only scan one “device” (local mount, nfs mount etc…) at a time!

  • ¬†Find the largest file amount in current directory (it will only show the current level of directories)
for x in .*/ */; do if [ "$x" != './' ] && [ "$x" != '../' ]; then x=${x#*\'}; x=${x%\'*}; y=`find "$x"|wc -l`; echo -e "$y\t $x";fi; done|sort -k1 -h
  • ¬†Find big directory under your current location (You will need to keep following the path deeper until you find the problematic directory)
du --block-size=1G --max-depth=2|sort -rh|head
  • Find large files:
    (Replace <path/to/dir/> with the path to the directory you want to search in)
find </path/to/dir/> -printf '%s %p\n'| sort -nr | head -10
  • Check your current location device free space (this work even if there is another mount under it):
df -h .