• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Determining disk usage in Linux using “du” command

By admin

Determining Disk Usage

The du command shows the estimated disk space used by files and directories. If you execute du without any options it will output the sizes of all files starting in your current directory and all subdirectories of your current directory.

Find out how much disk space the /home directory is using with the summarize (-s) and human readable (-h) options:

$ du -sh /home
1.1G	/home

Adding the no subdirectories (-S) option shows only the disk space used by files in the /home directory without counting files in subdirectories of /home:

$ du -sSh /home
201M	/home

Disk Usage

The df command shows how much space each filesystem is using on the disk and where it is mounted. Using the -i options shows inode usage instead of free space. Each file on the system uses an inode. Running out of free space or inodes will cause serious problems and you should add more disk space to the system if either is in danger of running out!

# df -hi /
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/xvda1        20M  105K   20M    1% /

With the type (-T) and the human readable (-h) option df shows the filesystem type, and counts sizes in megabytes and gigabytes:

# df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/xvda1     xfs        20G  5.3G   15G  27% /
devtmpfs       devtmpfs  892M     0  892M   0% /dev
tmpfs          tmpfs     919M     0  919M   0% /dev/shm
tmpfs          tmpfs     919M   17M  903M   2% /run
tmpfs          tmpfs     919M     0  919M   0% /sys/fs/cgroup
tmpfs          tmpfs     184M     0  184M   0% /run/user/1001

Disk Quotas

Linux provides the quota system to control disk usage among users. The quota command, when typed alone at the command line, will show how close you are to your limits. There are hard and soft limits. Depending on system policy, a warning can be sent when you go over a soft limit, and often there is a grace period to allow you time to complete work and then erase or move files so that your disk usage falls back under the soft limit. You may never exceed a hard limit. Quotas may be set on users or groups.

It is important to note that quotas can enforce not only the amount of disk space that a user can use, but also the number of files that a user can create.

The root user may also use the quota command to check on the usage of other users by typing quota -u username at the command line.

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to Manage Oracle database Audit File Directory Growth with cron (ASM Instances Only)
  2. How to Make User Account Read-Only in CentOS/RHEL 7
  3. CentOS / RHEL : How to exclude kernel or other packages from getting updated using YUM Versionlock Plugin
  4. Linux OS Service ‘rusersd’
  5. 7 Useful Find Command Examples to Locate files to remove when a filesystem is full
  6. How to Stop SSH Session From Getting Timed Out
  7. How to Disable NUMA in CentOS / RHEL 6,7
  8. vncserver fails with “Starting VNC server: no displays configured”
  9. CentOS / RHEL : How to find kernel parameters used while booting
  10. /etc/rsyslog.conf – Setup a Filter to Discard or Redirect Messages

You May Also Like

Primary Sidebar

Recent Posts

  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • How to Capture More Logs in /var/log/dmesg for CentOS/RHEL
  • Unable to Start RDMA Services on CentOS/RHEL 7
  • How to rename a KVM VM with virsh
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary