Created
June 27, 2017 17:47
-
-
Save andreiavram/b79a2761a1c84a1b404502c15be9162e to your computer and use it in GitHub Desktop.
Increasing LVM disk space
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# inspired from | |
# https://www.transip.nl/vragen/446-mijn-partitie-via-lvm-vergroten/ | |
# first, check that you have lvm installed | |
sudo lvdisplay | |
# if you get nothing, you don't have lvm and you don't have a lot of options | |
# check you actually have additional free space | |
sudo parted /dev/vda | |
# you can then use, inside parted | |
print free | |
# to check if you have the additional space you want | |
# create new partition | |
sudo fdisk /dev/vda | |
p # to display current parititions | |
# check out the End column for the biggest number in there | |
n # to create new partition | |
p # for primary | |
# pick a number for your partition based on available ones, let's say 4 | |
# the new parition needs to end at the NEXT AVAILABLE cylinder, so the biggest number you looked for before on the last parition + 1 | |
t # to set the parition type | |
# put in the parition number, we said 4 | |
8e # this is LVM | |
p # to check everything's ok | |
w # to save changes, might get some warnings, worry not | |
reboot # to activate changes | |
# create physical volume group | |
pvcreate /dev/vda # /dev/vda4 in our case | |
sudo lvdisplay # to see logical volumes - save LV Path and VG Name | |
sudo vgextend <VG Name> /dev/vdaX # X is the partition number | |
sudo lvextend -l +100%FREE <LV Path> | |
sudo resize2fs <LV Path> | |
reboot |
Another useful article for when you get "Can't have overlapping partitions" https://www.openattic.org/posts/resize-lvm-inside-an-extended-partition/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've found this to be a bit more straight forward and intuitive: http://sirlagz.net/2016/01/20/live-resizing-lvm-on-linux/ .