Tag: btrfs

Set up a full redundant btrfs storage under ubuntu linux

ubuntu

Hard disks are going to be cheaper and cheaper and we are going to need even more space. So why not build your own cheap storage? Thanks to linux 3.1 and 3.2 and its btrfs support is now very easy to setup a fully redundant, scalable, storage made of many hard drives. Set up a btrfs storage is really easy. I’m using btrfs because it performs really good in a lot of scenarios like oracle demonstrated. Do not rely on old benchmarks, Btrfs has been out from a while now, and early versions are not comparable with old ones. One of the best features of this filesystem is scalability: you can start with one disk and then attach new disks as soon you need them. You just attach and add to the btrfs volume the new hard disk. That’s it.

To create a fully redundant hard disk just do:


goshawk@pluto:~$ sudo apt-get install btrfs-tools

goshawk@pluto:~$ sudo mkfs.btrfs -d raid1 /dev/sdb1 /dev/sdc1

With:


goshawk@pluto:~$ sudo btrfs filesystem show

Label: none uuid: 627e8d8a-8808-46fa-a237-875cd621f7f3
 Total devices 2 FS bytes used 28.00KB
 devid 1 size 931.51GB used 2.03GB path /dev/sdb1
 devid 2 size 931.51GB used 2.01GB path /dev/sdc1

Btrfs Btrfs v0.19

You can see the newly created filesystem. You will see also the UUID. That’s an important information since we can setup automount at startup thanks to that info.

Suppose that you want to attach the newly created storage to /storage and you want it to be mounted by default as soon as the computer starts. You just do add this line to /etc/fstab:


UUID=627e8d8a-8808-46fa-a237-875cd621f7f3 /storage btrfs defaults 0 0

Happy storage!


					
%d bloggers like this: