Guest blogger: Andrew Mallett

The Urban Penguin

You may have used Logical Volumes on Linux before with either LVM or EVMS and, of course, software raid. Now though we have a file-system that supports volumes that can dynamically increase and support RAID : BTRFS. With the complete implementation in the file-system the deployment and management is simplified and performance is increased. Although still EXPERIMENTAL it is worth looking at BTRFS as it has begun to ship in many of the leading Linux Distributions.

What is BTRFS

BTRFS dates back to 2007, so as I write this in 2010 so it is right and proper that openSUSE among other now ship this File-System. As a File-System, it incorporates many advanced features:

  • Extent based file storage (2^64 max file size)
  • Space efficient packing of small files
  • Space efficient indexed directories
  • Dynamic inode allocation
  • Writable snapshots
  • Subvolumes (separate internal file-system roots)
  • Object level mirroring and striping
  • Checksums on data and metadata (multiple algorithms available)
  • Compression
  • Integrated multiple device support, with several raid algorithms
  • Online file-system check
  • Very fast offline file-system check
  • Efficient incremental backup and FS mirroring
  • Online file-system defragmentation

Many of these features are geared towards the enterprise however others such as the RAID and Volume implementations are easily applied to any environment.

The need for Dynamic Volumes

I would describe "Dynamic Volumes" as the ability of a file-system to grow or reduce in size based on the needs of storage at the time. Take storage of media files such as music or videos. How much space do you need? It is hard to predict but it is great that they are all in one volume. So as your first disk fills it would be great that we could just add another disk in to that same volume. BTRFS can do this and not only that;it will do it whilst the volume is online and mounted. We can also create the file-system directly as RAID 0 (striped), RAID 1, (mirrored) or RAID 10 (mirrored and striped). Striping gives us faster performance and mirroring allows for fault-tolerance. Sure, Linux has had the ability to do this before but now we build this into the FS it is easier to implement. So let's look at creating a striped volume across two disk and then add a third disk to the volume dynamically.

Step by step

mkfs.btrf -m raid0 /dev/sdb /dev/sdc (create the btrfs file-system across two drives : sdb and sdc)

mount -t btrfs /dev/sdb /data ( we now mount the first drive to the /data directory, however both drives in the raid 0 array will appear here)

mount (to display which drives are mounted)

df -h (to display free space, in my example the two 5GB drives give 10GB of space)

btrfs-vol -a /dev/sdd /data ( add a third device to my file-system and RAID Array whilst the FS is mounted)

df -h ( to display the new space available of 15GB)

In Conclusion

The simplicity of the management of this File-System with its ability to create volumes with the simple format command makes this a really winner in my eyes. Sure, it is experimental at the moment but I suggest this is something to start working with now as this will be the future of your file-system.

Visit CourseMonster open source courses and book the right one for you

Linux Training