Understanding Linux Disk Management: Directory Tree, Mounting, and Filesystem Tools
This guide explains Linux's unified directory tree, core directories, how to inspect disk usage with df, du, and lsblk, the process of mounting and automating mounts via /etc/fstab, practical cleanup commands, and an introduction to LVM for flexible volume management.
1. Core Directory Structure
/: Root directory, the starting point of the filesystem. /home: Users' home directories for documents, downloads, and desktop files. /etc: Configuration files. /var: Variable data such as logs, caches, and website files. /bin & /usr/bin: Executable commands. /mnt & /media: Mount points for USB drives and external disks.
If /home is placed on a separate partition, reinstalling the system can preserve personal data, but backup strategies must treat partitions and backups distinctly.
2. Viewing Disk Space
df (Disk Free)
Use df -h to display each partition's usage in a human‑readable format (GB/MB).
du (Disk Usage)
Use du -sh FolderName to show the total size of a specific folder, and du -h --max-depth=1 to list the sizes of all immediate sub‑directories.
3. Disk Partition and Mounting
In Linux, inserting a hard drive does not automatically assign a drive letter; the device must be mounted.
lsblk (List Block Devices)
Run lsblk -f to list all storage devices and their partitions. Typical output includes identifiers such as sda (first disk) and sdb (second disk).
Mount Command
sudo mount /dev/sdb1 /mnt/usb # mount sdb1 to /mnt/usb
sudo umount /mnt/usb # unmount before removing the USB driveTo have a disk mounted automatically at boot, edit the /etc/fstab file. A mistake in this file can prevent the system from booting; beginners are advised to use the GNOME Disks graphical tool for safe configuration.
4. Disk Cleanup
If the root filesystem ( /) becomes full, the system may stop functioning.
Clear APT cache : sudo apt clean Remove old kernels : sudo apt autoremove Clean logs : sudo journalctl --vacuum-time=1w (keeps only one week of logs)
Graphical tool : BleachBit (similar to CCleaner, but use cautiously on Linux)
To quickly identify where space is consumed, start from the home directory:
du -h --max-depth=1 ~ | sort -h5. Introduction to LVM
LVM (Logical Volume Manager) enables dynamic resizing of partitions. When the system is installed with LVM, new hard‑disk space can be merged into the existing root volume without reinstalling the OS.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Ubuntu
Focused on Ubuntu/Linux tech sharing, offering the latest news, practical tools, beginner tutorials, and problem solutions. Connecting open-source enthusiasts to build a Linux learning community. Join our QQ group or channel for discussion!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
