User Tools

Site Tools


storage

Find Largest Files and Directories:

echo " "; echo " "; echo "Largest Files:"; echo " "; nice -n 19 find `pwd` -mount -type f -ls|sort -rnk7 |head -20|awk '{printf "%d MB\t%s\n",($7/1024)/1024,$NF}'; \
echo " "; echo "=========================== "; echo " "; echo "Largest Directories:"; echo " ";nice -n 19 du -xSk `pwd` | sort -rn | head -20|awk '{printf "%d MB\t%s\n",($1/1024),$NF}' | grep -v '^0' 

########################### < File Operations > ###########################

FIND LARGE OPEN FILES:

lsof | awk '{print $7,$9}' | sort -rn | head
lsof |awk '{print $7," ",$9}' |sort -n | uniq

FIND LARGE DIRECTORIES INSIDE FILESYSTEM:

date ; nice -n 19 du -xSk `pwd` | sort -rn | head -30|awk '{printf "%d MB\t%s\n",($1/1024),$NF}' 

FINDING LARGE FILES:

date ; nice -n 19 find `pwd` -mount -type f -ls|sort -rnk7 |head -30|awk '{printf "%d MB\t%s\n",($7/1024)/1024,$NF}'
date ; nice -n 19 find / -xdev -type f -size +100 -exec du -ak {} \; |sort -rn |uniq | head -10
date ; nice -n 19 find / -type f -size +51200k -exec du -hs {} \;
date ; nice -n 19 find / -mount -type f -ls|sort -rnk7 |head -30|awk '{printf "%d MB\t%s\n",($7/1024)/1024,$NF}'
date ; nice -n 19 du -kxch / | egrep '[.][0-9][G]' | sort -rn | head -n 20	

du –max-depth=1 -xh . du -ksh * df -i

ionice -c 3 find . -mount -type f -ls| nice -n 19 sort -rnk7 |head -30|awk '{printf ”%d MB\t%s\n”,($7/1024)/1024,$NF}'

Find files still open for delete

lsof | grep del

PIDS USING FILESYSTEM

fuser -m <mount point>

Disk Free monitor:

for i in {1..10000000}; do echo ” ”; echo ” ”;df -h; date; echo ”======================”; echo ” ”;sleep 30; done

<Finding large directories:> date ; nice -n 19 du -xSk `pwd` | sort -rn | head -30|awk '{printf ”%d MB\t%s\n”,($1/1024),$NF}'

<Finding large files:>

find / -type f -size +500000k -exec ls -lh {} \; | awk '{ print $9 ”: ” $5 }'

date ; nice -n 19 find `pwd` -mount -type f -ls|sort -rnk7 |head -30|awk '{printf ”%d MB\t%s\n”,($7/1024)/1024,$NF}'

date ; nice -n 19 find / -xdev -type f -size +100 -exec du -ak {} \; |sort -rn |uniq | head -10

date ; nice -n 19 find / -type f -size +51200k -exec du -hs {} \;

date ; nice -n 19 find / -mount -type f -ls|sort -rnk7 |head -30|awk '{printf ”%d MB\t%s\n”,($7/1024)/1024,$NF}'

date ; nice -n 19 du -kxch / | egrep '[.][0-9][G]' | sort -rn | head -n 20

lsof |awk '{print $7,” ”,$9}' |sort -n | uniq -This will show you the largest <b>open files</b> currently in play on the server.

</large files>

Tuning reserved blocks on the linux filesystem:

tune2fs -l /dev/xxxx

tune2fs -m 1 /dev/xxxx

storage.txt · Last modified: 2013/11/13 16:29 (external edit)