Skip to content

Arch Linux Filesystem Management

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Arch Linux Filesystem Management Guide

Complete beginner-friendly guide to managing filesystems on Arch Linux, including ext4, btrfs, xfs, mounting, formatting, and filesystem optimization.


Table of Contents

  1. Understanding Filesystems
  2. Common Filesystems
  3. Creating Filesystems
  4. Mounting Filesystems
  5. fstab Configuration
  6. Filesystem Maintenance
  7. Troubleshooting

Understanding Filesystems

What is a Filesystem?

Filesystem organizes data on storage devices.

Functions:

  • Organize files
  • Manage permissions
  • Track free space
  • Provide access methods

Filesystem Types

Common types:

  • ext4: Default Linux filesystem
  • btrfs: Modern with snapshots
  • xfs: High performance
  • NTFS: Windows compatibility
  • FAT32: Universal compatibility

Common Filesystems

ext4

ext4 features:

  • Stable and reliable
  • Good performance
  • Journaling
  • Widely supported

Use cases:

  • General purpose
  • Root filesystem
  • Most common choice

btrfs

btrfs features:

  • Snapshots
  • Compression
  • Copy-on-write
  • Subvolumes

Use cases:

  • System with snapshots
  • Data integrity
  • Advanced features

xfs

xfs features:

  • High performance
  • Large files
  • Scalability

Use cases:

  • Servers
  • Large files
  • Performance-critical

Creating Filesystems

Format ext4

Create ext4:

# Format partition
sudo mkfs.ext4 /dev/sda1

# With label
sudo mkfs.ext4 -L "MyData" /dev/sda1

Format btrfs

Create btrfs:

# Format partition
sudo mkfs.btrfs /dev/sda1

# With label
sudo mkfs.btrfs -L "MyData" /dev/sda1

Format xfs

Create xfs:

# Format partition
sudo mkfs.xfs /dev/sda1

# With label
sudo mkfs.xfs -L "MyData" /dev/sda1

Format Other Types

NTFS:

# Install ntfs-3g
sudo pacman -S ntfs-3g

# Format
sudo mkfs.ntfs /dev/sda1

FAT32:

# Format FAT32
sudo mkfs.fat -F32 /dev/sda1

Mounting Filesystems

Mount Manually

Mount filesystem:

# Create mount point
sudo mkdir /mnt/mydata

# Mount
sudo mount /dev/sda1 /mnt/mydata

# Check
df -h

Unmount

Unmount filesystem:

# Unmount
sudo umount /mnt/mydata

# Or
sudo umount /dev/sda1

Mount Options

Common options:

# Mount with options
sudo mount -o rw,noatime /dev/sda1 /mnt/mydata

# Read-only
sudo mount -o ro /dev/sda1 /mnt/mydata

# Remount
sudo mount -o remount,rw /dev/sda1

fstab Configuration

Edit fstab

Configure fstab:

# Edit fstab
sudo vim /etc/fstab

fstab Format

Entry format:

UUID=xxxx-xxxx-xxxx  /mnt/mydata  ext4  defaults  0  2
│                    │            │     │         │  │
│                    │            │     │         │  └─ fsck order
│                    │            │     │         └──── dump
│                    │            │     └────────────── options
│                    │            └──────────────────── filesystem
│                    └───────────────────────────────── mount point
└────────────────────────────────────────────────────── device

Example Entries

Common entries:

# Root filesystem
UUID=xxxx-xxxx  /  ext4  defaults  0  1

# Data partition
UUID=xxxx-xxxx  /mnt/data  ext4  defaults,noatime  0  2

# btrfs with compression
UUID=xxxx-xxxx  /mnt/data  btrfs  defaults,compress=zstd  0  2

# Swap
UUID=xxxx-xxxx  none  swap  defaults  0  0

Find UUID

Get UUID:

# List UUIDs
lsblk -f

# Or
blkid

Filesystem Maintenance

Check Filesystem

Check ext4:

# Check filesystem
sudo fsck.ext4 /dev/sda1

# Auto-repair
sudo fsck.ext4 -a /dev/sda1

Check btrfs:

# Check btrfs
sudo btrfs check /dev/sda1

Resize Filesystem

Resize ext4:

# Resize (grow)
sudo resize2fs /dev/sda1

# Resize to specific size
sudo resize2fs /dev/sda1 50G

Resize btrfs:

# Resize btrfs
sudo btrfs filesystem resize +10G /mnt/data

Disk Usage

Check usage:

# Disk usage
df -h

# Directory usage
du -h /path/to/directory

# Largest files
du -h | sort -rh | head -20

Troubleshooting

Filesystem Errors

Fix errors:

# Unmount first
sudo umount /dev/sda1

# Check and repair
sudo fsck.ext4 -y /dev/sda1

# Remount
sudo mount /dev/sda1 /mnt/mydata

Mount Failures

Check logs:

# Check dmesg
dmesg | tail

# Check journal
journalctl -b | grep mount

Permission Issues

Fix permissions:

# Check permissions
ls -l /mnt/mydata

# Change ownership
sudo chown -R user:group /mnt/mydata

# Change permissions
sudo chmod -R 755 /mnt/mydata

Summary

This guide covered:

  1. Filesystem basics - What they are
  2. Common filesystems - ext4, btrfs, xfs
  3. Creating - Format partitions
  4. Mounting - Mount filesystems
  5. fstab - Auto-mount configuration
  6. Maintenance - Check and resize
  7. Troubleshooting - Common issues

Key Takeaways:

  • ext4 is default choice
  • btrfs for advanced features
  • Use UUIDs in fstab
  • Check filesystems regularly
  • Backup before operations

Next Steps


This guide is based on the ArchWiki. For the most up-to-date information, always refer to the official ArchWiki.

Clone this wiki locally