Help ! My ZFS has filled up shows how to use the du command to list entries under specified directory, and display the files using the most space. This may not be what you want, because you could have a second file system mounted over a sub-directory, and you do not want to include this in the output.
To display the size of files on the device, and not all sub-directories, use the command
find /u -xdev -size +2048 -exec ls -o {} \;|awk '{print $4, $8 }' |sort -n -r |head -n 20
This command does
- find
- /u this directory
- -xdev only files on this same file system – do not (x) go to a different device
- -size +2048 where the size is greater(+) than 2048 of 512 byte blocks (1MiB)
- -exec ls -o {} \; execute the command -ls -o on the name of the file
- awk ‘{print $4, $8 }’ extract the 4th and 8th fields from the data – the size and file name
- sort -n -r sort the data, treating the data as numbers(-n) in reverse order (-r). It defaults to the first column
- head -n 20 and display only the first 20 lines of output.
I used this, and found I had many large files I didn’t want. I removed them, and got a lot of disk space back!
One thought on “What is using all the space on this file system?”