使用Gparted调整ext4分区失败,Ubuntu 16.04下如何解决?
Hey there, let’s work through this frustrating resize issue step by step. That error about unsupported read-only features and missing superblocks is common with older resize2fs versions (like your 1.42.13 on Ubuntu 16.04) when dealing with ext4 partitions that use newer filesystem features. Here’s how to resolve it:
Step 1: Identify the Unsupported Filesystem Features
First, let’s pin down which read-only features are tripping up resize2fs. Run this command to list your partition’s features:
dumpe2fs /dev/sdb5 | grep -i "features"
Look for entries like metadata_csum, 64bit, or dir_nlink—these are common newer features that older resize2fs builds don’t support.
Step 2: Locate and Use Backup Superblocks
The "Couldn't find valid filesystem superblock" error suggests the main superblock might be corrupted. Let’s find the backup superblocks built into the filesystem:
dumpe2fs /dev/sdb5 | grep -i "superblock"
You’ll see output similar to:
Backup superblock at 32768, Group descriptors at 32769-32769
Backup superblock at 98304, Group descriptors at 98305-98305
Use one of these backup superblocks to run a filesystem check and repair:
sudo e2fsck -b 32768 /dev/sdb5
Replace 32768 with the actual backup superblock number from your output, then follow the prompts to fix any detected filesystem errors.
Step 3: Remove Unsupported Read-Only Features (Caution!)
If the issue stems from newer features your resize2fs can’t handle, you can temporarily remove them (always back up your data first—this carries risk!). For example, if metadata_csum is listed as a feature:
sudo tune2fs -O ^metadata_csum /dev/sdb5
After removing the feature, re-run e2fsck to ensure the filesystem stays consistent:
sudo e2fsck /dev/sdb5
Step 4: Upgrade e2fsprogs (If Possible)
resize2fs is part of the e2fsprogs package. Try upgrading it to get a newer version that supports more ext4 features:
sudo apt update && sudo apt install --only-upgrade e2fsprogs
Ubuntu 16.04 is an older LTS release, so the official repo might not have the latest build, but this could still get you a compatible enough update to resolve the feature mismatch.
Step 5: Ensure the Partition is Unmounted
Before any resize operation, make sure the partition is fully unmounted. Run:
sudo umount /dev/sdb5
If you get a "device is busy" error, find and terminate processes using the partition:
sudo lsof /dev/sdb5 # Or use this alternative command sudo fuser -mv /dev/sdb5
Kill the listed processes with sudo kill <PID> then try unmounting again.
Step 6: Complete the Resize
Once the filesystem is repaired and unmounted:
- Use GParted to adjust the physical partition size to your desired dimensions.
- Run
resize2fsto resize the filesystem to match the new partition size:sudo resize2fs /dev/sdb5
Critical Reminder
Always back up all important data on /dev/sdb5 before performing any of these steps. Partition and filesystem operations carry a risk of data loss if something goes wrong.
内容的提问来源于stack exchange,提问作者birdman

