1

This question already has an answer here:

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?

marked as duplicate by ewwhite linux Mar 5 '15 at 13:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Ensure you are not running samba with debug log level! – fgbreel Mar 4 '15 at 16:39
  • Try to see what are writing files with iosnoop command. – fgbreel Mar 4 '15 at 16:40
  • or with lsof to see what files are open – Skaperen Mar 5 '15 at 11:37
  • thanks you guys. samba is not running and i can see tons of file from lsof. Still i am still facing the same problem, it is increased 13 GB from yesterday still now. – sridhar raj Mar 5 '15 at 13:25
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
  • Hi Antonio, thanks for your help. I used the above find command but i can find only few files which are all having only few MB. I have compared from yesterdays and today's sub directory size but there no bigger changes happened in size wise. Only few two folder got increased by 2 GB. But still this share directory keep on increasing. It still very strange why this share drive is getting bigger. Please suggest me how i can solve this problem. Thanks – sridhar raj Mar 5 '15 at 13:37
  • See my reply, I've added some additional clues. Hope it helps :) – Antxon Mar 5 '15 at 13:43
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.

  • Thanks kenorb, from iotop i can find only samba process (smbd -F) using disk write around 25 to 35 kb/s. inotify showing command not found. do i need to install any package to run this? i have compared the size of sub directories, there no much changes comparing with today but that particular shared directory keep on increasing. I have deleted some folder yesterday around 55GB to make free space and now its occupied almost 10GB in one day. – sridhar raj Mar 5 '15 at 13:48
  • Tool inotify (part of inotify-tools) is more advanced to use and you've to install it, so you can pass that. Use the other commands that I've posted (aliases), they're much useful. – kenorb Mar 5 '15 at 14:05
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.

  • directory increase got stopped now. I don't know what was the problem. today free size is 45.5GB, let me check tomorrow and i will post the size. – sridhar raj Mar 5 '15 at 13:55

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