Lab: Create a Volume Group

Volume groups are pools of storage that are used to create logical volumes. Volume groups get their space by adding physical volumes. In this lab you’ll create a volume group on your VM that you can use in subsequent labs.

Step 1: Create Physical Volumes

Start by checking the block devices:

$ lsblk 
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda      8:0    0  10G  0 disk 
└─sda1   8:1    0  10G  0 part /
sdb      8:16   0  10M  0 disk 
sdc      8:32   0   1G  0 disk 
sdd      8:48   0   1G  0 disk 
sde      8:64   0   1G  0 disk 
sdf      8:80   0   1G  0 disk 

Now list the existing physical volumes:

$ sudo pvdisplay

There should be none found (empty output). Now let’s create physical volume labels on our extra devices:

$ sudo pvcreate /dev/sdc /dev/sdd /dev/sde /dev/sdf 
  Physical volume "/dev/sdc" successfully created
  Physical volume "/dev/sdd" successfully created
  Physical volume "/dev/sde" successfully created
  Physical volume "/dev/sdf" successfully created

Rerun pvdisplay to verify that your physical volumes exist:

$ sudo pvdisplay
  "/dev/sde" is a new physical volume of "1.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sde
  VG Name               
  PV Size               1.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               aK5O9m-g6g5-KwXG-1kju-bEAY-gisb-TLe2Bz
   
  "/dev/sdc" is a new physical volume of "1.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdc
  VG Name               
  PV Size               1.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               JdwVUW-dnmv-YWKj-hdA8-Uhro-AyVY-m7j552
   
  "/dev/sdd" is a new physical volume of "1.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdd
  VG Name               
  PV Size               1.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               6wh271-0heU-J92n-yKot-TR0q-IBGU-9Yyshs
   
  "/dev/sdf" is a new physical volume of "1.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdf
  VG Name               
  PV Size               1.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               n1731Z-VbIM-hYbm-6lui-bzsv-u91a-aUf2WX

Step 2: Create the Volume Group

In this step you will create a volume group and add the physical volumes to it. First let’s check for existing volume groups:

$ sudo vgdisplay

There should be no output. Now let’s create a volume group:

$ sudo vgcreate my_vg /dev/sdc /dev/sdd /dev/sde /dev/sdf 
  Volume group "my_vg" successfully created

Now let’s check the volume group:

$ sudo vgdisplay 
  --- Volume group ---
  VG Name               my_vg
  System ID             
  Format                lvm2
  Metadata Areas        4
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                4
  Act PV                4
  VG Size               3.98 GiB
  PE Size               4.00 MiB
  Total PE              1020
  Alloc PE / Size       0 / 0   
  Free  PE / Size       1020 / 3.98 GiB
  VG UUID               Qf1c8h-i1IQ-IT15-YMCF-STMH-BfkE-Qz1Ogc

Turn In

Create files that show your work:

$ sudo pvdisplay > /vagrant/pvdisplay.txt 
$ sudo vgdisplay > /vagrant/vgdisplay.txt 

Submit the files:

  • pvdisplay.txt
  • vgdisplay.txt