Forrest logo
back to the tune2fs tool

tune2fs:tldr:9f3e4

tune2fs: Enable discard and user-specified extended attributes for a filesystem.
$ tune2fs -o ${discard,user_xattr} ${-dev-sdXN}
try on your machine

The tune2fs command is used to modify various settings and parameters on an ext2, ext3, or ext4 filesystem in Linux.

Here is a breakdown of each component in the provided command:

  • tune2fs: This is the command itself.

  • -o: It is an option flag that allows you to specify various filesystem options.

  • ${discard,user_xattr}: These are the options passed to the -o flag.

    • discard enables the use of the TRIM command, which allows the filesystem to inform the underlying storage device about unused blocks, improving performance in solid-state drives (SSDs).

    • user_xattr enables the support for extended attributes. Extended attributes can further store additional metadata for files such as security information, file versioning, or other custom data.

  • ${-dev-sdXN}: This represents the device or partition on which the filesystem is mounted. In the command, ${-dev-sdXN} is just a placeholder, and you should replace it with the actual device or partition you want to modify. For example, if you want to modify the first partition on the second SATA drive, it could be something like /dev/sdb1.

When you execute the command with the appropriate device or partition, it will modify the filesystem options accordingly, enabling discard (TRIM) support and extended attributes for that specific filesystem.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the tune2fs tool