ext4
Generic operations
Set device label
e2label DEVICE LABEL
Check that trim is enabled
tune2fs -l /dev/sdXN | grep discard
Enable trim
tune2fs -o discard /dev/sdXN
Disable trim
tune2fs -o^discard /dev/sdXN
Change reserved block percentage (2%)
tune2fs -m2 /dev/sdXN
Disable journal
tune2fs -O ^has_journal DEVICE
Check filesystem for bad blocks (read test)
e2fsck -ctv /dev/sdXN
Options:
-c call badblocks to do read-only scan
-t print timing statistics
-v verbose mode
Shrinking ext4 partition
- Umount the partition.
- Check the filesystem:
fsck -f /dev/sdXN
- Resize the filesystem:
resize2fs /dev/sdXN 20G
- Edit partition table: re-create partition with the new size (e.g. using cfdisk just enter the same size as in [3]).
- Re-read the partition table:
partprobe /dev/sdX
- Re-check the filesystem:
fsck -f /dev/sdXN
- Mount the partition.