Wednesday, April 22, 2015

How to Increase root volume on AWS instance

Increase root / volume size:
    Stop the instance
    Create a snapshot from the volume
    Create a new volume based on the snapshot increasing the size
    Check and remember the current's volume mount point (i.e. /dev/sda1)
    Detach current volume
    Attach the recently created volume to the instance, setting the exact mount point
    Restart the instance
    Access via SSH to the instance and run fdisk /dev/sda
    Hit p to show current partitions
    Hit d to delete current partitions (if there are more than one, you have to delete one at a time)
NOTE: Don't worry data is not lost
    Hit n to create a new partition
    Hit p to set it as primary
    Hit 1 to set the first cylinder
    Set the desired new space (if empty the whole space is reserved)
    Hit a to make it bootable
    Hit 1 and w to write changes
    Reboot instance
    Log via SSH and run resize2fs /dev/sda1
    Finally check the new space running df -h

That's it

No comments:

Post a Comment