Extending Logical Volume in Ubuntu

I found the machine for model serving in my office has insufficient volumn avaiable. I started my day by extending logical volume. Here’s what I did:

1. Check current volume status

# fdisk -l

img

I found that I have 2 hard drives(/dev/sda, /dev/sdb) but those are not fully utilized as logical volumes.

# pvdisplay
# vgdisplay
# lvdisplay

img

Adding physical volume to volume group

Next, I created PV for the /dev/sdb1 partition

sudo pvcreate /dev/sdb1

img

After successfully creating PV, I added it to the existing VG

# vgextend [vg-name] [pv-name]

img

I can see VG size is extended about 1.06TB

Extending LV and resizing the file system

To fully utilize the newly added space, I extended the LV

# lvextend -l +100%FREE [lv-path]

img

Lastly, I resized the filesystem mounted on ‘/’

# sudo resize2fs [device]

img

Categories:

Updated:

Leave a comment