Skip to content

Instantly share code, notes, and snippets.

@rocket-ron
Created August 3, 2015 05:21
Show Gist options
  • Save rocket-ron/bf7d7ce3e5b8b7cd9197 to your computer and use it in GitHub Desktop.
Save rocket-ron/bf7d7ce3e5b8b7cd9197 to your computer and use it in GitHub Desktop.
Resize (increase) Root Partition on AWS EBS Volume Linux LVM
This is a resize of the actual EBS volume as opposed to adding additional disks using LVM
1. Follow the steps here: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/storage_expand_partition.html
2. Use the instructions for gdisk further down the page to set the new partition table, not gparted or fdisk.
3. Reboot the instance once the partition table is written.
4. On the instance, execute:
sudo pvresize /dev/xvda2 (or whatever the device name is)
sudo pvdisplay
the pvdisplay command should show the larger volume size now for PV Size
sudo vgdisplay
the vgdisplay should also show the new volume size
sudo lvdisplay
look for the LV Path. It should be something like /dev/VolGroup/lv_root
sudo lvextend -r -l +100%FREE /dev/VolGroup/lv_root
this will extend the logical volume and kick off the resize step.
otherwise resize2fs doesn't work as expected from the command line.
the file system resize will take a few minutes to complete.
df -h
should show the new file system size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment