User Tools

Site Tools


harddrive_setup

This is an old revision of the document!


2 x 3TB + GPT + Grub2 + RAID + LVM + ENCRYPTION

The idea is to have two harddrives in mirror mode with complete system encryption. For each harddrive we need a BIOS boot partition with grub core.img stuff in them. They have to be configured and installed (in grub) in such a way that each harddrive can boot from itself. I have decided to have the swap partitions not in any RAID configuration. Each harddrive will have a separated swap partition, each swap will be encrypted with a random key. The rest of the disk is the whole linux system (including /boot). This is going to be a RAID1 (copy) with a LVM on top (to allow future extension) and encryption on top.

In each harddrive do the following:

  • Create GPT partition table with gdisk. (Check that the alignment is to 2048-sectors for 4Kb harddrives, if not set it like that)
  • Create a BIOS boot partition of 1MB (necessary for grub2 on GPT disks)
  • Create a Linux swap partition (2G)
  • Create a Linux RAID partition (the rest of space)

Now in the first harddrive do:

  • Create the Linux RAID1 device:
mdadm --create md0 --level=1 --raid-devices=2 -R /dev/sdf3 missing
  • Replace “missing” for your second drive if its already connected.
  • For some reason the drive is read only still:
md0 : active (auto-read-only) raid1 sdf3[0]
      ?????? blocks super 1.2 [2/1] [U_]
  • Make it read/write
mdadm --readwrite /dev/md/md0 
  • Create an LVM2 logical block device on top of this RAID:
pgcreate /dev/md/md0
vgcreate soulrebel /dev/md/md0
lvcreate -l 100%VG -n root soulrebel
  • Create a dm-crypt on top of the LVM:
harddrive_setup.1302377084.txt.gz · Last modified: 2021/02/01 05:55 (external edit)