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:

As you work through this chapter:

Linux proficiency develops through interaction, experimentation, troubleshooting, and observation.


1. The Root Filesystem

The Linux filesystem begins at:

/

This is called:

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:

Examples of hidden files:

.bashrc

.profile

.config

.cache

These hidden files often contain:

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:


/etc/fstab
/etc/hosts
/etc/passwd
/etc/ssh

Linux systems rely heavily on readable text-based configuration files. This transparency allows administrators to:

Most ordinary users should NOT store personal files inside /etc.

/etc is intended specifically for:

Improper modification of files inside /etc can sometimes:

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:

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:

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:


/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:

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:

Although /dev appears within the filesystem hierarchy, it is not intended for ordinary file storage.

/dev primarily contains special device files representing:

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:

Different filesystems are designed for different goals.

Some prioritize:

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:

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:

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:

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:

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:

Advantages:

Often recommended for:

xfs is commonly used in:

Advantages:

Often preferred for:

btrfs includes advanced features such as:

Advantages:

Possible disadvantages:

Common in:

fat32 is an older compatibility filesystem.

Advantages:

Disadvantages:

Often used for:

exfat is commonly used for:

Advantages:

Very useful when transferring files between:

Often preferred for:

ntfs is the primary Windows filesystem.

Linux can usually:

NTFS filesystems.

Useful for:

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:

A journal helps track filesystem changes before they are fully written.

This can help reduce:

especially after:

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:

Some filesystems prioritize:

while others prioritize:

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:


Recursive Operations and -R

One of the most important concepts in Linux and computing generally is:

recursion

Recursion means:

Linux filesystems naturally form hierarchical tree structures:


/
├── home
│   ├── norm
│   └── guest
├── etc
├── dev
└── var

Some directories contain:

Linux commands can sometimes operate:

OR

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:

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:

Many Linux commands support recursive operation through options such as:


-R
-r
--recursive

depending on the command.

Important Warning

Recursive commands can generate:

For example:


rm -R

can recursively delete entire directory trees.

Students should therefore:

Students are encouraged to compare:


ls /dev

with:


ls -R /dev

Questions:

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:


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:

options when removable drives are connected.

Students should learn to:

Improper removal can cause:

This is important whether unmounting occurs:


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:


10. Logs and /var

Linux systems store many logs beneath:

/var/log

Logs help administrators:

| 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

journalctl

Displays systemd logs.


tail -f logfile

Monitors logs in real time.

Logs are extremely valuable for:

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:


/dev/sda
/dev/sdb
/dev/nvme0n1

Students should clearly distinguish between:

These are separate layers.

Example:

Physical Device:


/dev/nvme0n1

Partition:


/dev/nvme0n1p1

Filesystem:


ext4

Mounted At:


/

This means:

These layers are extremely important because Linux systems manage storage through this layered architecture.

Understanding these distinctions becomes essential for:

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:

without fear.

Most read-only exploration is safe.

Examples


ls

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:

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:


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:

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:


lsblk

90. Locate the removable device.

91. Why are:

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:

How are they:


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.)