Chapter 4: Linux Advanced Commands
4.8 Disk and storage commands
Friends, if the No space left on device error hits during the Amul-style dairy's Diwali order rush, the orders stop. So make it a habit to look at df -h and du -sh every day.
मित्रांनो, No space left on device हा एरर Amul-स्टाइल डेअरीच्या दिवाळी ऑर्डर्सच्या गर्दीत आला तर ऑर्डर्स थांबतात. म्हणून df -h आणि du -sh रोज बघायची सवय ठेवा.
दोस्तों, No space left on device वाला एरर Amul-स्टाइल डेयरी की दिवाली ऑर्डर्स की भीड़ में आया तो ऑर्डर्स रुक जाते हैं. इसलिए df -h और du -sh रोज़ देखने की आदत रखो.
df -h # disk space per mounted filesystem (human readable)
df -Th # include filesystem type (xfs, ext4)
sudo du -sh /var/log # total size of a folder
sudo du -h --max-depth=1 /var | sort -h # which sub-folder is big?
lsblk # block devices (disks & partitions) as a tree
lsblk -f # with filesystem type, UUID and mount point
sudo blkid # UUIDs of all filesystems
findmnt / # what is mounted at /
sudo mount /dev/nvme1n1 /data
sudo umount /data
cat /etc/fstab # permanent mounts (read at boot)
free -h # memory
/etc/fstab format (covered in depth in Chapter 13):
# <device> <mount point> <type> <options> <dump> <fsck>
UUID=3f1c2b9a-6d1e-4a5f-9c1e-2b7d8a9e0f11 /data xfs defaults,nofail 0 2
Ravindra Bagale's Tip
A common mistake is editing /etc/fstab and rebooting straight away – one typo and the instance does not boot. After editing, always run sudo mount -a; reboot only if no error appears. Copy the UUID from sudo blkid – don't type it by hand.
Ravindra Bagale's Tip – मराठी
एक common चूक म्हणजे /etc/fstab edit करून लगेच reboot करणं – एक typo आणि instance boot होत नाही. Edit नंतर नेहमी sudo mount -a चालवा; error नाही आला तरच reboot करा. UUID sudo blkid मधून copy करा, हाताने type करू नका.
Ravindra Bagale's Tip – हिंदी
एक common गलती है /etc/fstab edit करके तुरंत reboot करना – एक typo और instance boot नहीं होता. Edit के बाद हमेशा sudo mount -a चलाओ; error नहीं आया तभी reboot करो. UUID sudo blkid से copy करो, हाथ से type मत करो.
Lab
Chala, df -Th ne root filesystem cha type (xfs kiwa ext4) aani vapar liha, lsblk -f ne disks bagha, aani sudo du -h --max-depth=1 /var | sort -h ne /var madhla sagalyat motha folder shodha.
Extended teaching notes
Why this lesson matters
Cloud security is mostly IAM, network exposure, logging and secure defaults. The shared responsibility model means the provider patches the metal; you patch what you configure.
- No public databases or public admin panels.
- Roles / OIDC instead of long-lived access keys.
- CloudTrail / Activity Logs / Audit Logs on and retained.
- S3/Blob/GCS: Block Public Access; encrypt; least privilege.
Mini case study
Suppose we are on a purple-team exercise for an Indian mid-size company (sample data). Red notes a technique from this lesson against a lab clone. Blue must show the control that stops it, the log that would have fired, and the ticket that hardens production. That is the standard this course trains you for.
Defender's worksheet (do this today)
- Write the lesson title, date and the exact lab target you are allowed to use.
- List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
- Run one safe check from the lesson on a lab system only. Paste the command and output.
- Write a two-sentence fix you would give a teammate.
- Name one related public advisory (CERT-In, CISA, NVD, or a vendor bulletin) with its date.
Indian workplace (sample data)
Suppose we are a junior analyst at Infosys, TCS, Wipro or a fintech SOC in Bengaluru/Pune. Turn this lesson into one checklist item with an owner, a due date and a place to store evidence (ticket + screenshot).
Global practice
Compare your notes with OWASP, CIS Benchmarks, NIST CSF/IR guidance or a cloud Well-Architected security question. Write five lines on what overlaps.
Everyday analogy
Explain the risk and the fix to a family member without jargon. If they can repeat the warning, you understand it well enough to teach juniors.
Key terms
- Control: a safeguard (patch, config, process, detection).
- Finding: a weakness backed by evidence.
- Remediation: the fix plus how you verified it.
- Scope: systems you have written permission to touch.
- Least privilege: only the access the task needs.
- Defence in depth: several layers so one failure does not end the story.
Common mistakes
- Skipping written permission "just for a quick scan".
- Practising on hostel, office or public targets without authorisation.
- Collecting tool output without writing the fix.
- Copying attack steps onto production to "verify". Defenders verify with versions, configs and patches.
- Publishing screenshots that contain secrets, cookies or internal hostnames.
Recap
- Evidence, fix, owner, date.
- Own lab only.
- Fix > spectacle.