This was generated using Claude.Ai
Understanding Directories, Partitions, Filesystems & Mount Points
(Beginner level — no LVM, ZFS, RAID, clustering, etc.)Linux storage concepts often get confusing because several different things sound similar. This guide breaks them down cleanly and visually.
1) Regular Directories
A regular directory is simply a folder in the existing filesystem.Examples:
/etc
/home
/opt
/mydata
They require:
- no disks
- no partitions
- no mounts
Code:
mkdir /mydata
2) Partitions (Slices of a Disk)
A partition is a physical section of a disk.Examples:
Code:
/dev/sda1/dev/sda2/dev/nvme0n1p3
A partition isn’t usable until it is:
- Formatted with a filesystem
- Mounted somewhere
3) Filesystems
A filesystem defines how data is stored (ext4, XFS, etc.).Format a partition:
Code:
mkfs.ext4 /dev/sda2
Now it can hold files and directories.
4) Mount Points
A mount point is a directory where a filesystem becomes visible.Example:
Code:
mkdir /mnt/datamount /dev/sda2 /mnt/data
After mounting:
- /mnt/data shows the content of /dev/sda2
- Anything previously inside /mnt/data is hidden until unmounted
Code:
umount /mnt/data
5) Directories With Their Own Partition
Some directories get their own partition:- /home
- /var
- /boot
- /data
- Prevent /var logs from filling up /
- Reinstall OS without deleting /home
- Improve isolation and stability
Code:
UUID=123e4567-89ab-cdef-0000-111122223333 /home ext4 defaults 0 2
This tells the system to mount that filesystem at boot.
6) ASCII Diagrams (Color Enhanced)
A) Single partition system
Disk: /dev/sda└── Partition: /dev/sda1
└── Filesystem: ext4
└── / (root filesystem)
├── /etc
├── /home
├── /opt
└── /mydata
B) Separate /home partition
Disk: /dev/sda├── /dev/sda1 → /
│ ├── /etc
│ ├── /opt
│ └── /var
└── /dev/sda2 → /home
├── user1/
└── user2/
C) What mounting does (before/after)
Before:/mnt/data (empty directory)
Mount:
Code:
mount /dev/sdb1 /mnt/data
After:
/mnt/data (shows filesystem on /dev/sdb1)
7) File Colors in ls Output
Terminal colors help identify file types quickly.Directories
blue — e.g., drwxr-xr-xExecutable files
green — files with the executable bit (chmod +x)Symbolic links
cyan — e.g., lrwxrwxrwxBroken links may appear as bright red.
Archives / compressed files
red — .tar .gz .bz2 .xz .zip .rar .7zImages & media
magenta — .jpg .png .gif .svg .mp3 .mp4 .mkvDevice files
yellow — block & char devices under /devPipes (FIFOs)
yellow — prw-r--r--Sockets
bright green — srwxrwxrwxSetuid / Setgid executables
Setuid → red backgroundSetgid → yellow background
File Color Quick Map (ASCII)
Blue → DirectoryGreen → Executable
Cyan → Symlink
Red → Archive / compressed
Magenta → Media
Yellow → Devices / FIFOs
Bright Green → Socket
Red BG → Setuid
Yellow BG → Setgid
8) Practice Exercise
Create, format, mount, and inspect:
Code:
mkdir /mnt/datamkfs.ext4 /dev/sdb1mount /dev/sdb1 /mnt/datals -l --color=auto / /mnt /mnt/data
Unmount when done:
Code:
umount /mnt/data
Last edited:

