Easiest total disk storage usage
What is the easiest way to see our total disk storage usage? This info wasn't clear on the Linode Manager site, though logging in through PuTTy we could quickly see our storage was full using the df command at the prompt. Thank you-
1 Reply
It sounds like you're already on the right track. Using the df command with "-h" can display the output in a human readable format. If you apply the "-a" flag, that will display all file systems as well as disk and memory usage.
df -a
Filesystem 1K-blocks Used Available Use% Mounted on
sysfs 0 0 0 - /sys
proc 0 0 0 - /proc
udev 472736 0 472736 0% /dev
devpts 0 0 0 - /dev/pts
tmpfs 100888 5796 95092 6% /run
/dev/sda 25230876 2451880 21478120 11% /
securityfs 0 0 0 - /sys/kernel/security
tmpfs 504428 0 504428 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 504428 0 504428 0% /sys/fs/cgroup
To get an output displaying your disk partitions and usage, you can try the "pydf" command.
pydf
Filesystem Size Used Avail Use% Mounted on
/dev/sda 24G 2394M 20G 9.7 [##....................] /
/dev/loop0 55M 55M 0 100.0 [######################] /snap/core18/1074
/dev/loop4 55M 55M 0 100.0 [######################] /snap/core18/1098
/dev/loop3 55M 55M 0 100.0 [######################] /snap/core18/1144
/dev/loop1 10M 10M 0 100.0 [######################] /snap/linode-cli/26
/dev/loop2 10M 10M 0 100.0 [######################] /snap/linode-cli/28
Similarly, the "lsblk" command will show your disk in terms of the storage blocks, including your swap image.
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 54.4M 1 loop /snap/core18/1074
loop1 7:1 0 9.5M 1 loop /snap/linode-cli/26
loop2 7:2 0 9.7M 1 loop /snap/linode-cli/28
loop3 7:3 0 54.4M 1 loop /snap/core18/1144
loop4 7:4 0 54.4M 1 loop /snap/core18/1098
sda 8:0 0 24.5G 0 disk /
sdb 8:16 0 512M 0 disk [SWAP]
Finally, the du command will display disk usage of specific files and directories. you can add the -h flag to get a more concise output:
du -h
4.0K ./.cache
4.0K ./.gnupg/private-keys-v1.d
8.0K ./.gnupg
4.0K ./snap/linode-cli/26
4.0K ./snap/linode-cli/common
4.0K ./snap/linode-cli/28
16K ./snap/linode-cli
20K ./snap
152K ./cli-master/lib/Linode/CLI/Object
196K ./cli-master/lib/Linode/CLI
232K ./cli-master/lib/Linode
24K ./cli-master/lib/WebService/Linode
52K ./cli-master/lib/WebService
288K ./cli-master/lib
456K ./cli-master
572K .
There are many commands and flags that can be run to understand your disk in terms of space and usage, but these are a great start. If you'd like to learn more, I'd recommend reviewing some online linux resources like Tecmint.com. Good Luck!