Skip to content

Storage Management Command Reference Guide

Commands to manage block devices, format partitions, and handle filesystems.

Block Devices and Partitions

List all block devices (disks and partitions).

lsblk

List all block devices with file system information (UUIDs and labels).

lsblk -f

List block devices with specific columns (name, size, type, mountpoint).

lsblk -o NAME,SIZE,TYPE,MOUNTPOINT

List disk partition tables and sizes (requires root).

fdisk -l

Open the interactive partition manager for a specific drive.

fdisk /dev/nvme0n1

Disk Space and Usage

Show file system disk space usage in human-readable format.

df -h

Show file system disk space usage including the file system type.

df -h -T

Estimate file space usage for a specific directory in human-readable format.

du -s -h /path/to/directory

List the sizes of all files and directories in the current location.

du -s -h *

Mounting and Unmounting

Mount a storage device to a directory.

mount /dev/sda1 /mnt/storage

Unmount a storage device from its directory.

umount /mnt/storage

Reload all mount points defined in /etc/fstab.

mount -a

BTRFS File System Management

Show information about all BTRFS file systems.

btrfs filesystem show

Show disk space usage specific to a BTRFS file system.

btrfs filesystem df /mnt/btrfs_storage

List all BTRFS subvolumes under a specific path.

btrfs subvolume list /mnt/btrfs_storage

Create a new BTRFS subvolume.

btrfs subvolume create /mnt/btrfs_storage/@new_subvol

Start a balance operation on a BTRFS file system to reclaim space.

btrfs balance start /mnt/btrfs_storage

XFS File System Management

For the full guide, see the XFS Cheat Sheet.

Create an XFS file system with a label.

mkfs.xfs -L data /dev/sdb1

Show the geometry and enabled features of a mounted XFS file system.

xfs_info /mnt/xfs_storage

Grow a mounted XFS file system to fill its partition or logical volume (XFS cannot be shrunk).

xfs_growfs /mnt/xfs_storage

Check an unmounted XFS file system without making changes.

xfs_repair -n /dev/sdb1

Show a human-readable quota report for an XFS file system.

xfs_quota -x -c "report -h" /mnt/xfs_storage

Snapper and Snapshot Management

List all existing snapshots for the default configuration (usually root).

snapper list

List snapshots for a specific configuration.

snapper -c home list

Create a manual snapshot with a description.

snapper create -d "Before system update" -c timeline

Delete a specific snapshot by its number.

snapper delete 42