8

My PC has a SSD for the root filesystem and the home directory and a large HDD for other data. From time to time I sync the SSD content to the HDD in case the SSD fails. The HDD has a separate backup.

Now I consider if I can use the BTRFS RAID modes to achieve the same. So can I use subvolumes with RAID mode, such that the SSD is mostly used for reads/writes and the data is synced to the HDD?
In addition, I would like to have snapshots of the volume on the HDD.

It would be great, when this would work without manual work, even when the HDD was disconnected for some time.

Another option would probably be btrfs send/receive, but a RAID mode which writes the HDD when the IO is idle would allow for always having a recent copy of the data.

Edit: This is not a duplicate of these 1, 2, and 3 because I am explicitly asking for BTRFS, that has a storage pool concept instead of just using a block-level RAID.

allo
  • 1,248

1 Answers1

1

How to use BTRFS for RAID between a SSD and a larger HDD?

You simply create a BTRFS volume using the two disks:

mkfs.btrfs -m raid1 -d raid1 /path/to/ssd /path/to/hdd

More examples at https://btrfs.wiki.kernel.org/index.php/UseCases

However, please note that RAID1 is not a backup mechanism.

So can I use subvolumes with RAID mode, such that the SSD is mostly used for reads/writes and the data is synced to the HDD?

No.

  1. BTRFS doesn't do RAID at the subvolume level;
  2. RAID1 I/O will read and write to both drives at the same time;

a RAID mode which writes the HDD when the IO is idle would allow for always having a recent copy of the data.

That is not how RAID works. See 1. above.

BTRFS does allow you to mix drives of different sizes and types so you can use your existing SSD + HDD to create a RAID1 array where your data will sit on both drives. However,

  1. You will be limited by the size of the smaller drive. You can use a calculator to find out what your available storage will be.
  2. Setting this up will be rather complex as you'll have to rebuild the entire system;

I would like to have snapshots of the volume on the HDD.

You can achieve this by creating a BTRFS volume on that HDD and enabling period snapshots. btrbk is a tool I use and can recommend.

Good luck! :)