Differences between revisions 25 and 26
Revision 25 as of 2016-03-11 23:14:06
Size: 8196
Comment: update official status link and add missing parentheses
Revision 26 as of 2016-03-14 20:20:23
Size: 8972
Comment: move a paragraph from "intro" to "status" section; add link to Debian:BackupAndRecover and Debian:UEFI; address issue of swap space vs raw partitioning; add systemd.mount timeout option
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
As of linux-4.4.5 the official status of btrfs is "Btrfs is under heavy development, and is not suitable for
any uses other than benchmarking and review" ([[https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/filesystems/btrfs.txt?id=refs/tags/v4.4.5|git.kernel.org]]). In a ''linux-btrfs'' thread where a user is unable to rebalance his btrfs volume due to out of space errors, there is a discussion about changing this to "you should have backups and be prepared to use them if you're using btrfs, and...it's not suitable for production systems yet" (Duncan, 2016-03-06, [[https://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg51348.html|linux-btrfs]]).
Line 23: Line 20:
A Btrfs volume created on a raw partition can be used to boot. A Btrfs volume created on a raw partition can be used to boot using grub-pc. If booting with EFI firmware, please consult Debian:UEFI for ESP partitioning requirements. As of 2016-03-14 it is highly recommended to use a swap partition rather than a manually configured swap file through a loop-device; classic swap files are not supported (''Btrfs Wiki'' [[https://btrfs.wiki.kernel.org/index.php/FAQ#Does_btrfs_support_swap_files.3F|Btrfs FAQ]])
Line 26: Line 23:

As of linux-4.4.5 the official upstream status of btrfs is "Btrfs is under heavy development, and is not suitable for
any uses other than benchmarking and review" ([[https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/filesystems/btrfs.txt?id=refs/tags/v4.4.5|git.kernel.org]]). In a ''linux-btrfs'' thread where a user is unable to rebalance his btrfs volume due to out of space errors, there is a discussion about changing this to "you should have backups and be prepared to use them if you're using btrfs, and...it's not suitable for production systems yet" (Duncan, 2016-03-06, [[https://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg51348.html|linux-btrfs]]). Please refer to Debian:BackupAndRecovery if you do not yet have a backup strategy in place.
Line 54: Line 55:
Changing {{{/dev/sdaX}}} with your actual root device (if Debian detected an UUID use it). If fact, there are many other more options you can add, just look at [[https://btrfs.wiki.kernel.org/index.php/Mount_options|here]]. (Remember: all fstab mount options must be comma separated but NOT space separated, so do not insert a space after the comma or the equal symbol). Changing {{{/dev/sdaX}}} with your actual root device (if Debian detected an UUID use it; use the command blkid to get the UUID of all filesystems). If fact, there are many other more options you can add, just look [[https://btrfs.wiki.kernel.org/index.php/Mount_options|here]]. (Remember: all fstab mount options must be comma separated but NOT space separated, so do not insert a space after the comma or the equal symbol).
Line 70: Line 71:
The noauto option will prevent the system to freeze at boot in the case of a non system and (likely) un-plugged device/partition. The noauto option will prevent the system to freeze at boot in the case of a non system and (likely) un-plugged device/partition.  Alternatively, if you are using systemd and want to limit boot delay to 10 seconds in case of a missing device: {{{

UUID=<the_device_uuid> /mount/point btrfs x-systemd.device-timeout=10,noatime,compress=lzo,autodefrag 0 0
}}}

Translation(s): English - Русский


FileSystem > Btrfs

Btrfs is intended to address the lack of pooling, snapshots, checksums, and integral multi-device spanning in Linux file systems, these features being crucial as the use of Linux scales upward into larger storage configurations. Btrfs is designed to be a multipurpose filesystem, scaling well on very large block devices.

Even though Btrfs has been in the kernel since 2.6.29, the developers state that "as of 2.6.31, we only plan to make forward compatible disk format changes". The developers still want to improve the user/management tools to make them easier to use. For more information about Btrfs, follow the links in See also section.

Ext2/3/4 filesystems should be upgradable to Btrfs, but this is not recommended because members of linux-btrfs have noted that a number of issues have been linked to conversions, and that the convert utility needs further work (Btrfs Wiki, Conversion from Ext3).

In the near future this wiki article will be updated with recommendations on how to limit your risk when testing btrfs, along with workarounds for common issues. For example, you are substantially less likely to run into issues with a simple two disk mirror mounted noatime than an n-disk RAID6 mounted with compress=lzo and autodefrag. Many people have reported years of btrfs usage without issue, and this wiki will soon contain recommended configuration parameters for achieving this end. eg: the number of snapshots per volume and per subvolume must be carefully monitored and/or automatically pruned, because too many snapshots can wedge the filesystem into an out of space condition or gravely degrade performance (Duncan, 2016-02-16, linux-btrfs). There are also reports that IO becomes sluggish and lags with far fewer snapshots, eg: only 86/subvolume on linux-4.0.4; this might be fixed in a newer kernel (Pete, 2016-03-11, linux-btrfs).

Status

DebianSqueeze and later support Btrfs. This means that they include a compatible kernel and tools.

A Btrfs volume created on a raw partition can be used to boot using grub-pc. If booting with EFI firmware, please consult UEFI for ESP partitioning requirements. As of 2016-03-14 it is highly recommended to use a swap partition rather than a manually configured swap file through a loop-device; classic swap files are not supported (Btrfs Wiki Btrfs FAQ)

The DebianInstaller can format and install to single-disk Btrfs volumes. The way that Btrfs combines multiple disks to create a single volume is not compatible with the data model of the current installer (#686097). Various people have described ways of installing Debian onto a RAID1 Btrfs without too much trouble. It is also possible to install normally, then add another disk, then rebalance as RAID1 (Btrfs Wiki, "Converting to RAID").

As of linux-4.4.5 the official upstream status of btrfs is "Btrfs is under heavy development, and is not suitable for any uses other than benchmarking and review" (git.kernel.org). In a linux-btrfs thread where a user is unable to rebalance his btrfs volume due to out of space errors, there is a discussion about changing this to "you should have backups and be prepared to use them if you're using btrfs, and...it's not suitable for production systems yet" (Duncan, 2016-03-06, linux-btrfs). Please refer to BackupAndRecovery if you do not yet have a backup strategy in place.

WARNING

  • Subvolumes cannot currently, as of linux-4.4.5, be mounted with different btrfs-specific options; the first btrfs line for a given volume in /etc/fstab takes effect. eg: you cannot mount / with noatime and /var with nodatacow,compress=lzo (Btrfs Wiki, "Mount options").

FAQ

Which package contains the tools?

btrfs-tools (in DebianSqueeze and above). You MUST install this package if you use Btrfs.

Does it support SSD optimizations?

Yes, Debian Jessie and later automatically detect non-rotational hard disks and ssd is added to the btrfs mount options. For more details on using SSDs with Debian, refer to SSDOptimization.

What are the recommended options for installing on a pendrive, a SD card or a slow SSD drive?

When installing, use manual partitioning and select btrfs as file system. In the first boot, edit /etc/fstab with this options, so you can expect a very good speed and responsiveness improvement:

/dev/sdaX / btrfs x-systemd.device-timeout=0,noatime,compress=lzo,commit=0,ssd_spread,autodefrag 0 0
Does it support compression?

Yes, by adding compress=lzo or compress=zlib (depending on the level of compression or speed, lzo being faster and zlib having more compression):

/dev/sdaX /  btrfs defaults,compress=lzo 0 1
But if what you want is to just compress the files in a directory?

You can do this by applying the following two commands (for example for /var):

btrfs filesystem defragment -r -v -clzo /var
chattr +c /var

By adding the +c attribute you ensure that any new file created inside the folder is compressed.

Changing /dev/sdaX with your actual root device (if Debian detected an UUID use it; use the command blkid to get the UUID of all filesystems). If fact, there are many other more options you can add, just look here. (Remember: all fstab mount options must be comma separated but NOT space separated, so do not insert a space after the comma or the equal symbol).

In order to check if you have written the options correctly before rebooting and therefore before being in trouble, run this command as root:

mount -o remount /

If no error is reported, everything is OK. Never try to boot with a troubled options fstab file or you'll have to manually try to recover it, a procedure that is more complicated.

What are the recommended options for a rotational hard disk?

In fstab :

UUID=<the_device_uuid> /mount/point/ btrfs noauto,compress=lzo,noatime,autodefrag 0 0

The noauto option will prevent the system to freeze at boot in the case of a non system and (likely) un-plugged device/partition. Alternatively, if you are using systemd and want to limit boot delay to 10 seconds in case of a missing device:

UUID=<the_device_uuid> /mount/point btrfs x-systemd.device-timeout=10,noatime,compress=lzo,autodefrag 0 0
Can I encrypt a btrfs installation?

Yes, you can by selecting manual partitioning and creating an encryption volume and then a btrfs file system on top of that. For the moment, btrfs does not support direct encryption so the installer uses cryptsetup, but is a planned feature.

Does it work on RaspberryPi?

Yes, improving filesystem I/O responsiveness a lot. You may have to convert the filesystem to btrfs first from a PC and change the /etc/fstab type of filesystem from ext4 to btrfs (just by changing the name) before the first boot. Look above for recommended sdcard options in /etc/fstab.

See also: Btrfs wiki: FAQ Btrfs wiki: Documentation

Documentation

See also

Contact


CategoryKernel