You may have noticed that OVH’s predefined templates are not always what you are looking for. I hate being unable to use all the space for my Proxmox’s VMs. This time we will be manually configuring a small RAID protected root partition and LVM for the rest of avaiable space (we are going to backup the VMs anyway).
Start off by ticking the
Custom installation option.
Now go ahead and remove the “Remaining Space” partition as we are going to LVM it manually with the rest of the drives.
It is also the time to adjust both the root and swap partition sizes. I’m going with 15GB (15360MB) for my root partition and 8GB (8192MB) for swap. Proxmox 5 fresh installation takes around 7.5GB and Debian around 4GB, so there is plenty of space for the OS.
You can also tick the box on top if for some reason you want to have the root partition only on the first drive. If you leave the box unchecked SYS will create a RAID 1 partition on all drives (3 in my case).
On the next page, you can define custom hostname and SSH key if you previously added one.
Check the current partition layout by issuing:
The output looks like this:
Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
It may be a good idea to write down the last sector after which you want to create new partition -
48234495 in my case.
To create new partition on /dev/sda issue:
Welcome to fdisk (util-linux 2.29.2).
n- to create a new partition
p- to create a primary partition
3- to make the partition third on the drive
Generally the default values are accurate, but SYS creates the first partition on sector 4096, which means sectors 2048-4096 are unused and therefore fdisk will improperly suggest 2048. Add 1 to the sector you previously wrote down (
48234496 in my case). As for the last sector, fdisk should be correct.
Command (m for help): n
To prepare the partition to be used by LVM use the following two commands.
t- to change the partition type
8e- to change the partition type to LVM
Command (m for help): t
You can now:
w- to write changes to the disk and quit
q- to quit without writing the changes
Before you reboot the node redo the steps for
/dev/sdc and any other drives you may have.
pvcreate on each partition to create Physical Volumes
If you’re asking yourself why we didn’t format the partitions or create a filesystem, don’t worry. That step comes later.
Now that we have Physical Volumes defined we can create a Volume Group.
vgpool can be any name you want, however it is recommended to put
vg at the front, so in the future you will know it is a volume group. You can create the Volume Group will all the Physical Volumes at once.
vgcreate vgpool /dev/sda3 /dev/sdb3 /dev/sdc3
To create the Logical Volume with all the available space issue:
lvcreate -l 100%FREE -n lvpve vgpool
lvpve can be anything you want.
If you want to create a smaller Logical Volume you can use
vgdisplay to look up the available space. For example
lvcreate -L 30G -n lvpve vgpoolwill create a 30GB
lvpveLogical Volume from
lvextend -L80G /dev/vgpool/lvpvewill extend the partition to 80GB
lvextend -L+80G /dev/vgpool/lvpvewill extend the partition by 80GB
It may take a few seconds to execute. Be patient.
mke2fs 1.43.4 (31-Jan-2017)
In the future, if you decide to extend the Logical Volume you will also need to resize the filesystem:
Simply make a directory where you want the LV to be mounted and mount it there.
…as for Proxmox goes. You may want to go to
Datacenter -> Storage -> Add -> Directory to add the freshly mounted filesystem.