Linux Mastery
The Human Knowledge Project
Chapter 02 — Linux Filesystems and Storage
Why This Chapter Matters
Every file you create, every program you install, and every device you connect eventually becomes part of the Linux filesystem.
Understanding how Linux organizes information is one of the most important steps toward becoming a confident Linux user.
Rather than memorizing directory names, you'll learn the underlying structure that makes the entire operating system logical and predictable.
Introduction
One of the most important ideas in Linux is that the operating system organizes information into a single unified filesystem structure beginning at the root directory:
/
Everything in Linux exists somewhere beneath this root.
Programs, documents, hardware devices, logs, configuration files, temporary files, removable drives, and even many system interfaces appear as part of this filesystem hierarchy.
Understanding the Linux filesystem is one of the first major steps toward becoming comfortable with Linux itself.
Unlike some operating systems that separate storage into independent drive letters, Linux presents storage as a connected tree-like structure. Devices and partitions are attached to this structure through a process known as mounting.
In this chapter, you will:
- explore...
- examine...
- learn...
- explore important Linux directories
- examine filesystems and storage devices
- learn how Linux handles drives and partitions
- investigate mounting and unmounting
- observe hardware devices represented as files
- explore temporary and persistent storage
- begin building a mental map of Linux system organization
As you work through this chapter:
- type commands manually
- experiment intentionally
- observe outputs carefully
- ask questions constantly
- make mistakes safely
- revisit exercises whenever necessary
- type commands manually
- intentionally experiment
- observe outputs carefully
- ask questions constantly
- make mistakes safely
- revisit exercises repeatedly
Linux proficiency develops through interaction, experimentation, troubleshooting, and observation.
1. The Root Filesystem
The Linux filesystem begins at:
/
This is called:
- root directory
- root filesystem
- filesystem root
Everything else exists beneath this point.
Example:
/
├── home
├── etc
├── boot
├── dev
├── var
└── usr
Unlike systems that use separate drive letters such as:
C:
D:
E:
Linux presents storage as one connected hierarchical tree. Once you understand this single idea, navigating Linux becomes far more intuitive because every file and every device has a logical place within the same hierarchy.
Additional drives are attached to this structure through mount points.
2. Important Linux Directories
Linux systems organize files into specialized directories.
Students should begin gradually becoming familiar with these locations.
| Directory | Purpose |
| --------- | ------------------------------- |
| / | filesystem root |
| /home | user files and home directories |
| /etc | system configuration files |
| /boot | bootloader and kernel files |
| /dev | hardware device files |
| /var | logs and changing system data |
| /usr | applications and utilities |
| /tmp | temporary files |
| /media | removable media mount points |
| /mnt | temporary manual mounts |
| /proc | kernel and process information |
| /sys | hardware and kernel interfaces |
Students are NOT expected to memorize every directory immediately.
The goal is gradual familiarity through repeated exposure.
3. /home — User Files
Most personal files are stored beneath:
/home
Each user normally has a separate home directory.
Example:
/home/norm
Home directories often contain:
- documents
- downloads
- music
- pictures
- scripts
- projects
- hidden configuration files
Examples of hidden files:
.bashrc
.profile
.config
.cache
These hidden files often contain:
- preferences
- settings
- startup configurations
- application data
- shell customizations
Linux hides these files by convention using a leading period (.) to reduce clutter while still allowing advanced users direct access when needed.
4. /etc — System Configuration
/etc contains many important Linux configuration files.
Examples include:
- network settings
- user account information
- startup services
- package manager settings
- mount configuration
- security settings
- hostname information
Examples
/etc/fstab
/etc/hosts
/etc/passwd
/etc/ssh
Linux systems rely heavily on readable text-based configuration files. This transparency allows administrators to:
- inspect configurations
- edit settings directly
- automate systems
- troubleshoot problems
- backup configurations easily
Most ordinary users should NOT store personal files inside /etc.
/etc is intended specifically for:
- operating system configuration
- application configuration
- service configuration
Improper modification of files inside /etc can sometimes:
- break networking
- prevent booting
- disable services
- create security problems
Students should explore carefully and gradually become comfortable reading configuration files before attempting major edits.
5. /boot — Boot Files
/boot contains files used during system startup.
Examples include:
- Linux kernels
- initramfs images
- GRUB configuration
- bootloader support files
Without these files Linux may fail to boot properly.
Students should understand:
BIOS/UEFI
→ GRUB
→ Linux kernel
→ systemd
→ desktop/services
This startup sequence is extremely important.
6. /dev — Devices as Files
One of the most unusual and important Linux concepts is:
“Everything is a file.”
Linux represents many hardware devices as files beneath:
Terminal Unmounting Exercises
Connect a USB thumb drive if available.
Observe whether Linux automatically mounts the device.
Run:
mount
Locate the mounted USB device.
Identify:
device name
filesystem type
mount point
Why does Linux attach removable storage through mount points?
Run:
lsblk
Locate the removable device.
Why are:
physical device
partition
filesystem
mount point
separate concepts?
Safely unmount the device using the terminal.
Example:
sudo umount /media/norm/MyUSB
OR:
sudo umount /dev/sdb1
Why is the command:
umount
instead of:
unmount
What happens to the mount point after unmounting?
Why is safe unmounting important?
What problems can occur if removable storage is disconnected improperly?
Why are flash drives more vulnerable to corruption when writes are incomplete?
GUI Unmounting Exercises
Reconnect the removable USB device.
Open the Linux Mint file manager.
Locate the removable device in the left panel/sidebar.
Observe the symbol beside the device name.
Students may see symbols such as:
eject
safely remove
unmount
Click the unmount/eject symbol beside the device.
Observe what changes in the file manager.
Why does the device disappear from active mounts after unmounting?
Why is GUI unmounting performing the same fundamental operation as terminal umount?
Why is it dangerous to simply unplug removable storage without unmounting?
Why might incomplete writes cause:
corruption
lost files
damaged filesystems?
Compare:
terminal unmounting
GUI unmounting
How are they:
similar?
different?
Which method feels more intuitive?
Why should Linux users eventually understand both methods?
Observation and Reflection Questions
Why does Linux treat storage devices as mounted filesystems instead of separate drive letters?
Why is mounting considered one of the foundational Linux concepts?
Why are removable drives often mounted beneath:
/media
Why does Linux expose so much filesystem and storage information openly?
Why are Linux systems often considered highly observable and transparent?
/dev
Examples
/dev/sda
/dev/sda1
/dev/nvme0n1
/dev/tty
These may represent:
- hard drives
- partitions
- terminals
- USB devices
- hardware interfaces
Linux programs often interact with devices through these filesystem interfaces.
This is a major Unix/Linux design philosophy.
TTY Devices
One important type of device found beneath /dev is:
tty
Originally, tty stood for:
teletypewriter
Early Unix systems were accessed through electromechanical text terminals and serial devices rather than modern graphical displays. The name survived into modern Linux systems.
Today, tty devices usually represent:
- terminal sessions
- text consoles
- shell interfaces
- pseudo terminals
Examples
/dev/tty
/dev/tty1
/dev/tty2
/dev/pts/0
Linux can support multiple terminal sessions simultaneously.
Modern graphical terminal windows often use:
/dev/pts/*
These are called:
- pseudo terminals
- pseudo-TTYs
Students can display their current terminal device using:
tty
Example output:
/dev/pts/0
This means the shell session is attached to pseudo-terminal 0.
TTY concepts remain important throughout Linux because terminal devices are still central to:
- shell operation
- remote access
- SSH sessions
- login systems
- process management
- system recovery
/dev Is Not General Storage
Although /dev appears within the filesystem hierarchy, it is not intended for ordinary file storage.
/dev primarily contains special device files representing:
- drives
- partitions
- terminals
- hardware interfaces
- virtual devices
Programs interact with hardware through these interfaces.
Users generally should NOT store ordinary documents or projects inside /dev.
7. Filesystems
A filesystem determines how data is:
- organized
- stored
- indexed
- retrieved
Different filesystems are designed for different goals.
Some prioritize:
- compatibility
- performance
- reliability
- recovery
- large-file support
- Linux features
- cross-platform use
Filesystems and Formatting
Before a storage device can reliably store files, it usually must be formatted with a filesystem.
Formatting prepares the storage area by creating the structures the operating system uses to:
- store files
- organize directories
- track free space
- manage permissions
- maintain metadata
Without formatting, the operating system does not know how data should be organized on the device.
Formatting does NOT physically destroy a drive. Instead, it creates or replaces the organizational structures used to manage data on the device.
Students should clearly distinguish between:
- physical storage devices
- partitions
- filesystems
- mount points
These are separate layers within Linux storage architecture.
Example:
Physical Device:
/dev/sdb
Partition:
/dev/sdb1
Filesystem:
ext4
Formatting Command:
mkfs.ext4 /dev/sdb1
This formats the partition using the ext4 filesystem so Linux can:
- store files
- organize directories
- track permissions
- manage free space
- mount the filesystem
Different filesystems solve different engineering problems.
Examples
| Filesystem | Common Usage |
| ---------- | -------------------------------------- |
| ext4 | Linux SSDs and HDDs |
| exfat | USB thumb drives and removable storage |
| ntfs | Windows systems and compatibility |
| fat32 | older compatibility devices |
| xfs | enterprise/high-performance storage |
| btrfs | snapshots and advanced recovery |
Students should understand why different filesystems are often chosen for different tasks.
For example:
- ext4 is commonly used for Linux installations because it is stable and integrates well with Linux permissions and journaling
- exfat is commonly used for USB thumb drives because it works well across Linux, Windows, and macOS
- ntfs is often used when sharing storage with Windows systems
- fat32 is still used for compatibility with cameras, embedded systems, and older hardware
Formatting is a major operation because creating a new filesystem often replaces previous filesystem structures and may make old data inaccessible.
ext4
ext4 is one of the most common Linux filesystems.
It is widely used for:
- Linux SSDs
- Linux HDDs
- workstations
- servers
Advantages:
- stable
- mature
- reliable
- journaling support
- strong Linux compatibility
Often recommended for:
- Linux system drives
- general Linux storage
xfs
xfs is commonly used in:
- enterprise systems
- servers
- large storage arrays
Advantages:
- high performance
- scalability
- large filesystem support
Often preferred for:
- large servers
- enterprise workloads
- high-throughput storage
btrfs
btrfs includes advanced features such as:
- snapshots
- checksumming
- rollback support
- advanced volume management
Advantages:
- advanced recovery features
- snapshot capability
- flexible storage management
Possible disadvantages:
- greater complexity
- some features still evolving
Common in:
- advanced Linux systems
- snapshot-based recovery systems
fat32
fat32 is an older compatibility filesystem.
Advantages:
- supported almost everywhere
- works with Windows, Linux, cameras, game consoles, embedded devices
Disadvantages:
- file size limitations
- lacks journaling
- limited permissions/security features
Often used for:
- small USB drives
- compatibility devices
exfat
exfat is commonly used for:
- USB thumb drives
- SD cards
- removable media
Advantages:
- excellent cross-platform compatibility
- supports large files
- modern removable media support
Very useful when transferring files between:
- Linux
- Windows
- macOS
Often preferred for:
- flash drives
- portable storage
ntfs
ntfs is the primary Windows filesystem.
Linux can usually:
- read
- write
- mount
NTFS filesystems.
Useful for:
- dual-boot systems
- shared Windows/Linux storage
Not usually preferred as the primary Linux filesystem because Linux-native filesystems often integrate more cleanly with Linux permissions and features.
Journaling
Many modern filesystems use:
- journaling
A journal helps track filesystem changes before they are fully written.
This can help reduce:
- corruption
- recovery problems
- filesystem damage
especially after:
- power failures
- crashes
- improper shutdowns
Journaling is one reason modern Linux filesystems are often very reliable.
Many modern filesystems use:
journaling
A journal is a special record that tracks filesystem changes before they are fully written to storage.
The filesystem first records:
what changes are about to occur
Then:
performs the actual write operations.
If the system crashes or loses power during these operations, the journal helps the filesystem:
recover consistency
replay incomplete operations
reduce corruption
Journaling greatly improves reliability, especially after:
crashes
freezes
sudden shutdowns
power failures
Journaling does not guarantee zero data loss, but it significantly improves filesystem recovery behavior and stability.
Filesystems such as:
ext4
xfs
ntfs
support journaling, while older compatibility filesystems such as:
fat32
generally do not.
This is one reason Linux filesystems such as ext4 are often considered highly reliable for Linux installations and long-term storage use.
Recovery Behavior
Different filesystems behave differently after:
- crashes
- power loss
- corruption
- hardware failures
Some filesystems prioritize:
- speed
while others prioritize:
- recovery
- integrity
- fault tolerance
This is part of filesystem engineering tradeoffs.
Students should understand that filesystems are engineering choices, not simply storage “formats.”
Different filesystems are optimized for different goals.
---|---|
| ext4 | common Linux default |
| xfs | enterprise/server use |
| btrfs | advanced snapshots/features |
| fat32 | compatibility filesystem |
| ntfs | Windows filesystem |
| exfat | removable storage |
Different filesystems have different strengths:
- performance
- reliability
- journaling
- compatibility
- recovery behavior
Recursive Operations and -R
One of the most important concepts in Linux and computing generally is:
recursion
Recursion means:
- repeating an operation through nested structures
- moving downward through layers or branches automatically
Linux filesystems naturally form hierarchical tree structures:
/
├── home
│ ├── norm
│ └── guest
├── etc
├── dev
└── var
Some directories contain:
- files
- subdirectories
- additional nested subdirectories
Linux commands can sometimes operate:
- only on one directory level
OR
- recursively through entire directory trees.
Example: ls /dev
Command:
ls /dev
This displays only the immediate contents of:
/dev
It does NOT automatically enter subdirectories.
Example: ls -R /dev
Command:
ls -R /dev
The option:
-R
means:
Recursive
This tells Linux to:
- list
/dev - enter subdirectories
- list their contents
- continue recursively downward
Example:
/dev:
pts
shm
sda
/dev/pts:
0
1
Why Recursion Matters
Recursive operations are extremely powerful because Linux systems often contain deeply nested directory structures.
Recursion is commonly used for:
- searching files
- copying directory trees
- deleting nested files
- changing permissions
- backups
- indexing
- filesystem analysis
Many Linux commands support recursive operation through options such as:
-R
-r
--recursive
depending on the command.
Important Warning
Recursive commands can generate:
- extremely large outputs
- huge numbers of file operations
- accidental damage if used carelessly
For example:
rm -R
can recursively delete entire directory trees.
Students should therefore:
- experiment carefully
- read documentation
- understand recursive behavior before using destructive commands
Learning Through Observation
Students are encouraged to compare:
ls /dev
with:
ls -R /dev
Questions:
- What changes between outputs?
- Which directories contain subdirectories?
- Why does recursive output become much larger?
- Why might recursion be powerful in system administration?
Recursion is one of the foundational concepts that appears repeatedly throughout Linux, programming, scripting, filesystems, and systems administration.
8. Mounting and Unmounting
Linux attaches storage devices to the filesystem using:
mount points.
This process is called:
mounting.
Example:
A USB drive may appear at:
/media/norm/MyUSB
after being mounted.
Removing a device safely often requires:
unmounting.
This helps prevent:
- corruption
- incomplete writes
- filesystem damage
Commands
mount
umount
Students should notice:
The command is:
umount
NOT:
unmount
This reflects older Unix naming conventions.
GUI Unmounting
Linux graphical file managers usually provide:
- eject
- safely remove
- unmount
options when removable drives are connected.
Students should learn to:
- safely unmount drives
- wait for write activity to complete
- avoid removing storage devices abruptly
Improper removal can cause:
- data corruption
- incomplete writes
- damaged filesystems
- lost files
This is important whether unmounting occurs:
- through terminal
- through graphical tools
9. Temporary vs Persistent Storage
Linux systems use both temporary and persistent storage locations.
Example:
/tmp
is often used for temporary files.
Files there may disappear after reboot.
Persistent storage includes:
/home
/etc
/var
These typically survive reboot.
Understanding the difference is important for:
- troubleshooting
- scripting
- backups
- system administration
10. Logs and /var
Linux systems store many logs beneath:
/var/log
Logs help administrators:
- diagnose problems
- investigate crashes
- monitor services
- examine security events
Examples
| File | Purpose |
| --------- | --------------------- |
| syslog | general system logs |
| dmesg | kernel messages |
| auth.log | authentication events |
| boot logs | startup information |
Linux systems are highly observable because so much operational information is stored in logs.
Viewing Logs
Examples
dmesg
- Displays kernel messages.
journalctl
Displays systemd logs.
tail -f logfile
Monitors logs in real time.
Logs are extremely valuable for:
- troubleshooting
- diagnosing crashes
- hardware analysis
- networking problems
- boot failures
- service debugging
Linux systems are often highly observable because they expose so much operational information through logs.
---|---|
| syslog | general system logs |
| dmesg | kernel messages |
| auth.log | authentication events |
| boot logs | startup information |
Linux systems are highly observable because so much operational information is stored in logs.
11. Devices, Partitions, and Storage Types
Linux supports many kinds of storage:
- SATA drives
- NVMe drives
- USB storage
- SSDs
- HDDs
- network storage
Examples
/dev/sda
/dev/sdb
/dev/nvme0n1
Students should clearly distinguish between:
- physical devices
- partitions
- filesystems
- mount points
These are separate layers.
Example:
Physical Device:
/dev/nvme0n1
Partition:
/dev/nvme0n1p1
Filesystem:
ext4
Mounted At:
/
This means:
- the physical NVMe drive contains partitions
- a partition contains a filesystem
- the filesystem is attached (mounted) into the Linux directory tree
These layers are extremely important because Linux systems manage storage through this layered architecture.
Understanding these distinctions becomes essential for:
- installing Linux
- troubleshooting boot problems
- repairing filesystems
- managing multiple drives
- dual-boot systems
- backups
- recovery operations
- partition resizing
- removable media management
Students should gradually become comfortable recognizing the relationship between these storage layers.
12. UUIDs and Stable Mounting
Linux often identifies storage devices using:
UUIDs
(UUID = Universally Unique Identifier)
This helps Linux identify filesystems reliably even if device names change.
Example:
/dev/sda
might become:
/dev/sdb
if hardware order changes.
UUIDs help prevent incorrect mounting.
Students will encounter UUIDs inside:
/etc/fstab
later in the course.
13. Exploring Linux Safely
Students are encouraged to:
- explore directories
- observe files
- read documentation
- investigate command output
without fear.
Most read-only exploration is safe.
Examples
ls
- cat
- less
man
pwd
are excellent learning tools.
Students should avoid modifying unfamiliar system files until they better understand the system.
14. Learning Through Observation
Linux proficiency develops gradually.
Students should:
- compare outputs
- notice patterns
- examine directories
- ask why files exist
- investigate unfamiliar terms
- observe naming conventions
Linux systems often reveal their structure openly.
This transparency is one reason Linux is such a powerful educational environment.
Chapter 02 — Problem Set
Warm-Up Exercises
1. Open the terminal.
2. Display your current directory using:
pwd
3. Move to the root directory:
cd /
4. List contents of the root directory.
5. Return to your home directory.
6. Verify your location.
7. List all files including hidden files.
8. Identify several hidden files.
9. Why are some files hidden?
10. Why might hidden files be useful?
Filesystem Exploration Exercises
11. Explore:
/home
12. Explore:
/etc
13. Explore:
/boot
14. Explore:
/dev
15. Explore:
/var
16. What kinds of files appear in each directory?
17. Which directories seem most important?
18. Which directories seem most confusing?
19. Why might Linux organize files this way?
20. Why is a hierarchical filesystem useful?
Hidden File Exercises
21. Run:
ls
22. Then:
ls -a
23. Compare outputs.
24. How many additional files appeared?
25. Locate files beginning with:
.
26. Why are these files hidden?
27. Why are they still important?
28. Research:
.bashrc
29. What might it control?
30. Why are user settings often stored as text files?
man Exercises
31. Open:
man ls
32. Search for:
-a
33. What does the option do?
34. Search for:
-l
35. What does it do?
36. Exit the manual.
37. Why is built-in documentation important?
38. Why are Linux users not expected to memorize everything?
39. Why might command documentation initially feel overwhelming?
40. Why is learning how to search documentation an important skill?
Device Exploration Exercises
41. Run:
ls /dev
42. Locate device names.
43. Why does Linux represent devices as files?
44. What advantages might this provide?
45. Locate:
/dev/sd*
46. Locate:
/dev/nvme*
47. What differences do you observe?
48. Why might naming conventions matter?
Storage Exercises
49. Run:
lsblk
50. Observe storage devices.
51. Identify:
- drives
- partitions
- mount points
52. Which device appears to contain your Linux installation?
53. Run:
df -h
54. Observe filesystem usage.
55. Which filesystem is mounted at:
/
56. Which filesystems appear temporary?
57. Why might Linux separate filesystems?
58. Why might different filesystems exist?
Mounting Exercises
59. Run:
mount
60. Observe mounted filesystems.
61. Why are so many mounts present?
62. Why might Linux use many separate mounted filesystems internally?
63. Which mounts appear related to:
- storage devices
- temporary filesystems
- system services
- virtual filesystems
64. Why are some mounted filesystems not physical drives?
65. Locate removable media if available.
66. Why does Linux use mount points?
67. Why is safe unmounting important?
68. Why is the command named:
umount
instead of:
unmount
69. What does this reveal about Unix/Linux history?
70. Why might modern operating systems internally use many mounted filesystems even when users only see a simple desktop interface?
Recursion Exercises
71. Run:
ls /dev
72. Observe the output.
73. Then run:
ls -R /dev
74. What changed?
75. What does:
-R
appear to do?
76. Why does recursive output become much larger?
77. Why might recursion be powerful?
78. Why might recursive commands become dangerous if used carelessly?
79. Research:
man ls
80. Locate the explanation for:
-R
81. What does the manual say about recursive listing?
82. Why is recursion an important computing concept?
Log Exploration Exercises
67. Explore:
/var/log
68. Identify several log files.
69. Why are logs important?
70. Why do administrators rely heavily on logs?
71. Why are Linux systems considered highly observable?
72. Why might logs become extremely important during troubleshooting?
Reflection Questions
73. Why does Linux use a single filesystem hierarchy?
74. Why are hidden files useful?
75. Why are Linux systems heavily text-oriented?
76. Why does Linux represent devices as files?
77. Why might Linux workflows rely on many small tools?
78. Why are logs important?
79. Why are mount points useful?
80. Which filesystem concepts still seem confusing?
81. Which filesystem concepts seem most interesting?
82. What questions do you still have?
Terminal Unmounting Exercises
83. Connect a USB thumb drive if available.
84. Observe whether Linux automatically mounts the device.
85. Run:
mount
86. Locate the mounted USB device.
87. Identify:
- device name
- filesystem type
- mount point
88. Why does Linux attach removable storage through mount points?
89. Run:
lsblk
90. Locate the removable device.
91. Why are:
- physical device
- partition
- filesystem
- mount point
separate concepts?
92. Safely unmount the device using the terminal.
Example:
sudo umount /media/norm/MyUSB
OR:
sudo umount /dev/sdb1
93. Why is the command:
umount
instead of:
unmount
94. What happens to the mount point after unmounting?
95. Why is safe unmounting important?
96. What problems can occur if removable storage is disconnected improperly?
97. Why are flash drives more vulnerable to corruption when writes are incomplete?
GUI Unmounting Exercises
98. Reconnect the removable USB device.
99. Open the Linux Mint file manager.
100. Locate the removable device in the left panel/sidebar.
101. Observe the symbol beside the device name.
Students may see symbols such as:
- eject
- safely remove
- unmount
- corruption
- lost files
- damaged filesystems?
- terminal unmounting
- GUI unmounting
102. Click the unmount/eject symbol beside the device.
103. Observe what changes in the file manager.
104. Why does the device disappear from active mounts after unmounting?
105. Why is GUI unmounting performing the same fundamental operation as terminal umount?
106. Why is it dangerous to simply unplug removable storage without unmounting?
107. Why might incomplete writes cause:
108. Compare:
How are they:
- similar?
- different?
109. Which method feels more intuitive?
110. Why should Linux users eventually understand both methods?
Observation and Reflection Questions
111. Why does Linux treat storage devices as mounted filesystems instead of separate drive letters?
112. Why is mounting considered one of the foundational Linux concepts?
113. Why are removable drives often mounted beneath:
/media
114. Why does Linux expose so much filesystem and storage information openly?
115. Why are Linux systems often considered highly observable and transparent?
Chapter 02 — Answer Key
(Answer keys and walkthroughs will continue expanding throughout the course.)