Volume Groups

This page will be a rough guide on creating Volume Groups required for Virtualizor KVM and Xen.

  • First we need to check if there is an LVM partition on the server. Run this command:
# fdisk /dev/sda 
  • Then type the following to print the partition scheme:

The following command are to be run from inside the fdisk tool:

p

The output will be like so:

Device Boot      Start         End      Blocks   Id  System 
/dev/sda1 * 1 13055 104856576+ 83 Linux
/dev/sda2 13055 13565 4094976 82 Linux swap / Solaris
/dev/sda3 13565 243201 1844558432 8e Linux

Creating New Partition

We need to create a Linux LVM partition on the /dev/sda3.
The following commands are to be run from inside the fdisk tool:

  • Delete the third partition:
d <enter>  (Delete a partition)
3 <enter> (Select the partition number) 
  • Create a new partition :
n <enter>   (Create a new partition)
p <enter>   (It should be a primary partition)
3 <enter>   (This will become the thrid partition)
<enter>     (Use default calculated value for start cylinder
<enter>     (Use default calculated value for end cylinder)
t <enter>   (Change the partition type)
3 <enter>   (Select the partition number)
8e <enter>  (Partition type will be 8e) 
  • Write the changes to the partition table
w <enter> 
  • Reboot the server
# reboot
  • After reboot, the partition scheme should look like this
/dev/sda1   *           1       13055   104856576+  83  Linux 
/dev/sda2 13055 13565 4094976 82 Linux swap / Solaris
/dev/sda3 13565 243201 1844558432 8e Linux LVM
  • Now, the physical volume and the volume groups need to be created.
# pvcreate /dev/sda3

NOTE: If you are using RAID setup on your server, please create the PV from RAID disks (e.g. /dev/md1) and not from the actual disks (e.g /dev/sda1).
Please note that disk names can be different as per your setup, above explanation is just for an example.

  • Create the Volume Group (VG)
# vgcreate vg /dev/sda3

NOTE: If you are using RAID setup on your server, please create the VG from RAID disks (e.g. /dev/md1) and not from the actual disks (e.g /dev/sda1).
Please note that disk names can be different as per your setup, above explaination is just for an example.

Existing LVM

  • Incase an lvm is already created and the lv is mounted un-necesarrily, then you can un-mount it.
Filesystem        Type      Size  Used Avail Use% Mounted on 
/dev/md3 ext4 58G 2.5G 53G 5% /
/dev/md2 ext4 3.9G 64M 3.6G 2% /boot
/dev/mapper/vg-vg ext4 3.4T 70M 3.2T 1% /vgs

above is the sample output of df -Th command

  • You can un-mount using below command
# umount /vgs
  • Then remove the lv mounted on /vgs directory
# lvremove /dev/vg/vg
  • And comment its entry in /etc/fstab file
  • Then add /dev/vg as lvm based storage on panel.
Was this helpful to you?