Skip to content

Instantly share code, notes, and snippets.

@darth-veitcher
Created March 27, 2020 22:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darth-veitcher/b84b69873f6cccfc85f2f372e17f58c2 to your computer and use it in GitHub Desktop.
Save darth-veitcher/b84b69873f6cccfc85f2f372e17f58c2 to your computer and use it in GitHub Desktop.
BTRFS JBOD setup

Simple commands to setup a BTRFS filesystem across multiple disks as a JBOD implementation.

# Create a filesystem across the drives (metadata mirrored, linear data allocation)
sudo mkfs.btrfs -f -L MEDIA -d single -m raid1 /dev/mapper/data-*

To show all the filesystems

sudo btrfs filesystem show

To check filesystem usage

sudo btrfs filesystem df /mnt/media

In order to then add a disk to this filesystem later

sudo btrfs device add /dev/sdb /mnt/media
btrfs filesystem balance /mnt/media

We can also convert another btrfs filesystem data allocation (e.g. RAID1) to single as part of the balance process.

sudo btrfs balance start -dconvert=single,soft /mnt/media
@darth-veitcher
Copy link
Author

@sevi-kun
Copy link

Is this still a viable option? I would like to do this for my home media NAS.

@darth-veitcher
Copy link
Author

As far as I’m aware. Alternatively a better approach is probably to use MergerFS to combine the disks and then, optionally, use SnapRAID. Depends on the type of media being stored but that’s the approach I’ve got for:

• LUKS encrypt each disk individually
• Mount at boot time
• MergerFS combines into a virtual filesystem

@JiiPee74
Copy link

Is this still a viable option? I would like to do this for my home media NAS.

btrfs doesn't have really jbod/linear option afaik. When you do multivolume btrfs with data profile single, it works very similar as you would be using it as raid-0. Distributing data evenly to all available drives, 1GB chunks. So if one drive fails, you end up losing most of the data what is greater than 1GB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment