In the process of using VPS or linux Server you will need to check which drive or directory leads to full space, but not everyone knows how to check. So today BKNS will guide you to use some commands. Useful to check.
Table of Contents
1. Check the total capacity of the system.
Command ” df ” displays information about the device name, total blocks, total disk space, used disk space, available disk space, and mount points on the file system.
[root@bkns ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 8.8M 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/sda1 40G 5.3G 35G 14% / /dev/sdb1 16G 45M 15G 1% /backups tmpfs 783M 0 783M 0% /run/user/0
2. Display information about all file system disk space usage
Same as above, but it also shows file system information along with all their file system disk usage and memory usage.
[root@bkns ~]# df -a Filesystem 1K-blocks Used Available Use% Mounted on sysfs 0 0 0 - /sys proc 0 0 0 - /proc devtmpfs 3993604 0 3993604 0% /dev securityfs 0 0 0 - /sys/kernel/security tmpfs 4004184 0 4004184 0% /dev/shm devpts 0 0 0 - /dev/pts tmpfs 4004184 8988 3995196 1% /run tmpfs 4004184 0 4004184 0% /sys/fs/cgroup cgroup 0 0 0 - /sys/fs/cgroup/systemd pstore 0 0 0 - /sys/fs/pstore cgroup 0 0 0 - /sys/fs/cgroup/cpuset cgroup 0 0 0 - /sys/fs/cgroup/cpu,cpuacct cgroup 0 0 0 - /sys/fs/cgroup/memory cgroup 0 0 0 - /sys/fs/cgroup/perf_event cgroup 0 0 0 - /sys/fs/cgroup/pids cgroup 0 0 0 - /sys/fs/cgroup/net_cls,net_prio cgroup 0 0 0 - /sys/fs/cgroup/blkio cgroup 0 0 0 - /sys/fs/cgroup/devices cgroup 0 0 0 - /sys/fs/cgroup/freezer cgroup 0 0 0 - /sys/fs/cgroup/hugetlb configfs 0 0 0 - /sys/kernel/config /dev/sda1 41931776 5530360 36401416 14% / systemd-1 0 0 0 - /proc/sys/fs/binfmt_misc mqueue 0 0 0 - /dev/mqueue hugetlbfs 0 0 0 - /dev/hugepages debugfs 0 0 0 - /sys/kernel/debug /dev/sdb1 16381820 45080 15481548 1% /backups tmpfs 800840 0 800840 0% /run/user/0
3. Display information of /home File System
To view the information of /home use the following command:
[root@bkns ~]# df -hT /home Filesystem Type Size Used Avail Use% Mounted on /dev/sda1 xfs 40G 5.3G 35G 14% /
4. Show the total size of the folder
Check the size of the folder /home/
[root@bkns ~]# du -sh /home/ 40G /home/
5. Show drive partitions.
[root@bkns ~]# fdisk -l Disk /dev/sdb: 17.2 GB, 17179869184 bytes, 33554432 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x06f3e4a6 Device Boot Start End Blocks Id System /dev/sdb1 2048 33554431 16776192 83 Linux Disk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x000adf75 Device Boot Start End Blocks Id System /dev/sda1 * 2048 83886079 41942016 83 Linux
6. Search for 10 files/folders taking up space in VPS/Server
[root@bkns~]# du -a /var/ | sort -n -r | head -10 663516 /var/ 412928 /var/lib 253356 /var/lib/mysql 239616 /var/lib/mysql/ibdata1 145940 /var/lib/rpm 136584 /var/lib/rpm/Packages 127824 /var/log 122708 /var/cache 121360 /var/cache/yum/x86_64/7 121360 /var/cache/yum/x86_64
So BKNS has guided you to use some commands to manipulate disk space check in linux.