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.

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.

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.

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, you can enable it in /etc/fstab, for example:

/dev/sdaX /  btrfs noatime,nodiratime,ssd 0 1
Does it support compression?

Yes, by adding compress=lzo or compress=zlib (depending on the level of compression or speed, being lzo faster and having zlib 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 apply 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.

What are the recommended options for installing on a pendrive, a sdcard 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 improve:

/dev/sdaX / btrfs x-systemd.device-timeout=0,noatime,compress-force=lzo,commit=0,ssd,ssd_spread,thread_pool=4,autodefrag 0 0

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 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 orther 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, procedure which is more complicated.

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