Skip to content

Instantly share code, notes, and snippets.

@gilangvperdana
Last active February 23, 2024 07:31
Show Gist options
  • Save gilangvperdana/a8413940283eda0ff766b0ce31a7029d to your computer and use it in GitHub Desktop.
Save gilangvperdana/a8413940283eda0ff766b0ce31a7029d to your computer and use it in GitHub Desktop.
Create Mountpoint with Volume Group

General

If you want to create an mountpoint with Volume Group you can follow this step.

Topology

image

Case

  • We have 2 disk (/dev/sdb & /dev/sdc)
  • We want to combine that 2 disk to one Mountpoint (/mnt)
  • We want to dynamicly extend that disk if we have a new disk

Create PV

pvcreate /dev/sdb
pvcreate /dev/sdc
pvscan
pvs

Create Volume Group

vgcreate vg01 /dev/sdb
vgs
pvs
vgscan

LV Create

lvcreate -L 9.99G -n lv01 vg01

Attach new disk to VG

vgextend vg01 /dev/sdc
pvs
vgscan

LV Extend

lvextend -l +100%FREE /dev/vg01/lv01

## or you can expand with single command like this
lvextend -l +100%FREE /dev/vg01/lv01 -r

Mount

sudo mkfs.ext4 /dev/vg01/lv01
sudo mount /dev/vg01/lv01 /mnt
lsblk

Detach PV

Refresh PFree after Online Extend

pvresize /dev/sdd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment