17 November, 2021

Installing Proxmox with Linux raid

I this article I will explain how to setup Debian using LVM & RAID 1 (mirror). Then install Proxmox on top and setup the necessary thinpool.
 
NOTE: This is *NOT* a supported installation of Proxmox and as such should not be used in a production environment. It is provided as an educational material only.
 
First install Debian as normal, when prompted create a raid mirror and LVM volumes for the root filesystem and the swap.

A standard install + ssh server will easily fit into an 8G volume leaving about 4G free.

Once installed check for updates (apt update && apt-dist-upgrade). Check the status of the raid array using mdadm --detail /dev/md0
 
Ensure that mdadm reports that the array is in a clean state (I.e. healthy). 

It should look something like this:

/dev/md0:
     Version : 1.2
     Creation Time : Mon Nov  1 14:28:10 2021
     Raid Level : raid1
     Array Size : 33534976 (31.98 GiB 34.34 GB)
     Used Dev Size : 33534976 (31.98 GiB 34.34 GB)
     Raid Devices : 2
     Total Devices : 2
     Persistence : Superblock is persistent

     Update Time : Wed Nov 17 13:50:53 2021
     State : clean
     Active Devices : 2
    Working Devices : 2
    Failed Devices : 0
    Spare Devices : 0

Consistency Policy : resync

              Name : TESTPVE4:0  (local to host TESTPVE4)
              UUID : da8e61c0:9bb61b6c:aea14209:b4ce52a8
            Events : 1538

    Number   Major   Minor   RaidDevice State
       3       8        1        0      active sync   /dev/sda1
       2       8       17        1      active sync   /dev/sdb1

running pvs to scan your physical volumes should be similar to this:

 PV         VG  Fmt  Attr PSize  PFree  
 /dev/md0   pve lvm2 a--  31.98g 928.00m

Your volume groups should be similar to this:

  VG  #PV #LV #SN Attr   VSize  VFree  
  pve   1   4   0 wz--n- 31.98g 928.00m

And lastly your logical volume scan should look like this:

  LV            VG  Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root          pve -wi-ao----  9.31g                                                    
  swap          pve -wi-ao----  3.72g                                                    

Now that your system is running with LVM running on raid , dont forget to install the grub bootloader on the second disk of the mirrored array (/dev/sdb). Otherwise you will not be able to boot if /dev/sda fails.

grub-install /dev/sdb

This can be tested by shutting down the system and unplugging /dev/sda and booting up again. The system should (after complaining that a disk is missing) boot up normally. 

NOTE: If you perform the test above wait for the array to rebuild once both drives are connected, use mdm --detail /dev/md0 to monitor the array and continue once the array is marked as clean.

If all looks well you can create the LVM thinpool for use by proxmox by running lvcreate

lvcreate -L 18G --thinpool data pve

In this example a thinpool of 18G is created named data within the pve volume group. You will need to adjust the command as appropriate for your needs.

If all goes well running lvs should show all you previous logical volumes as well as your new thin pool !

  LV            VG  Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert

  data          pve twi-aotz-- 18.00g             8.02   13.93                           
  root          pve -wi-ao----  9.31g                                                    
  swap          pve -wi-ao----  3.72g                                                   

Next up, install Proxmox onto your Debian installation by following the instructions contained in the Proxmox documentation.

No comments:

Post a Comment