Jul 12 20

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:

root@sid:~$ install btrfs-tools

root@sid:~$ mkfs.btrfs -d raid1 /dev/sdb /dev/sdc

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:

root@sid:~$ sudo btrfs filesystem show

Label: none uuid: cace4a04-38e8-42-8581-82bfada35ea7
Total devices 2 FS bytes used 28.00KB
devid 1 size 1.0B used 212.75MB path /dev/sdb
devid 2 size 1.0GB used 212.75MB path /dev/sdc

Btrfs Btrfs v0.19

UUID=cace4a04-38e8-42-8581-82bfada35ea7 /storage btrfs defaults 0 0

written by d45id \\ tags: , , ,