What I have:

Solus OS install with an encrypted LVM2 on a 56G SSD w/o swap - works pretty good. I have 32G RAM, so swap isn't an issue right now - it's my future main rig and it is mainly intended to being used as desktop for office, web, daw and rust programming (not everything at the same time).

What I want to do:

Add two 1T hds formatted with btrfs in a raid 1 configuration to the actual lvm2 volume group and they should contain /home (with all the stuff that's being already there) and being mounted as /home during boot so that I'll have 1T space for /home with software mirroring. The raid level 1 has to be for data and metadata.

/home should stay encrypted with the already used key phrase. Also I'd like to mount the btrfs' with -o compression-force that has to be done in fstab and fscrypt. I'm currently unsure whether it was fscrypt or something else sounding similar.

What I've understood so far:

  1. create the btrfs raid
  2. copy everything from /home to the temporary mounted /home-btrfs
  3. do some magic to get: /home on ssd gone, unmount /home-btrfs add btrfs-raid to the volume group and mount the btrfs-raid as /home - everything is encrypted again, but with more space

Is there anybody who can explain it to me? I'm unsure that I understood it well enough to get started. I am not afraid of the terminal or any cli. I've just decided to opt out of the vendor lock-in of Windows 10 and go for Linux. And I know that I'll get some performance hits with that config but that is okay for me.

My plan is currently to do this:

  1. gparted will create a partition table (gpt) and format /dev/sdb1 with btrfs
  2. open the terminal/shell
  3. sudo mount /dev/sdb1 /home-btrfs
  4. copy everything frome /home to /home-btrfs with cp -var /home /home-btrfs
  5. gparted will create a partition table (gpt) on /dev/sdc -> /dev/sdc1
  6. btrfs device add /dev/sdc1 /home-btrfs
  7. btrfs fi balance start -mconvert=raid1,soft -dconvert=raid1,soft /home-btrfs
  8. open a second shell to watch the raid conversion progress
  9. btrfs filesystem balance status /home-btrfs
  10. btrfs balance start -dusage=0 -musage=0 /mnt/btrfs (get rid of empty chunks)
  11. I'm stucked because now I could not get to fit lvextend, pvcreate, vgextend and other things from lvm2 into my plan.

I apologize my bad grammar. And yes I've spend quite a lot of time with the search function here and Google but couldn't find the answers I need.

  • OK, lets back up a little bit. Are you trying to use the two new drives for /home only? That would mean you'd have two BTRFS filesystems: the current one and a separate filesystem on the new drives; It also means you wouldn't need LVM on the new drives. Commented Mar 30, 2018 at 1:48
  • First, thanks for the reply Emmanuel Rosa. The current filesystem layout is a LUKS LVM with an ext4 filesystem - the installer didn't let me choose my configuration that I wanted. So the goal is to have the btrfs hard disks to be holding the entire /home directory configured as raid 1 (mirroring one disk) that currently resides on the 56G ext4 partition (this is were / is mounted). But I want the boot time encryption that's already been there and put the new filesystem under that umbrella. LUKS (encrypted partition) -> LVM -> ext4 + btrfs. I hope I could clarify this a bit more. Commented Mar 31, 2018 at 11:08

1 Answer 1


Solus OS uses systemd, therefore /etc/crypttab is used to configure LUKS devices that need to be unlocked so that filesystems can be mounted from them using /etc/fstab. Here's the procedure.

Mirroring (raid1) /home with LUKS and BTRFS

  1. Using Software Center, install btrfs-progs.
  2. Create a LUKS key file which will be stored on your encrypted / and used to unlock the new LUKS containers for /home: sudo dd bs=512 count=4 if=/dev/urandom of=/root/home.key.
  3. Create LUKS containers on both devices using the key file: sudo cryptsetup luksFormat /dev/sdb /root/home.key && sudo cryptsetup luksFormat /dev/sdc /root/home.key
  4. Unlock both LUKS containers: sudo cryptsetup open --type luks /dev/sdb home0 --key-file /root/home.key && sudo cryptsetup open --type luks /dev/sdc home1 --key-file /root/home.key
  5. Create the BTRFS filesystem: sudo mkfs.btrfs -d raid1 -m raid1 /dev/mapper/home0 /dev/mapper/home1
  6. Mount the BTRFS filesystem somewhere (you only need to specify one of the devices): mount /dev/mapper/home0 /mnt
  7. Create a /home subvolume, to give you more flexibility with BTRFS: sudo btrfs subvol create /mnt/home
  8. Copy your home directory to the subvolume: cp -var /home /mnt
  9. Create/modify /etc/crypttab so it unlocks the new LUKS containers: sudo echo "home0 /dev/sdb /root/home.key" >> /etc/crypttab && sudo echo "home1 /dev/sdc /root/home.key"
  10. Modify /etc/fstab so that it mounts your new home: sudo echo "/dev/mapper/home0 /home btrfs defaults,subvol=/home" >> /etc/fstab
  11. Reboot.

Your new raid1 BTRFS filesystem will be mounted at /home when you reboot. The remaining item is removing the old /home. To do that:

Removing the old /home

  1. Reboot but when the systemd-boot menu shows up press the e key.
  2. Now you'll be able to edit the kernel command line. Add "systemd.unit=rescue"
  3. Press ENTER to boot with the added kernel command line so that you boot into single-user mode. That will allow you to un-mount /home.
  4. Un-mount /home: umount /home.
  5. Remove the old /home. Be careful, I recommend having backups: cd /home && rm -fR .
  6. Reboot.

Notice that neither partitions nor LVM are needed since you're using the entire devices for BTRFS only. You also don't need to re-balance BTRFS because it's created with both devices and in RAID1 configuration from the start.

In addition, the LUKS containers are unlocked with a key file so that you're not prompted for the passphrase three times. But you may want to add your passphrase into another LUKS slot in case something happens to the key file.


Finally, I highly recommend backing up all three LUKS headers. If any of the headers get damaged and you don't have a backup, then you might as well send your disks to the landfill.

  • Thanks again for your reply, I'm backing up some data and will report the success or failure - I might even crash the system, I am talented in that. Commented Apr 1, 2018 at 7:39
  • You're welcome @EnricoLefass. I figured out the missing steps and updated my answer. Commented Apr 1, 2018 at 22:10
  • Works pretty fine except steps 9 and 10, I had to use nano to add the lines. Maybe I should use the UUIDs instead of sdb and sdc in fstab and crypttab? Kudos for your help! Commented Apr 3, 2018 at 12:23
  • Yes, UUIDS are recommended. Commented Apr 3, 2018 at 15:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .