Thuta Learning
AdvancedDevOps & Toolsbeginner

Disk & Storage: df, du, mount

Relax. We'll talk through this in plain words — no textbook voice.

What you'll walk away with

  • Understand Disk & Storage: df, du, mount without any of the intimidation
  • Get hands-on practice trying out the commands yourself in the terminal
  • See how these commands actually come in handy on a real server or project

Let's think about it this way for a second

df (disk free) gives you an overview of how much space is left on each disk/partition — df -h (human-readable) shows it in GB/MB format instead of long raw byte numbers, so it's easier to read. du (disk usage), on the other hand, shows in detail how much space each folder/file is taking up — du -sh <folder> shows a folder's total size in summary (s) + human-readable (h) format. mount is the concept of attaching an external drive (USB, a new disk) as a folder within the filesystem tree — mount is what implements the idea of 'no drive letters, just one single tree.'

Let's connect this to a real-world scenario

If you see a 'disk full' warning, first run df -h to see which partition is the problem, then run du -sh /* (the size of each folder under root) to hunt down the biggest folder — log files under /var/log are a common culprit behind this kind of issue. When you plug in a USB drive, modern desktop distros usually auto-mount it, but on a server (with no GUI) you may need to run the mount command manually — something like sudo mount /dev/sdb1 /mnt/usb.

Let's try it together in the terminal

bash
df -h
du -sh /var/log
du -sh /home/*     # home ထဲက folder တစ်ခုချင်းစီ size
sudo mount /dev/sdb1 /mnt/usb
You should see
Running df -h shows a table with Filesystem, Size, Used, Avail, Use%, and Mounted on columns.

5-minute try-it

Run df -h and see how much disk space you have left. Run du -sh ~ and note down the total size of your home folder.

A quick word of caution

Running the mount command against the wrong device (/dev/sdX) can damage existing data — double-check the device list with the lsblk command first.

Easy traps

  • Trying to read df output as raw, long byte numbers and forgetting about the -h flag — it's hard to read without -h
  • Running du on a large folder (like root /) without -s, resulting in overly long output and taking forever

Now try it yourself

Run df -h and see how much disk space you have left. Run du -sh ~ and note down the total size of your home folder.

You'll know it worked when: Running df -h shows a table with Filesystem, Size, Used, Avail, Use%, and Mounted on columns.