Setup LVM On Linux Install

1 minute read


Setup LVM with LUKS Multi-Disk. For this lab I used 2 127 GB vhd’s using Hyper-V and Fedora 25 Gnome.

To Resolve:

  1. Launch installer via Live USB image

  2. Select all your disks and choose the option to “encrypt my data” as well as “I will configure partitioning”.

  3. Click “done” and then enter the passphrase for your setup.

  4. Now on the next screen, we configure our disks:

    NOTE: Rules

    boot partition = /boot needs to be at least 250MB. swap needs to be 1024 MB+ (for a 4GB VM). For best results, follow:

    AmountofRAMintheSystem RecommendedAmountofSwapSpace
    4GBofRAMorless aminimumof2GBofswapspace
    4GBto16GBofRAM aminimumof4GBofswapspace
    16GBto64GBofRAM aminimumof8GBofswapspace
    64GBto256GBofRAM aminimumof16GBofswapspace
    256GBto512GBofRAM aminimumof32GBofswapspace


    Paths reference:

    root partition = /

    /home = lvm ext4

    /boot/efi standard – efi system partition 260mb

    / ext4 volumb group


    Now we just create them:

  5. Create boot

  6. Create vg

  7. Create root

  8. Create swap

  9. Create home

    And then we are done! Finish the installer.


Here is how to do it from command line although I haven’t actually done this. Steps to complete = Create physical volume, then volume groups, then logical volumes.

To Resolve:

  1. First we want to see our current disk setup:

    # Identify free disks
    fdisk -l
  2. Now we create a logical volume. Note that the disk should be blank.

    fdisk /dev/sdb
    n - new part
    p - primary part
    1 - first part on disk
    t - change type
    8e - lvm
    p - preview
    w - write changes
    # Do same thing for each disk
  3. Now we create the disk:

    pvcreate /dev/sdb1
    #could also do pvcreate /dev/sdb1, /dev/sdb2 …
  4. Now create the Volume Group

    vgcreate vgpool /dev/sdb1
    # Could also do pvcreate /dev/sdb1, /dev/sdb2 …
    lvcreate -L 3G -n lvstuff vgpool
    # -L is size, -n is name, and vgpool is mentioned so that lvcreate knows where to get the space from
  5. Create a filesystem

    mkfs -t ext3 /dev/vgpool/lvstuff - creates a file system
  6. Mount it

    mkdir /mnt/stuff
    mount -t ext3 /dev/vgpool/lvstuff /mnt/stuff
    # Adding a new hard drive:
    vgextend vgpool /dev/sdc1
    # Tell it how much to extend by, should be 3+8 but really extends to 8.
    lvextend -L +8G /dev/vgpool/lvstuff
    # Actually expands to 11 GB instead of 8.
    # lvextend -L+3G /dev/vgpool/lvstuff
    # Now we extend our filesystem:
    resize2fs /dev/vgpool/lvstuff