LVM Tutorial how to create a Physical Volume (PV), Volume Group (vg), and a Logical Volume (LV) within it

# first we need a physical volume which we use the pvcreate tool to create

# I create mine on /dev/sdb3
pvcreate /dev/sdb3
  dev_is_mpath: failed to get device for 8:19
  Physical volume "/dev/sdb3" successfully created

# pvdisplay shows the newly created volume
pvdisplay
  "/dev/sdb3" is a new physical volume of "1.35 TiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb3
  VG Name              
  PV Size               1.35 TiB
  Allocatable           NO
  PE Size               0  
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               gpMwTX-JNA7-oTXT-YoCJ-RsKF-ceJd-3hin8w

# we need to create a new volume group within the physical volume of /dev/sdb3
# below I call it "kvmvm" on /dev/sdb3
vgcreate kvmvm /dev/sdb3
  Volume group "kvmvm" successfully created

# we can see below with vgdisplay that it has been created
vgdisplay
  --- Volume group ---
  VG Name               kvmvm
  System ID            
  Format                lvm2
  Metadata Areas        1
  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                1
  Act PV                1
  VG Size               1.35 TiB
  PE Size               4.00 MiB
  Total PE              352925
  Alloc PE / Size       0 / 0  
  Free  PE / Size       352925 / 1.35 TiB
  VG UUID               2d42cr-3f92-wF25-l288-JThZ-GGGQ-ttYvI6

# now that I have a volume group I need to create a logical volume (basically a mini-usable/resizeable partition within LVM's PV /dev/sdb3 on the VG kvmvm

# create a 60GB partition on the VG kvmvm and call it "kvmuserrdp"  
lvcreate -L 60G kvmvm -n kvmuserrdp
  Logical volume "kvmuserrdp" created

# shows the newly created lv (logical volume) which is accessible like a normal drive under /dev/kvmvm/kvmuserrdp

lvdisplay
  --- Logical volume ---
  LV Path                /dev/kvmvm/kvmuserrdp
  LV Name                kvmuserrdp
  VG Name                kvmvm
  LV UUID                HQhCr0-S2WS-DJEn-eHcc-axYn-uA8M-6bnYro
  LV Write Access        read/write
  LV Creation host, time testbox, 2014-03-26 16:52:56 +0800
  LV Status              available
  # open                 0
  LV Size                60.00 GiB
  Current LE             15360
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
 


Tags:

lvm, tutorial, volume, pv, vg, lv, pvcreate, dev, sdb, dev_is_mpath, quot, successfully, pvdisplay, newly, tib, allocatable, pe, allocated, uuid, gpmwtx, jna, otxt, yocj, rskf, cejd, hin, kvmvm, vgcreate, vgdisplay, format, metadata, areas, sequence, resizable, cur, mib, alloc, cr, wf, jthz, gggq, ttyvi, mini, usable, resizeable, partition, gb, kvmuserrdp, lvcreate, accessible, lvdisplay, hqhcr, ws, djen, ehcc, axyn, ua, bnyro, creation, testbox, gib, segments, allocation, inherit, sectors, auto, currently,

Latest Articles

  • How To Add Windows 7 8 10 11 to GRUB Boot List Dual Booting
  • How to configure OpenDKIM on Linux with Postfix and setup bind zonefile
  • Debian Ubuntu 10/11/12 Linux how to get tftpd-hpa server setup tutorial
  • efibootmgr: option requires an argument -- 'd' efibootmgr version 15 grub-install.real: error: efibootmgr failed to register the boot entry: Operation not permitted.
  • Apache Error Won't start SSL Cert Issue Solution Unable to configure verify locations for client authentication SSL Library Error: 151441510 error:0906D066:PEM routines:PEM_read_bio:bad end line SSL Library Error: 185090057 error:0B084009:x509 certif
  • Linux Debian Mint Ubuntu Bridge br0 gets random IP
  • redis requirements
  • How to kill a docker swarm
  • docker swarm silly issues
  • isc-dhcp-server dhcpd how to get longer lease
  • nvidia cannot resume from sleep Comm: nvidia-sleep.sh Tainted: Linux Ubuntu Mint Debian
  • zfs and LUKS how to recover in Linux
  • [error] (28)No space left on device: Cannot create SSLMutex Apache Solution Linux CentOS Ubuntu Debian Mint
  • Save money on bandwidth by disabling reflective rpc queries in Linux CentOS RHEL Ubuntu Debian
  • How to access a disk with bad superblock Linux Ubuntu Debian Redhat CentOS ext3 ext4
  • ImageMagick error convert solution - convert-im6.q16: cache resources exhausted
  • PTY allocation request failed on channel 0 solution
  • docker error not supported as upperdir failed to start daemon: error initializing graphdriver: driver not supported
  • Migrated Linux Ubuntu Mint not starting services due to broken /var/run and dbus - Failed to connect to bus: No such file or directory solution
  • qemu-system-x86_64: Initialization of device ide-hd failed: Failed to get