Calculating Disk Space Usage
Questions Addressed
- How do I check how much space my network home is using?
Step-by-step guide
Checking space usage of network home directory from a macOS lab machine:
SSH into igppgateway.ucsd.edu or one of the computers listed on the following page: IGPP Lab Machines Database.
ssh username@igppgateway
Issue command to check home directory size:
du -hs /home/username
(Depending on the size of your directory, it may take awhile to calculate the directory size)
Note: If you wish to have the window display an entry for all files and directories X directories deep enter the following command:sudo du -dh X ~username
(replace X with a value denoting how many directories deep you would like to go and username with your username, i.e. sudo du -hd 1 ~username )
To find calculate Spotlight database size:
sudo du -hcd 1 /.Spotlight-V100/
If Spotlight database requires reindexing, see How to Force Spotlight to Reindex a Drive.
To find all files larger than 5GB:
sudo find / -type f -size +5000000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'|sort -n
Note: that you may get a lot of errors in /private/var/ due to locked files. These can be ignored.
If doing this from a macOS host other than lab machine, may also need the following steps:
For macOS 10.13 and lower, skip this step. For macOS 10.14 or higher, manually grant full disk access:
choose Apple menu > System Preferences > Security & Privacy > Privacy tab > Full Disk Access.
Click the lock to make changes and provide credentials, if necessary.
Click the "+".
Add the /Applications/Utilities/Terminal.app.
Checking space usage of network home directory (or any other directories) on Red Hat servers:
Basic check:
sudo du -hs
Checking space usage with sorting:
sudo du -hs ~username/* | sort -n.