-
-
Notifications
You must be signed in to change notification settings - Fork 1
CachyOS Filesystem Management
Complete beginner-friendly guide to filesystem management on CachyOS, including ext4, btrfs, xfs, mounting, formatting, and filesystem optimization.
- Understanding Filesystems
- Common Filesystems
- Formatting Disks
- Mounting Filesystems
- Filesystem Maintenance
- Filesystem Optimization
- Troubleshooting
Filesystem organizes how data is stored on disk.
What it does:
- Organizes files: Structures file storage
- Manages space: Tracks used/free space
- File metadata: Stores file information
- Access control: Manages permissions
Why it matters:
- Performance: Affects disk performance
- Features: Different features per filesystem
- Reliability: Data integrity
- Compatibility: System compatibility
ext4 is the default Linux filesystem.
Features:
- Mature: Stable and well-tested
- Compatible: Works everywhere
- Reliable: Good data integrity
- Performance: Good performance
Best for:
- General use: Most use cases
- Stability: When reliability matters
- Compatibility: Maximum compatibility
btrfs is a modern filesystem.
Features:
- Snapshots: System snapshots
- Compression: Built-in compression
- RAID: Software RAID support
- Copy-on-write: Efficient storage
Best for:
- Snapshots: System snapshots
- Advanced features: Modern features
- Storage efficiency: Compression
xfs is a high-performance filesystem.
Features:
- Performance: High performance
- Large files: Handles large files well
- Scalability: Scales well
- Journaling: Reliable journaling
Best for:
- Performance: When speed matters
- Large files: Large file handling
- Servers: Server workloads
FAT32:
- Use: USB drives, compatibility
- Limitations: 4GB file size limit
NTFS:
- Use: Windows compatibility
- Features: Windows file system
exFAT:
- Use: Large USB drives
- Features: No file size limit
List disks:
lsblkWhat this does:
- Lists block devices
- Shows disks and partitions
- Helps identify disk
Check disk details:
sudo fdisk -lWhat this does:
- Shows detailed disk information
- Lists partitions
- Shows filesystem types
Format partition:
sudo mkfs.ext4 /dev/sda1What this does:
- Formats partition as ext4
- Creates ext4 filesystem
- ** Erases all data!**
With label:
sudo mkfs.ext4 -L "MyDisk" /dev/sda1What this does:
- Formats with label
-
-L: Sets filesystem label - Easier identification
Format partition:
sudo mkfs.btrfs /dev/sda1What this does:
- Formats partition as btrfs
- Creates btrfs filesystem
- ** Erases all data!**
With compression:
sudo mkfs.btrfs -f -L "MyDisk" /dev/sda1What this does:
- Formats btrfs
-
-f: Force (overwrites existing) -
-L: Sets label
Format partition:
sudo mkfs.xfs /dev/sda1What this does:
- Formats partition as xfs
- Creates xfs filesystem
- ** Erases all data!**
Mount filesystem:
sudo mount /dev/sda1 /mntWhat this does:
- Mounts partition to /mnt
- Makes filesystem accessible
- Temporary mount
Unmount:
sudo umount /mntWhat this does:
- Unmounts filesystem
- Safely removes mount
- ** Don't unmount while in use**
Edit fstab:
sudo nano /etc/fstabAdd entry:
UUID=xxxx-xxxx-xxxx /mnt ext4 defaults 0 2
What this means:
-
UUID: Partition UUID -
/mnt: Mount point -
ext4: Filesystem type -
defaults: Mount options -
0 2: Dump and fsck options
Find UUID:
lsblk -fWhat this does:
- Shows filesystem UUIDs
- Use UUID in fstab
- More reliable than device names
Test fstab:
sudo mount -aWhat this does:
- Mounts all fstab entries
- Tests configuration
- Verifies fstab is correct
Check ext4:
sudo fsck.ext4 /dev/sda1What this does:
- Checks filesystem integrity
- Finds and fixes errors
- ** Unmount first!**
Check btrfs:
sudo btrfs check /dev/sda1What this does:
- Checks btrfs filesystem
- Verifies integrity
- ** Read-only check**
Check xfs:
sudo xfs_repair /dev/sda1What this does:
- Checks and repairs xfs
- Fixes filesystem issues
- ** Unmount first!**
Show filesystem info:
df -hWhat this does:
- Shows filesystem usage
-
-h: Human-readable - Shows used/available space
Show inode usage:
df -iWhat this does:
- Shows inode usage
- Helps identify inode issues
- Important for many small files
Mount options:
sudo mount -o noatime /dev/sda1 /mntWhat this does:
-
noatime: Don't update access times - Reduces disk writes
- Better performance
Add to fstab:
UUID=xxxx /mnt ext4 defaults,noatime 0 2
Enable compression:
sudo mount -o compress=zstd /dev/sda1 /mntWhat this does:
- Enables zstd compression
- Saves disk space
- Good performance
Add to fstab:
UUID=xxxx /mnt btrfs defaults,compress=zstd 0 0
xfs is optimized by default:
- Good performance out of the box
- Few optimizations needed
- Works well as-is
Check filesystem:
sudo fsck.ext4 -f /dev/sda1What this does:
- Forces filesystem check
- Finds and fixes errors
- ** Unmount first!**
Auto-repair:
sudo fsck.ext4 -y /dev/sda1What this does:
- Auto-answers yes
- Automatically repairs
- ** Use carefully**
Check mount point:
mountpoint /mntWhat this does:
- Checks if mount point is mounted
- Verifies mount status
- Helps troubleshoot
Check fstab:
sudo mount -aWhat this does:
- Tests fstab entries
- Shows mount errors
- Helps fix fstab
Check disk usage:
df -hWhat this does:
- Shows filesystem usage
- Identifies full filesystems
- Helps manage space
Find large files:
du -h --max-depth=1 / | sort -hrWhat this does:
- Shows directory sizes
- Identifies large directories
- Helps free space
- Automount Disks Guide - Automatic mounting
- CachyOS System Maintenance - System maintenance
- Arch Linux Wiki - File Systems: https://wiki.archlinux.org/title/File_systems
This guide covered:
- Understanding filesystems - What filesystems are
- Common filesystems - ext4, btrfs, xfs
- Formatting disks - Creating filesystems
- Mounting filesystems - Manual and permanent mounting
- Filesystem maintenance - Checking and repairing
- Filesystem optimization - Performance tuning
- Troubleshooting - Common filesystem issues
Key Takeaways:
- ext4 is default and reliable
- btrfs offers advanced features
- xfs is high-performance
- Use UUIDs in fstab for reliability
- Check filesystems regularly
- Optimize mount options for performance
- Always unmount before checking/repairing
This guide is based on the CachyOS Wiki and Arch Linux Wiki and expanded with detailed explanations for beginners. For the most up-to-date filesystem information, always refer to the official documentation.