this post was submitted on 06 Sep 2023
5 points (100.0% liked)

Sysadmin

240 readers
2 users here now

A community dedicated to the profession of IT Systems Administration

founded 5 years ago
MODERATORS
 

Hey all,

I want to start using btrfs on my san/nas and use that as a backend for my nextCloud. Before I had read up on btrfs I was thinking about using RAID1. I thought RAID1 would fulfill my two requirements:

  • It would allow me to just pull out a disk and put in a usb dock and read its contents. (disaster recovery, or for my SO to just power down the server and get her data off if something happens to me).
  • It would simply Mirror the data so a single drive can fail and everything is fine.

Now I read things on the documentation of btrfs and in some other places that the RAID1 implementation of btrfs is non-standard, in that is also has some striping functionality.

The image included is from the btrfs docs and it seems it also stripes, not just mirrors, when using 4 disks.

Now my question is: What is its behaviour when using 2 disks? Will this fullfill my two requirements? If not do you have any other recommendations? (I mean i could use zfs...)

A penny for your thoughs :-).

top 2 comments
sorted by: hot top controversial new old
[โ€“] kevincox@lemmy.ml 2 points 1 year ago (1 children)

That photo seems wrong... BTRFS has a stupid allocator, it always puts data on the disk with the most space in it. So I would expect that to look like

  • device 1: A C
  • device 2: A C
  • device 3: B D
  • device 4: B D

Basically chunk A gets allocated and all disks have the same space available, so it gets put onto the first two (I don't know the exact policy here). Then chunk B gets allocated so it goes on the two empty disks as they have the most space. Then repeat for C and D.

RAID1 with two disks is very simple. It will just put one chunk on each disk, there is no other option. With BTRFS the chunks may not be at the same offset on the disk (like they would with traditional RAID1 or I think ZFS) but one chunk will go on each.

in that is also has some striping functionality.

I think you are thinking about the RAID10 profile which is 2 copies of data striped across the available disks. IIUC RAID10 and RAID1 are identical with 2 disks (as each copy will only have 1 disk available to stripe on which is effectively no striping).

Will this fullfill my two requirements? If not do you have any other recommendations?

Yes, I think it will fulfill your requirements.

Given your setup of 2 disks and 2x replication I would probably go the same route. The other major option is just to use traditional RAID and ext4 (or your favourite other FS) on top.

  • Pro: Simpler.
  • Pro: More tested stack.
  • Con: Less flexible. If you want to add a disk later and benefit from the software raid you will need to do conversions or copies.
[โ€“] SK4nda1@lemmy.ml 1 points 1 year ago

Thanks for your reply! Very helpful. The image I grabbed from the offial docs here: https://btrfs.readthedocs.io/en/latest/mkfs.btrfs.html#mkfs-section-profiles

I'll do some testing with raid 1 to see if it behaves as I expect. The only way to be properly sure i guess.