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: 

  1. SSH into igppgateway.ucsd.edu or one of the computers listed on the following page: IGPP Lab Machines Database.

    ssh username@igppgateway
  2. 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 )

  3. 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

  4. 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: 

  1. For macOS 10.13 and lower, skip this step. For macOS 10.14 or higher, manually grant full disk access:

    1. choose Apple menu  > System Preferences > Security & Privacy > Privacy tab > Full Disk Access.

    2. Click the lock to make changes and provide credentials, if necessary. 

    3. Click the "+".

    4. Add the /Applications/Utilities/Terminal.app.


Checking space usage of network home directory (or any other directories) on Red Hat servers: 

  1. Basic check: 

    sudo du -hs
  2. Checking space usage with sorting: 

    sudo du -hs ~username/* | sort -n.