How do I view the used space on my server's disk?
The Cloud Manager is showing 100% disk storage used but I'm sure my disk isn't full. How can I verify the correct information?
5 Replies
The Classic and Cloud Manager interfaces indicates how much storage space from your server's plan that you've allocated to the disk(s) of your Linode. It doesn't indicate the actual used space on the disk(s) themselves. To verify the actual used and free space on your server's disk, you can run the following command:
df -h
Hi there — how do I then see the granular usage within dev/root/?
I get this after running df -h
/dev/root 78G 56G 18G 77% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 201M 1.8G 11% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
tmpfs 393M 0 393M 0% /run/user/0
tmpfs 393M 0 393M 0% /run/user/1000
I need to run space inspection on /srv/users… ?
You can determine the usage of specific directories using the du command. In the example below, you would modify the [directory]
portion and enter the exact location you'd like to inspect.
sudo du [directory] -h --exclude=/proc --max-depth=3 | sort -hr | head
To view the root directory, you'd simply input /
into the command, as below. The *
indicates to show all within the directory.
$ sudo du -h /* --exclude=/proc --max-depth=3 | sort -hr | head
To view the srv/users/ directory, the command below should work:
$ sudo du -h /srv/users/* --exclude=/proc --max-depth=3 | sort -hr | head
To explain what's happening in the commands above, you are activating the sudo
program to access superuser privileges. du
is used to estimate file space usage. The -h
flag makes sure that the output is printed in human readable format. Next, you're specifying the directory you'd like to see such as /
for root. In this example, we used the --exclude=/proc
tact to ignore some unnecessary output.
The --max-depth=3
portion includes three levels deeper into the directory. Next, we're using a pipeline |
to sort the output by the -h
(human readable output) values and list them in -r
reverse. Finally, we use head
to include only the first part of the files.
On a fresh Linode, your results may look like:
# sudo du -h /* --exclude=/proc --max-depth=3 | sort -hr | head
464M /usr
230M /lib
229M /usr/share
188M /lib/modules/4.9.0-11-amd64
188M /lib/modules
184M /usr/lib
184M /lib/modules/4.9.0-11-amd64/kernel
143M /var
121M /var/lib
118M /usr/lib/x86_64-linux-gnu
You may also refer to the du man page for additional functionality of this command.
thanks!