Skip to content

Instantly share code, notes, and snippets.

@jakelee8
Last active December 4, 2016 23:42
Show Gist options
  • Select an option

  • Save jakelee8/e5057232241c7935ed9d8acbbff75fc0 to your computer and use it in GitHub Desktop.

Select an option

Save jakelee8/e5057232241c7935ed9d8acbbff75fc0 to your computer and use it in GitHub Desktop.
Create BTRFS on LUKS on ISW RAID5

Five disks, 6TB each. Adjust as needed.

Reset the disks.

for f in /dev/sd[abcde]; do
  sudo dd if=/dev/zero of=$f bs=512 count=1 conv=notrunc
done

Create the RAID array.

sudo dmraid -f isw -C store0 --type 5 --strip 128k --disk "/dev/sda,/dev/sdb,/dev/sdc,/dev/sdd,/dev/sde"
sudo dmraid -s

The last command lists the RAID sets. Output is something like the following.

*** Group superset isw_bcghhjfffj
--> Active Subset
name   : isw_bcghhjfffj_store0
size   : 12524192768
stride : 256
type   : raid5_la
status : ok
subsets: 0
devs   : 5
spares : 0

Copy the set ID from the output before continuing.

sudo dmraid -ay isw_bcghhjfffj_store0
sudo cryptsetup luksFormat /dev/mapper/isw_bcghhjfffj_store0

Enter a password when requested. Remember this password!

sudo cryptsetup luksOpen /dev/mapper/isw_bcghhjfffj_store0 crypt0

Enter the password when requested to open the partition.

sudo mkfs.btrfs -f /dev/mapper/crypt0

Now mount it.

mkdir -p /data
sudo mount /dev/mapper/crypt0 /data

References

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