hetzneronline / installimage

Bash scripts to universally deploy various distributions
Other
517 stars 143 forks source link

LVM+RAID support using MD-RAID + LVM or LVM-RAID? #50

Closed typoworx-de closed 2 years ago

typoworx-de commented 2 years ago

I would like to understand the RAID+LVM setup. For this I already noticed the example given by: https://github.com/hetzneronline/installimage/blob/master/configs/simple-debian64-raid-lvm.

Will 'SWRAIDLEVEL=1' introduce a mdadm RAID or will it use the LVM-Raid features, see here: https://blog.programster.org/create-raid-with-lvm

Example for RAID1 using LVM2 (taken from link above):

VG_NAME="vg1"
LV_NAME="lvm_raid1"

sudo vgcreate $VG_NAME /dev/sd[x]1 /dev/sd[x]1

sudo lvcreate \
  --mirrors 1 \
  --type raid1 \
  -l 100%FREE \
  --nosync \
  -n $LV_NAME $VG_NAME

sudo mkfs.[ext4/xfs] /dev/$VG_NAME/$LV_NAME

Is it also possible to make installimage run custom scripts to setup partitions using lvm commands directly?

asciiprod commented 2 years ago

LVM + RAID will first set up a MD RAID and then on top the LVM Customized scripts for partitions are not supported.