Created
November 10, 2023 07:31
-
-
Save bouroo/90d64e3a22cc1f41294103e03e7a9ebc to your computer and use it in GitHub Desktop.
linux extend disk partition script
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 | |
# find root path | |
ROOT_DEV=$(findmnt -n -o SOURCE /) | |
# rescan disk size | |
echo 1 | sudo tee /sys/block/sda/device/rescan | |
# grow partition that contains root | |
# extend partition size | |
growpart /dev/sda 3 | |
# extend physical volume | |
pvresize /dev/sda3 | |
# extend logical volume | |
lvextend -r -l +100%FREE ${ROOT_DEV} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment