Skip to content

Instantly share code, notes, and snippets.

@TomCan
Last active November 19, 2018 09:32
Show Gist options
  • Save TomCan/fd586eb750fe110e45c59eb41a23f20e to your computer and use it in GitHub Desktop.
Save TomCan/fd586eb750fe110e45c59eb41a23f20e to your computer and use it in GitHub Desktop.
# in case of VM and live update of harddisk size, first rescan scsi bus to refect changes
for DEV in `ls -1 /sys/class/scsi_device/`; do echo 1 > /sys/class/scsi_device/$DEV/device/rescan; done
# resize partitions, assumes /dev/sda2 is extended and /dev/sda5 is logical in /dev/sda2
parted /dev/sda
> resizepart 2 -1s
> resizepart 5 -1s
> q
# rescan partion table
partprobe
# resize PV
pvresize /dev/sda5
# resize LV, use correct LV path/device
lvresize -l +100%FREE /dev/template8-vg/root
# resize filesystem, use correct LV path/device
resize2fs /dev/template8-vg/root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment