BTFRS with Raid1 and LUKS

  • Hi together I'm new with Linux and try to learn how to handle (sometimes not easy :))


    I have the follwing issue. I'm running a NAS server with OMV 5. I installed two HDD (WD red 3TB) and let it run with Raid1. This was quite easy. Now after some time I realized I have important data stored. So I want to install LUKS on the Raid1 but this time with BTRFS.


    My target is to have a Raid1 with BTRFS encrypted with LUKS. I managed it so far to create a RAid1 with BRTFS:


    mkfs.btrfs -L Lallkopf_Raid -d raid1 -f /dev/sdb /dev/sbd


    This worked so far. But I failed to intall LUKS. Anyone who can help me?


    Thanks in advance

  • Lallkopf

    Changed the title of the thread from “BFRS with Raid1 and LUKS” to “BTFRS with Raid1 and LUKS”.
  • You just encrypt every single drive using LUKS. Lets say you have encrypted /dev/sdb and /dev/sdc. When unlocked, the drives show up as eg. /dev/dm-0 and /dev/dm-1. (You can still see /dev/sdb and /dev/sdc, but never try to access them in any way but LUKS!)

    Now simply setup your btrfs filesystem like:

    Code
    mkfs.btrfs -L Lallkopf_Raid -d raid1 -f /dev/dm-0 /dev/dm-1


    You may want to unlock them automatically by entering a passphrase on boot. I think thats the tricky part actually. You need to add your drives to /etc/crypttab file (It is like fstab but for encrypted volumes to be unlocked). When both of your drives use the same passphrase you can use keyscript=decrypt_keyctl to be prompted for the passphrase only once.


    You will find specific steps on Google.

    (Oh and you should test that on a virtual machine, and always have a backup!)

  • HannesJo sorry for the late reply. First of all thanks for taking care and giving me advice. For the moment I did not encrypt, since it seems to go over my understanding (for the moment) - I still be new with Linux and Debian. I copied your answer fo later use.

    Once again thanks for your help! :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!