aAPT
dDebian
fFFmpeg
jJava
mMercurial: Usage
oOCaml
pPostgreSQL

Home OS Filesystems

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

  1. Umount the partition.
  2. Check the filesystem:
fsck -f /dev/sdXN
  1. Resize the filesystem:
resize2fs /dev/sdXN 20G
  1. Edit partition table: re-create partition with the new size (e.g. using cfdisk just enter the same size as in [3]).
  2. Re-read the partition table:
partprobe /dev/sdX
  1. Re-check the filesystem:
fsck -f /dev/sdXN
  1. Mount the partition.