Everyday Guidebooks
Cover of The Linux Guide to Storage and Filesystems

Cybersecurity & IT

The Linux Guide to Storage and Filesystems

A Practical, Safety-First Guide to Partitions, Mount Points, Disk Usage, and Troubleshooting

by Todd Michael

Available now

A disk is almost full. A filesystem is not mounted where you expected. A command promises to fix the problem—but could it erase your data instead?

The Linux Guide to Storage and Filesystems helps you build the understanding to investigate before you act. Designed for new administrators and certification learners, this linux guide connects the concepts behind disks, partitions, filesystems, and mount points to practical command-line checks.

Work through guided examples to identify block devices, interpret filesystem information, trace mounts, investigate disk usage, and recognize common storage problems. Learn why output can differ between systems, when elevated privileges are needed, and which operations require special caution. Disposable lab exercises let you practice without treating a live disk as a test subject.

Whether you are preparing for an IT certification or supporting your first Linux system, you will gain a systematic approach to storage inspection—and a stronger sense of when to stop and verify.

Contents
  1. 1. Start With a Safe Storage Lab
  2. 2. How Linux Sees Storage
  3. 3. Inspect Disks and Block Devices
  4. 4. Read Partition Tables
  5. 5. Understand Filesystem Types and Metadata
  6. 6. Follow the Directory Tree to Its Mounts
  7. 7. Practice Mounting and Unmounting
  8. 8. Make Sense of Persistent Mounts
  9. 9. Measure Filesystem Capacity
  10. 10. Find Where Space Went
  11. 11. Recognize Filesystem Health Warnings
  12. 12. Understand Layers Above and Below Filesystems
  13. 13. Recognize Data-Destructive Actions
  14. 14. Apply a Repeatable Storage Investigation
  15. Other Books by Todd Michael

Read a sample: 1. Start With a Safe Storage Lab

Linux makes storage visible and manageable through a set of powerful tools. The same command line that can reveal a disk’s layout can also overwrite the information that makes its files accessible. A single incorrect device name can turn an ordinary administration task into a recovery problem.

The best place to learn is therefore not on a computer containing your only copy of important work. It is a disposable laboratory: a Linux virtual machine with a separate virtual disk that contains nothing you need to keep. In that environment, you can inspect storage, make mistakes, restore a checkpoint, and try again.

This chapter establishes that lab and a working habit that will matter throughout the book: identify the target, understand the action, and verify both before making a change. We will start with inspection rather than modification. You do not need to create a partition or format a filesystem yet.

A virtual machine, or VM, is a computer represented in software. It has its own operating system and virtual hardware, including one or more virtual disks. The VM runs on a host computer, but the two environments are not interchangeable: a command entered inside the VM ordinarily acts on what the guest operating system can see, while a command entered in a host terminal acts on the host.

For this book, use a lab with these components:

- A Linux VM that you can afford to rebuild. - A system disk containing the VM’s installed operating system. - A second, empty virtual disk used only for storage practice. - A way to restore or recreate the VM and its practice disk. - A user account that can obtain administrative privileges when needed.

A modest practice disk, such as 8 GiB, is sufficient for the introductory exercises. Choose a size that is clearly different from the VM’s system disk so that size provides one useful identifying clue. It is not, by itself, proof of identity.

The host computer needs enough available storage for the VM, the practice disk, and any snapshots or copies you create. Virtualization products handle disk allocation and snapshots differently, so consult the documentation for your chosen product before relying on its space estimates or recovery features.

Use a virtualization product with which you are comfortable, and install a mainstream Linux distribution in a new VM. A desktop or server installation can work; what matters is that you can open a terminal and access the VM’s configuration through the virtualization software.

During installation, create the ordinary virtual system disk required by the installer. Finish the installation, restart the VM, and sign in. Confirm that you know which window is the guest console and which applications belong to the host. If the virtualization product offers an option to connect physical disks or USB storage directly to the VM, leave it unused for this lab.

Avoid adding shared folders that contain valuable files unless you have a separate reason to use them and understand how the sharing is configured. A disposable guest can still have access to valuable host data through a shared folder, a network connection, or a passed-through device. “It is a VM” does not mean every resource visible to it is disposable.

Inside the guest, open a terminal and check that you are working in the environment you intended:

bash hostname pwd

The first command displays the guest’s configured hostname; the second shows the current directory. Neither proves that the environment is safe to modify, but both help you establish where you are. Consider giving the VM a recognizable name in the virtualization interface and a distinct hostname inside Linux. When multiple terminals are open, take a moment to confirm the active window before entering a command.

Shut down the guest using its normal shutdown procedure. In the virtualization product’s settings, add a new, empty virtual hard disk to the existing VM. Do not select an existing virtual disk file unless you have independently confirmed that it is disposable. Do not attach a physical disk.

Set the new disk to a distinctive capacity, such as 8 GiB, and attach it alongside—not in place of—the existing system disk. The exact menus and controller choices depend on the virtualization product. Record the disk’s configured capacity and, if the interface displays one, its virtual disk filename or other identifier. Keep this record outside the guest as well as in your lab notes.

Start the VM again. You now have two different perspectives on the same lab:

- The virtualization interface describes the virtual hardware attached to the guest. - Linux reports the storage devices it detects inside the guest.

Both perspectives are useful. Neither should be reduced to “the second disk must be the one I want.” Device ordering can change, and a guest may expose additional devices depending on its configuration.

If you are using a cloud instance, a borrowed VM, or a machine managed by someone else, do not assume that attaching or modifying a disk is permitted or reversible. Build a lab under your control, or obtain clear authorization and a disposable environment before proceeding.

Before experimenting, decide how you will return to a known state. Depending on your virtualization product, you might create a VM snapshot or checkpoint, make a copy of the powered-off VM and its virtual disks, or plan to recreate the lab from the installation media.

A checkpoint is useful only if you…

More Cybersecurity & IT

Cover of The White Hat Bible, Volume 1The White Hat Bible, Volume 1Available nowCover of The White Hat Bible, Volume 2The White Hat Bible, Volume 2Available nowCover of The White Hat Bible, Volume 3The White Hat Bible, Volume 3Available nowCover of The White Hat Bible, Volume 4The White Hat Bible, Volume 4Available nowThe White Hat Bible, Volume 5Available nowCover of The White Hat Pocket GuideThe White Hat Pocket GuideAvailable now

About Todd Michael

Todd Michael is an American author and the founder of ToddMichael.tv. He writes practical, plain-English books on money, health, preparedness, technology, games, humor and more.

About the author Todd Michael · Todd Michael’s author site

Part of the ToddMichael.tv network.