Linux resize2fs Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Linux resize2fs Guide
Complete beginner-friendly guide to resize2fs on Linux, covering Arch Linux, CachyOS, and other distributions including resizing ext filesystems, expanding partitions, and filesystem expansion.
Table of Contents
- Understanding resize2fs
- resize2fs Basics
- Expanding Filesystems
- Shrinking Filesystems
- Troubleshooting
Understanding resize2fs
What is resize2fs?
resize2fs resizes ext filesystems.
Uses:
- Resize filesystem: Change filesystem size
- Expand filesystem: Grow filesystem
- Shrink filesystem: Reduce filesystem size
- Partition management: Manage filesystem size
Note: Only works with ext2, ext3, ext4 filesystems.
resize2fs Basics
Expand to Full Size
Basic usage:
# Expand to partition size
sudo resize2fs /dev/sda1
# Expands to fill partition
Specific Size
Set size:
# Resize to specific size
sudo resize2fs /dev/sda1 10G
# Resizes to 10GB
Expanding Filesystems
After Partition Expansion
Expand after resize:
# 1. Expand partition first (using fdisk/parted)
# 2. Then expand filesystem
sudo resize2fs /dev/sda1
# Expands to new partition size
Online Resize
Resize mounted:
# Resize mounted filesystem (ext4)
sudo resize2fs /dev/sda1
# Can resize mounted ext4 (if supported)
Shrinking Filesystems
Shrink Filesystem
Reduce size:
# Shrink filesystem
sudo resize2fs /dev/sda1 5G
# Shrinks to 5GB
# Must unmount first
Unmount First
Unmount before shrink:
# Unmount first
sudo umount /dev/sda1
# Then shrink
sudo resize2fs /dev/sda1 5G
Troubleshooting
Cannot Resize
Check filesystem:
# Check filesystem type
sudo blkid /dev/sda1
# Verify it's ext2/3/4
Summary
This guide covered resize2fs usage, filesystem resizing, and expansion for Arch Linux, CachyOS, and other distributions.
Next Steps
- fdisk Guide - Partitioning
- tune2fs Guide - Filesystem tuning
- Filesystem Management - Filesystem setup
- resize2fs Documentation:
man resize2fs
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.