1

I am running Linux server, we using this server as a samba share drive. From yesterday suddenly, one of the share drive size getting increasing (~ 100 MB every ten min). There are too many folders and sub folders are there in this share drive. Now the share drive running out of space.

Please help me how I can find which folder is getting increasing. I have tried below command to get the size of sub directories of the share drive. But I need to compare the output and its take too long time to find if i am not lucky.

du -sh --maxdepth=1  

Can you please suggest me, is there any other way I can find the data transaction in this file system?

kenorb
  • 7,125
sridhar raj
  • 41
  • 1
  • 2
  • 3

3 Answers3

2

Look for recently modified files by using the command below. It will show the files modified during the last ten minutes inside FOLDER. Increase the -mmin -10 parameter to see how the FOLDER was modified through time. See man find and look for -mtime and -mmin for full details:

sudo find FOLDER -xdev -type f -mmin -10 -ls

Another situation is when deleted files are still taking disk space which is not being recovered due to processes still using them. In this case, identify the processes using deleted files and finish them for the space to be recovered:

sudo lsof | grep deleted

Looking for size won't help here, as many small files can take as much space or more than a big file. Check inode numbers too. Also, to get the size for all folders inside FOLDER:

sudo find FOLDER -xdev -type d | xargs -I DIR du -sm DIR | sort -nk1
Antxon
  • 166
2

You can try iotop tool which shows you I/O usage by processes (in other words, which top processes are using your disk), so you can track which process is responsible for eating the space. Another way is to use inotify (part of inotify-tools) which can monitor directories for changes.

Or simple way is to use du in the following way.

Define the following aliases:

alias big='du -ah . | sort -rh | head -20'
alias big-files='ls -1Rhs | sed -e "s/^ *//" | grep "^[0-9]" | sort -hr | head -n20'

Then go to some suspicious folder and run big to show you the biggest files and directories in the current directory. Or run big-files to see the biggest files recursively in the current folder.

Note: To work on OSX/BSD properly (as sort doesn't have -h), install sort from coreutils or remove -h from ls and use sort -nr instead.

kenorb
  • 7,125
0

I usually use ncdu to explore disk space usage, if your increasingly big folder doesn't block your system or the ncdu scan you should be able to find by looking which folders look anormaly big.

Ixio
  • 173