Red Hat System Administration I · RH124

Chapter 14

Accessing Removable Media
Mounting & unmounting · lsblk & blkid · Automount · Safe removal
CIS126RH — Mesa Community College

Chapter Objective

Identify, mount, use, and safely remove removable storage media such as USB drives from the command line and the graphical desktop.

Key Commands

  • lsblk
  • blkid
  • mount
  • umount
  • eject

The Mounting Concept

Linux doesn't use drive letters. Instead, a storage device's filesystem is mounted — attached — at a chosen point in the single filesystem tree, called a mount point. Once mounted, files on that device appear as an ordinary subdirectory, indistinguishable in normal use from any other part of the tree.

Why It Matters — This is why plugging in a USB drive on Linux doesn't create a new "drive letter" the way it might elsewhere — it shows up as a directory somewhere under the existing tree, commonly under /run/media/username/ when auto-mounted by the desktop.

Identifying Removable Devices

Before mounting anything manually, confirm the device name the kernel assigned it.

# List block devices in a tree, showing partitions and mount points
lsblk

# Example output
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda       8:0    0   20G  0 disk
├─sda1    8:1    0    1G  0 part /boot
└─sda2    8:2    0   19G  0 part /
sdb       8:16   1   32G  0 disk
└─sdb1    8:17   1   32G  0 part

# Show filesystem type and label/UUID for each device
blkid

# Show only currently mounted filesystems
findmnt
Tip — RM Column Marks Removable — In lsblk output, a 1 in the RM (removable) column is your quickest visual cue that a device is removable media rather than a fixed internal disk — helpful for confirming you're about to act on the right device.
Warning — Double-Check the Device Name — Running a destructive command against the wrong block device (for example, your internal disk instead of the USB drive) can destroy data instantly and irreversibly. Always confirm with lsblk before referencing a device like /dev/sdb in any command.

Manually Mounting and Unmounting

# Create a mount point if one doesn't already exist
sudo mkdir -p /mnt/usbdrive

# Mount a partition at that mount point
sudo mount /dev/sdb1 /mnt/usbdrive

# Confirm it mounted successfully
df -h /mnt/usbdrive

# Work with files normally, as though it were any other directory
ls /mnt/usbdrive

# Unmount when finished — always do this before removing the device
sudo umount /mnt/usbdrive

# Alternative: unmount by mount point OR by device name
sudo umount /dev/sdb1
Warning — "Device Is Busy"umount refuses to detach a filesystem that's still in use — for example, if a terminal's current working directory is inside it, or a process has an open file there. Change out of the directory and close any programs using it, then try again.

Automount in the Graphical Desktop

On a system running the GNOME desktop, plugging in removable media is normally handled automatically: the desktop's storage service detects the new device, mounts it under /run/media/username/, and typically offers to open a file manager window for it.

# Confirm where the desktop auto-mounted a device
lsblk
# MOUNTPOINT column will show something like:
# /run/media/student/MYUSBDRIVE
Note — Headless Systems Are Different — Automatic mounting depends on a running desktop session and its storage management service. On a headless server with no GUI, removable media must be mounted manually with mount, as shown above.

Removing Media Safely

Filesystems buffer writes in memory before flushing them to the physical device. Pulling media out before it's unmounted risks leaving data only half-written.

# Ensure all pending writes are flushed to disk
sync

# Unmount before physically removing the device
sudo umount /mnt/usbdrive

# Eject optical media or safely power down a removable drive
eject /dev/sdb
Tip — Use the Desktop's Eject Button Too — In a graphical session, the file manager's eject icon next to a mounted device does the unmount (and flush) for you — functionally the same as running umount from the terminal, just one click instead of a command.

Key Terms for Chapter 14

mount
The act of attaching a device's filesystem to a location in the directory tree
mount point
The directory a filesystem is attached to when mounted
block device
A device, such as a disk or USB drive, that stores data in fixed-size blocks
lsblk
Lists block devices and their partitions, sizes, and current mount points
blkid
Reports each block device's filesystem type, label, and UUID
automount
The desktop's automatic detection and mounting of newly connected removable media
sync
Forces buffered writes to be flushed to physical storage immediately

Review Questions

  1. Why doesn't Linux use drive letters for removable media the way some other operating systems do?
  2. What column in lsblk output helps you quickly identify which device is removable?
  3. Write the two commands needed to create a mount point at /mnt/data and mount /dev/sdb1 there.
  4. You try to unmount a USB drive and get a "device is busy" error. What's the most likely cause, and how do you fix it?
  5. Where does GNOME typically auto-mount removable media for a logged-in user?
  6. Why is it risky to physically remove a USB drive without unmounting it first?
  7. What command guarantees all buffered writes have been flushed to disk before you unmount a device?
1 / 9