Managing Storage on the Desktop

Managing Storage on the Desktop

Bitnesia • Aug 18, 2026 130 •ID

Storage is where we save data, and managing it well is an essential skill for Linux users. Whether checking disk space, mounting a flash drive, or configuring partitions, Linux provides a variety of commands and graphical applications. This chapter covers how to view disk information, mount removable media, perform basic partition management, and introduces LVM and Btrfs.

40.1 Viewing Disk Information

Before managing storage, we need to know the condition of the disks attached to the system.

40.1.1 lsblk: List Block Devices

The lsblk command displays all block devices, such as hard disks, SSDs, and partitions, in a tree format.

lsblk

Its output shows device names, sizes, and mount points, allowing us to quickly view the disk structure. In practice, add the -f option so that lsblk also displays the filesystem type and UUID of each partition, which is useful when preparing /etc/fstab entries (discussed in Chapter 13):

lsblk -f

40.1.2 fdisk -l: Partition Information

To view detailed partition information, use fdisk -l.

sudo fdisk -l

This command displays the partition table along with the filesystem type on each disk.

40.1.3 df -h: Disk Usage

df displays used and available space on each filesystem. The -h option makes the sizes human-readable.

df -h

Do not be surprised if the df -h output also displays lines like tmpfs or overlay among the list of physical disks. These filesystems are virtual and run in RAM rather than on actual disks, so they can be ignored when checking physical storage space.

40.1.4 du -sh: Directory Size

To find out the size of a directory, use du.

du -sh /home/user/Documents

The -s option displays a total summary, while -h displays the size in an easily readable format.

40.1.5 Disks (GNOME): GUI for Disk Management

For those who prefer a graphical interface, GNOME's built-in Disks application displays all disks along with their partitions. From there, we can inspect disk information, modify filesystems, and perform other basic operations.

40.2 Mounting Removable Media

We need to mount removable media such as flash drives so that their content can be accessed.

40.2.1 USB Flash Drives: Automatic and Manual

On modern desktops, flash drives are usually mounted automatically when plugged in and appear in the Files application. The system mounts them in directories like /media/user/. To mount them manually, use the mount command.

sudo mount /dev/sdb1 /mnt

To unmount them, use umount.

sudo umount /mnt

Always unmount media before unplugging it to prevent data corruption. If a target is busy message appears, refer to the more detailed mount/umount troubleshooting discussion in Chapter 13.

40.2.2 DVD/Optical Drives

DVDs and other optical media are also mounted in the same manner. Once inserted, the media is typically mounted automatically and can be accessed through Files.

40.3 Basic Partition Management

Partitioning divides a disk into several sections that can be managed separately.

40.3.1 fdisk: MBR Partitioning

fdisk is a text-based tool for managing MBR partitions, and it comes pre-installed on both Ubuntu and Fedora. To open a disk, run:

sudo fdisk /dev/sdb

Inside fdisk, we can type m to view help, p to display the partition table, n to create a new partition, and w to write changes. Be careful, as writing changes can erase data.

After writing changes with w, the kernel does not always immediately re-read the new partition table. Run sudo partprobe so the system recognizes new partitions without requiring a reboot. Newly created partitions are also still empty and do not have a filesystem yet, so they must be formatted before they can be mounted, for example with sudo mkfs.ext4 /dev/sdb1.

40.3.2 gdisk: GPT Partitioning

For disks with a GPT partition table, use gdisk. Unlike fdisk, gdisk is usually not installed by default, so it needs to be installed first:

sudo apt install gdisk

On Fedora, use:

sudo dnf install gdisk

Once installed, the commands and workflow are similar to fdisk.

sudo gdisk /dev/sdb

GPT is a modern standard that supports large-capacity disks and a greater number of partitions.

40.3.3 GParted: GUI Partition Editor

GParted is an easy-to-use graphical partition editor. Install it with sudo apt install gparted on Ubuntu or sudo dnf install gparted on Fedora, then run it. GParted allows us to create, delete, resize, and move partitions through a visual interface. Note that GParted's support for resizing Btrfs partitions is still more limited compared to ext4, so for Btrfs partitions, it is recommended to use the built-in btrfs tool or exercise caution when resizing via GParted. One often overlooked point: partitions that are actively in use, including the running system partition, cannot be resized via GParted. To resize the root partition, we typically need to boot from a live USB first.

40.4 Introduction to Logical Volume Manager (LVM): Concepts

LVM (Logical Volume Manager) is a layer between physical partitions and filesystems that provides greater flexibility in managing storage. Instead of being tied to fixed partitions, LVM allows us to create logical volumes that can be easily expanded or shrunk, even without shutting down the system.

Its main concepts are physical volumes (disks or partitions), volume groups (collections of physical volumes), and logical volumes (the resulting volumes that are mounted as filesystems). LVM is widely used on servers, and both Ubuntu and Fedora support it during installation.

If our system uses LVM (for example, by selecting that option during installation), we can view its structure without changing anything using the following commands:

sudo pvs
sudo vgs
sudo lvs

These three commands respectively display summaries of the physical volumes, volume groups, and logical volumes present on the system. If these commands are not found (command not found), it means the lvm2 package is not yet installed, and it is very likely that the system does not use LVM.

40.5 Introduction to Btrfs Subvolumes and Snapshots

Btrfs is a modern filesystem that supports advanced features like subvolumes and snapshots.

  • Subvolumes are parts of a filesystem that can be managed independently, similar to directories but with extended capabilities.
  • Snapshots are copies of a filesystem's state at a specific point in time, useful for restoring the system if issues occur.

Fedora Workstation 44 uses Btrfs as the default filesystem since Fedora 33, and this remains true today. During a standard installation, Anaconda (the Fedora installer) automatically creates two subvolumes, namely root (mounted at /) and home (mounted at /home), on top of a single Btrfs pool. XFS itself remains available as a manual choice during installation and is the default for Fedora Server, but it is not the default on the Workstation edition covered in this series.

We can check if our running Fedora system uses Btrfs along with its subvolumes by running:

findmnt /
sudo btrfs subvolume list /

Note that a standard Btrfs installation on Fedora does not automatically create a snapshot every time we run dnf update. To enable automatic snapshots before and after system updates (similar to the rollback feature in openSUSE), we need to install and configure Snapper separately:

sudo dnf install snapper

On Ubuntu, the default filesystem remains ext4, and Btrfs is only available as an experimental option during manual installation, making the subvolume and snapshot material in this section more relevant to Fedora users.

In this chapter, we learned how to check disk space, mount removable media, perform basic partition management, and were introduced to LVM and Btrfs subvolumes/snapshots. In the next chapter, we will study hardware and drivers to understand the devices operating behind the Linux system.