Storage and Filesystem Management

Identify storage devices, manage partitions and filesystems, mount additional disks and monitor storage usage in MocaccinoOS.

MocaccinoOS supports the storage devices and filesystems provided by the Linux kernel and its userspace tools. Storage devices can be managed through graphical applications or command-line utilities.

This page covers common storage administration tasks, including identifying disks, creating filesystems, mounting partitions, configuring persistent mounts and monitoring disk usage.

Warning: Partitioning, formatting and filesystem operations can permanently destroy data. Always verify the target device before running commands that modify a disk. Make sure important data is backed up.

Identify Storage Devices

The lsblk utility displays block devices, their partitions and mount points.

List available devices:

1
$ lsblk

For additional filesystem information:

1
$ lsblk -f

Example output:

1
2
3
4
5
6
NAME        FSTYPE FSVER LABEL UUID                                 MOUNTPOINTS
sda
├─sda1      vfat   FAT32       1234-ABCD                            /boot/efi
└─sda2      ext4   1.0         12345678-1234-1234-1234-123456789abc  /
nvme0n1
└─nvme0n1p1 ext4   1.0   Data  87654321-4321-4321-4321-abcdef123456  /mnt/data

The output shows:

  • Device names such as sda and nvme0n1.
  • Partitions such as sda1 and nvme0n1p1.
  • Filesystem types.
  • Filesystem labels and UUIDs.
  • Current mount points.

To display partition tables and disk sizes:

1
$ sudo fdisk -l

To inspect filesystem identifiers:

1
$ sudo blkid

These commands are useful when preparing a disk for mounting or checking which filesystem is present on a partition.

Partition Management

A disk can contain one or more partitions. Each partition can hold a filesystem, swap space or another storage structure.

Common partitioning tools include:

  • KDE Partition Manager: Graphical partition management.
  • GNOME Disks: Graphical disk and partition management.
  • fdisk: Command-line partition management.
  • parted: Command-line partition management, including GPT and MBR partition tables.

For example, to inspect a disk using fdisk:

1
$ sudo fdisk -l /dev/sdX

Replace /dev/sdX with the actual disk device.

Partitioning tools can create, delete and resize partitions. These operations should only be performed after understanding the existing partition layout and backing up important data.

Important: A disk and a partition are not the same thing. For example, /dev/sda identifies an entire disk, while /dev/sda1 identifies its first partition. Always verify the target before making changes.

Create a Filesystem

A partition needs a filesystem before it can be used for ordinary file storage.

Common Linux filesystems include:

  • ext4: A widely used general-purpose Linux filesystem.
  • Btrfs: A filesystem with features such as snapshots and checksums.
  • XFS: A high-performance journaling filesystem.
  • FAT32: Commonly used for EFI System Partitions and removable media.
  • exFAT: Commonly used for removable storage shared between operating systems.
  • NTFS: Commonly used by Windows installations and external drives.

To create an ext4 filesystem:

1
$ sudo mkfs.ext4 /dev/sdX1

Replace /dev/sdX1 with the intended partition.

For other filesystem types, use the corresponding creation utility, such as mkfs.xfs or mkfs.btrfs.

Warning: Creating a filesystem overwrites existing filesystem structures and can make existing data inaccessible. Do not run mkfs on a partition containing data you want to keep.

Mount a Filesystem

Linux makes filesystems accessible by attaching them to directories in the filesystem hierarchy. This is called mounting.

Create a mount point:

1
$ sudo mkdir -p /mnt/data

Mount a partition:

1
$ sudo mount /dev/sdX1 /mnt/data

The filesystem is now accessible under /mnt/data.

To inspect mounted filesystems:

1
$ findmnt

To inspect a particular mount point:

1
$ findmnt /mnt/data

To unmount the filesystem:

1
$ sudo umount /mnt/data

Make sure applications are no longer using files on the filesystem before unmounting it. Otherwise, the operation may fail with a device-busy error.

Configure Persistent Mounts

A filesystem mounted manually with mount is not automatically mounted again after a reboot.

To configure a persistent mount, add an entry to:

1
/etc/fstab

First, identify the filesystem UUID:

1
$ sudo blkid

Using a UUID is recommended instead of relying on device names such as /dev/sda1. Device names can change depending on the order in which storage devices are detected.

An /etc/fstab entry for an ext4 filesystem could look like this:

1
UUID=87654321-4321-4321-4321-abcdef123456  /mnt/data  ext4  defaults  0  2

The six fields are:

  1. Device: The device, UUID or label identifying the filesystem.
  2. Mount point: The directory where the filesystem is mounted.
  3. Filesystem type: For example, ext4, xfs or btrfs.
  4. Options: Mount options such as defaults, ro or noauto.
  5. Dump: Used by the legacy dump backup utility. Usually 0.
  6. Pass: Filesystem check order at boot. Usually 2 for additional filesystems and 0 when filesystem checks should not be performed.

Create the mount point before configuring the entry:

1
$ sudo mkdir -p /mnt/data

After editing /etc/fstab, test the configuration:

1
$ sudo mount -a

If the command completes without errors, inspect the mount:

1
$ findmnt /mnt/data

On MocaccinoOS, systemd reads /etc/fstab and generates the corresponding mount units. If you change the file, you can reload the systemd manager configuration:

1
$ sudo systemctl daemon-reload

Important: Incorrect /etc/fstab entries can cause boot delays or prevent the system from starting normally. Always test changes before rebooting.

Removable Storage

USB drives and other removable storage devices are normally detected automatically by the desktop environment.

When a supported filesystem is detected, it can usually be accessed through the file manager.

Before physically disconnecting a storage device, unmount or safely eject it through the desktop environment.

From the command line, identify the device:

1
$ lsblk -f

Unmount its mount point:

1
$ sudo umount /run/media/$USER/DRIVE_LABEL

The actual mount point depends on the desktop environment and device label. Use findmnt or lsblk to identify it rather than assuming a fixed path.

Disk Usage

The df utility reports filesystem capacity and available space.

Display usage in a human-readable format:

1
$ df -h

Include filesystem types:

1
$ df -hT

To inspect the space used by a directory:

1
$ du -sh /home/$USER

To find the largest directories under a location:

1
$ du -h --max-depth=1 /home/$USER

These commands help identify filesystems that are running out of space and directories that contain large amounts of data.

Swap Space

Swap provides additional virtual memory by using disk storage.

To inspect active swap devices and files:

1
$ swapon --show

You can also inspect memory and swap usage with:

1
$ free -h

Swap can be configured as a partition or a file. Existing swap configuration is normally managed through /etc/fstab or systemd swap units.

For example, an existing swap partition can be enabled with:

1
$ sudo swapon /dev/sdX2

To disable it:

1
$ sudo swapoff /dev/sdX2

Replace the example device with the actual swap partition.

Note: Hibernation requires additional configuration beyond having swap enabled. Refer to the Power Management documentation for more information.

SSD Maintenance

Solid-state drives support TRIM, which allows the operating system to inform the storage device about blocks that are no longer in use.

On systems using systemd, periodic TRIM can be managed through fstrim.timer.

Check its status:

1
$ systemctl status fstrim.timer

Enable periodic TRIM if it is not already enabled:

1
$ sudo systemctl enable --now fstrim.timer

To run TRIM manually on a mounted filesystem:

1
$ sudo fstrim -av

Periodic TRIM is generally preferable to enabling continuous discard through filesystem mount options.

Troubleshooting

Filesystem Does Not Mount

Inspect the filesystem and mount configuration:

1
2
$ lsblk -f
$ findmnt

For filesystems configured in /etc/fstab, check the entry carefully and test it:

1
$ sudo mount -a

Inspect system logs for related errors:

1
$ sudo journalctl -b

Filesystem Is Full

Check available space:

1
$ df -h

Find directories consuming the most space:

1
$ sudo du -h --max-depth=1 /var

Check other relevant locations such as /home and /var/log.

Device Is Busy When Unmounting

If a filesystem cannot be unmounted because it is busy, identify processes using the mount point:

1
$ sudo fuser -vm /mnt/data

Close applications using the filesystem before trying again.

Filesystem Errors

Filesystem repair tools must only be used when the filesystem is unmounted. Running repair operations on a mounted read-write filesystem can cause additional damage.

For ext4 filesystems, e2fsck can check and repair filesystem errors:

1
$ sudo e2fsck -f /dev/sdX1

Replace the example device with the correct partition.

Warning: Filesystem repair can modify or remove damaged filesystem structures. Back up recoverable data before attempting repairs.

Further Reading

Last modified November 29, 2026: Update SFTP (f553589)