Notes on LVM

Page content

Some notes on LVM

Extending LV to new disks

If you try to create a PV on a disk with a signature you’ll get this:

[root@boomer ~]# pvcreate /dev/sdb
  Device /dev/sdb excluded by a filter.
  1. Get rid of the signature with gdisk:

    [root@boomer ~]# gdisk /dev/sdb
    GPT fdisk (gdisk) version 1.0.4
    
    Partition table scan:
    MBR: protective
    BSD: not present
    APM: not present
    GPT: present
    
    Found valid GPT with protective MBR; using GPT.
    
    Command (? for help): x
    
    Expert command (? for help): z
    
    About to wipe out GPT on /dev/sdb. Proceed? (Y/N): Y
    GPT data structures destroyed! You may now partition the disk using fdisk or
    other utilities.
    Blank out MBR? (Y/N): Y
    
  2. Now you can run pvcreate on each disk you need to add:

    [root@boomer ~]# pvcreate /dev/sdb
    Physical volume "/dev/sdb" successfully created.
    
  3. Verify:

    [root@boomer ~]# lvmdiskscan
    /dev/fedora_boomer/root [      15.00 GiB]
    /dev/sda1              [     200.00 MiB]
    /dev/fedora_boomer/swap [       7.89 GiB]
    /dev/sda2              [     200.00 MiB]
    /dev/sda3              [       1.00 GiB]
    /dev/sda4              [      <2.73 TiB] LVM physical volume
    /dev/sdb               [      <2.73 TiB] LVM physical volume
    /dev/sdc               [      <2.73 TiB] LVM physical volume
    /dev/sdd               [      <2.73 TiB] LVM physical volume
    
  4. Add new PVs to existing lv:

    [root@boomer ~]# vgextend fedora_boomer /dev/sdb
    Volume group "fedora_boomer" successfully extended
    

Create new Logical Volume

  1. Make the new LV

    [root@boomer ~]# lvcreate -n libvirt -L 500G fedora_boomer
    Logical volume "libvirt" created.
    
  2. Trust but verify

    [root@boomer ~]# lvs
    LV      VG           Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
    libvirt fedora_boomer -wi-a----- 500.00g
    root    fedora_boomer -wi-ao----  15.00g
    swap    fedora_boomer -wi-ao----   7.89g