System and processes

The tune2fs command

Shows and adjusts parameters of an ext2, ext3 or ext4 filesystem.

Syntax

sudo tune2fs [-l] [-L etiqueta] [-c cuenta] [-i intervalo] [-m porcentaje] dispositivoTry it in the terminal →

Most useful options

-lLists the superblock with the current parameter values. Read only.
-L etiquetaSets the volume label. On ext filesystems, a label longer than 16 characters is cut with a warning.
-c cuentaMounts after which e2fsck checks the filesystem. With 0 or -1 it is ignored.
-m porcentajePercentage of the filesystem reserved for privileged processes. The manual gives 5% as the default.

Copy-ready examples

$ sudo tune2fs -l /dev/sda1shows every parameter of the filesystem. Read only.
$ sudo tune2fs -l /dev/sda1 | grep 'volume name'filters only the label line.
$ sudo tune2fs -L datos /dev/sda1sets the label datos. Afterwards you can mount with LABEL=datos instead of the device name.
$ sudo tune2fs -m 1 /dev/sda1warning: lowers the reserve for privileged processes from 5% to 1%. It leaves less room for system processes.
$ sudo tune2fs -c 0 -i 0 /dev/sda1warning: disables the check by mount count and by time. Use it only if you have a reason not to check.

You can try them in the browser terminal: it does not touch your computer.

Common errors

MessageCauseFix
Warning: label too long, truncating.You set a label longer than 16 characters on an ext filesystem. tune2fs cuts it and continues with the rest of the command.Use a label of 16 characters or fewer and check the result with tune2fs -l.

Typical mistakes

  • The 16-character cut applies to ext filesystems. According to the manual, for other types tune2fs does not try to truncate the label.
  • According to the manual, the check by mount count is disabled by default so boots are not slowed down. Enable it only for a reason.
  • tune2fs -l is read only; the other options write to the superblock. Make a backup before touching -I or -O.
  • Lowering the reserve with -m gives more space to normal users, but leaves less margin for system processes.

Differences from similar commands

  • e2fsck: checks and repairs the data. tune2fs only adjusts parameters and checks nothing.
  • mkfs.ext4: creates an ext4 filesystem from scratch. tune2fs only changes parameters of one that already exists.

FAQ

How do I see the current label?

With sudo tune2fs -l device | grep 'volume name', or with blkid, which shows it next to the UUID.

Can I touch a mounted filesystem?

With -l, yes. To change parameters, it is better to unmount first.

Why can't I pass a folder?

Because tune2fs acts on the filesystem stored in the device. The manual also accepts LABEL= or UUID= instead of a path.

More System and processes commands

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course