Last active
February 4, 2021 17:11
-
-
Save withakay/2c7c2bb055bf2046974ede380dd4f937 to your computer and use it in GitHub Desktop.
Extend/Resize a partition and logic volume on Ubuntu Linux that was installed with LVM enabled
This file contains 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
#!/usr/bin/env bash | |
# This script will extend the logical volume | |
# To use all the free space. | |
# Run this after increasing the size of the virtual disk. | |
# NOTE, run as sudo. | |
# Run `pvdisplay` to check your device numbers match up | |
# /dev/sda3 & ubuntu-vg & ubuntu-lv are the defaults | |
# if you chose LVM when installing Ubuntu | |
DEVICE=sda | |
PART=3 | |
VG=ubuntu-vg | |
LV=ubuntu-lv | |
growpart /dev/$DEVICE $PART | |
pvresize /dev/$DEVICE$PART | |
lvextend -l +100%FREE /dev/$VG/$LV | |
resize2fs /dev/$VG/$LV |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment