Like any other filesystems, the Btrfs filesystem also has a lot of mount options that you can use to configure the Btrfs filesystem’s behavior while mounting the filesystem.
This article will show you how to mount a Btrfs filesystem with your desired mount options. I will explain some of the useful Btrfs mount options as well. So, let’s get started.
ACL – Access Control List
RAID – Redundant Array of Independent/Inexpensive Disks
UUID – Universally Unique Identifier
Where to Put Btrfs Mount Options
You can mount a Btrfs filesystem using the mount command-line program or the /etc/fstab file at boot time. You can configure the behavior of the Btrfs filesystem using mount options. In this section, I am going to show you how to mount a Btrfs filesystem using different mount options:
- from the command-line.
- using the /etc/fstab
From the command-line, you can mount a Btrfs filesystem (created on the sdb storage device) on the /data directory with the mount options option1, option2, option3, etc. as follows:
To mount the same Btrfs filesystem at boot time using the /etc/fstab file, you need to find the UUID of the Btrfs filesystem.
You can find the UUID of the Btrfs filesystem with the following command:
As you can see, the UUID of the Btrfs filesystem created on the sdb storage device is c69a889a-8fd2-4571-bd97-a3c2e4543b6b.
Open the /etc/fstab file with the following command:
To automatically mount the Btrfs filesystem that has the UUID c69a889a-8fd2-4571-bd97-a3c2e4543b6b on the /data directory with the mount options option1,option2,option3, etc., add the following line at the end of the /etc/fstab file.
Once you’re done, press <Ctrl> + X followed by Y and <Enter> to save the /etc/fstab file.
Your Btrfs filesystem should be mounted with your desired mount options.
Important Btrfs Mount Options
In this section, I am going to explain some of the important Btrfs mount options. So, let’s get started.
The most important Btrfs mount options are:
1. acl and noacl
ACL manages user and group permissions for the files/directories of the Btrfs filesystem.
The acl Btrfs mount option enables ACL. To disable ACL, you can use the noacl mount option.
By default, ACL is enabled. So, the Btrfs filesystem uses the acl mount option by default.
2. autodefrag and noautodefrag
Defragmenting a Btrfs filesystem will improve the filesystem’s performance by reducing data fragmentation.
The autodefrag mount option enables automatic defragmentation of the Btrfs filesystem.
The noautodefrag mount option disables automatic defragmentation of the Btrfs filesystem.
By default, automatic defragmentation is disabled. So, the Btrfs filesystem uses the noautodefrag mount option by default.
3. compress and compress-force
Controls the filesystem-level data compression of the Btrfs filesystem.
The compress option compresses only the files that are worth compressing (if compressing the file saves disk space).
The compress-force option compresses every file of the Btrfs filesystem even if compressing the file increases its size.
The Btrfs filesystem support many compression algorithms and each of the compression algorithm has different levels of compression.
The Btrfs supported compression algorithms are: lzo, zlib (level 1 to 9), and zstd (level 1 to 15).
You can specify what compression algorithm to use for the Btrfs filesystem with one of the following mount options:
For more information, check my article How to Enable Btrfs Filesystem Compression.
4. subvol and subvolid
These mount options are used to separately mount a specific subvolume of a Btrfs filesystem.
The subvol mount option is used to mount the subvolume of a Btrfs filesystem using its relative path.
The subvolid mount option is used to mount the subvolume of a Btrfs filesystem using the ID of the subvolume.
For more information, check my article How to Create and Mount Btrfs Subvolumes.
The device mount option is used in multi-device Btrfs filesystem or Btrfs RAID.
In some cases, the operating system may fail to detect the storage devices used in a multi-device Btrfs filesystem or Btrfs RAID. In such cases, you can use the device mount option to specify the devices that you want to use for the Btrfs multi-device filesystem or RAID.
You can use the device mount option multiple times to load different storage devices for the Btrfs multi-device filesystem or RAID.
You can use the device name (i.e., sdb, sdc) or UUID, UUID_SUB, or PARTUUID of the storage device with the device mount option to identify the storage device.
The degraded mount option allows a Btrfs RAID to be mounted with fewer storage devices than the RAID profile requires.
For example, the raid1 profile requires 2 storage devices to be present. If one of the storage devices is not available in any case, you use the degraded mount option to mount the RAID even though 1 out of 2 storage devices is available.
The commit mount option is used to set the interval (in seconds) within which the data will be written to the storage device.
The default is set to 30 seconds.
To set the commit interval to 15 seconds, you can use the mount option commit=15 (let’s say).
8. ssd and nossd
The ssd mount option tells the Btrfs filesystem that the filesystem is using an SSD storage device, and the Btrfs filesystem does the necessary SSD optimization.
The nossd mount option disables SSD optimization.
The Btrfs filesystem automatically detects whether an SSD is used for the Btrfs filesystem. If an SSD is used, the ssd mount option is enabled. Otherwise, the nossd mount option is enabled.
9. ssd_spread and nossd_spread
The ssd_spread mount option tries to allocate big continuous chunks of unused space from the SSD. This feature improves the performance of low-end (cheap) SSDs.
The nossd_spread mount option disables the ssd_spread feature.
The Btrfs filesystem automatically detects whether an SSD is used for the Btrfs filesystem. If an SSD is used, the ssd_spread mount option is enabled. Otherwise, the nossd_spread mount option is enabled.
10. discard and nodiscard
If you’re using an SSD that supports asynchronous queued TRIM (SATA rev3.1), then the discard mount option will enable the discarding of freed file blocks. This will improve the performance of the SSD.
If the SSD does not support asynchronous queued TRIM, then the discard mount option will degrade the SSD’s performance. In that case, the nodiscard mount option should be used.
By default, the nodiscard mount option is used.
If the norecovery mount option is used, the Btrfs filesystem will not try to perform the data recovery operation at mount time.
12. usebackuproot and nousebackuproot
If the usebackuproot mount option is used, the Btrfs filesystem will try to recover any bad/corrupted tree root at mount time. The Btrfs filesystem may store multiple tree roots in the filesystem. The usebackuproot mount option will scan for a good tree root and use the first good one it finds.
The nousebackuproot mount option will not check or recover bad/corrupted tree roots at mount time. This is the default behavior of the Btrfs filesystem.
13. space_cache, space_cache=version, nospace_cache, and clear_cache
The space_cache mount option is used to control the free space cache. Free space cache is used to improve the performance of reading the block group free space of the Btrfs filesystem into memory (RAM).
The Btrfs filesystem supports 2 versions of the free space cache: v1 (default) and v2
The v2 free space caching mechanism improves the performance of big filesystems (multi terabytes in size).
You can use the mount option space_cache=v1 to set the v1 of the free space cache and the mount option space_cache=v2 to set the v2 of the free space cache.
The clear_cache mount option is used to clear the free space cache.
When the v2 free space cache is created, the cache must be cleared to create a v1 free space cache.
So, to use the v1 free space cache after the v2 free space cache is created, the clear_cache and space_cache=v1 mount options must be combined: clear_cache,space_cache=v1
The nospace_cache mount option is used to disable free space caching.
To disable the free space caching after the v1 or v2 cache is created, the nospace_cache and clear_cache mount option must be combined: clear_cache,nosapce_cache
By default, interrupted/paused balance operation of a multi-device Btrfs filesystem or Btrfs RAID will be automatically resumed once the Btrfs filesystem is mounted. To disable automatic resuming of interrupted/paused balance operation on a multi-device Btrfs filesystem or Btrfs RAID, you can use the skip_balance mount option.
15. datacow and nodatacow
The datacow mount option enables the Copy-on-Write (CoW) feature of the Btrfs filesystem. It is the default behavior.
If you want to disable the Copy-on-Write (CoW) feature of the Btrfs filesystem for the newly created files, mount the Btrfs filesystem with the nodatacow mount option.
16. datasum and nodatasum
The datasum mount option enables data checksumming for newly created files of the Btrfs filesystem. This is the default behavior.
If you don’t want the Btrfs filesystem to checksum the data for newly created files, mount the Btrfs filesystem with the nodatasum mount option.
This article has shown you how to mount a Btrfs filesystem with your desired mount options. I have explained some of the useful Btrfs mount options as well.
 The Btrfs Mount Options Manpage – man 5 btrfs