You are viewing an old revision of this post, from June 6, 2015 @ 16:54:08. See below for differences between this version and the current revision.

Unable to resize root partition on EC2 centos

This is what it had to be done

  1. Stop the instance
  2. Create a snapshot from the volume
  3. Create a new volume based on the snapshot increasing the size
  4. Check and remember the current's volume mount point (i.e. /dev/sda1)
  5. Detach current volume
  6. Attach the recently created volume to the instance, setting the exact mount point
  7. Restart the instance
  8. Access via SSH to the instance and run fdisk /dev/xvde
  9. Hit u to change display units tosectors
  10. Hit p to show current partitions
  11. 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
  12. Hit n to create a new partition
  13. Hit p to set it as primary
  14. Hit 1 to set the first cylinder (it musts be the same first cylinder of your old partition)
  15. Set the desired new space (if empty the whole space is reserved)
  16. Hit a to make it bootable
  17. Hit 1 and w to write changes
  18. Reboot instance
  19. Log via SSH and run resize2fs /dev/xvde1
  20. Finally check the new space running df -h

Revisions

  • June 6, 2015 @ 16:54:36 [Current Revision] by admin
  • June 6, 2015 @ 16:54:36 by admin
  • June 6, 2015 @ 16:54:08 by admin

Revision Differences

June 6, 2015 @ 16:54:08Current Revision
Content
Unchanged: <p>Unchanged: <p>
Unchanged: This is what it had to be doneUnchanged: This is what it had to be done
Unchanged: </p>Unchanged: </p>
Unchanged: <ol>Unchanged: <ol>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Stop the instanceUnchanged: Stop the instance
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Create a snapshot from the volumeUnchanged: Create a snapshot from the volume
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Create a new volume based on the snapshot increasing the sizeUnchanged: Create a new volume based on the snapshot increasing the size
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Check and remember the current&#039;s volume mount point (i.e. /dev/sda1)Unchanged: Check and remember the current&#039;s volume mount point (i.e. /dev/sda1)
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Detach current volumeUnchanged: Detach current volume
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Attach the recently created volume to the instance, setting the exact mount pointUnchanged: Attach the recently created volume to the instance, setting the exact mount point
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Restart the instanceUnchanged: Restart the instance
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Access via SSH to the instance and run <code>fdisk /dev/xvde</code>Unchanged: Access via SSH to the instance and run <code>fdisk /dev/xvde</code>
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Deleted: Hit <kbd>p</kbd> to show current partitions Added: Hit <kbd>u</kbd> to change display units tosectors
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Deleted: Hit <kbd>u</kbd> to change display units tosectors Added: Hit <kbd>p</kbd> to show current partitions
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Hit <kbd>d</kbd> to delete current partitions (if there are more than one, you have to delete one at a time) NOTE: Don&#039;t worry data is not lostUnchanged: Hit <kbd>d</kbd> to delete current partitions (if there are more than one, you have to delete one at a time) NOTE: Don&#039;t worry data is not lost
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Hit <kbd>n</kbd> to create a new partitionUnchanged: Hit <kbd>n</kbd> to create a new partition
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Hit <kbd>p</kbd> to set it as primaryUnchanged: Hit <kbd>p</kbd> to set it as primary
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Hit <kbd>1</kbd> to set the first cylinder (it musts be the same first cylinder of your old partition)Unchanged: Hit <kbd>1</kbd> to set the first cylinder (it musts be the same first cylinder of your old partition)
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Set the desired new space (if empty the whole space is reserved)Unchanged: Set the desired new space (if empty the whole space is reserved)
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Hit <kbd>a</kbd> to make it bootableUnchanged: Hit <kbd>a</kbd> to make it bootable
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Hit <kbd>1</kbd> and <kbd>w</kbd> to write changesUnchanged: Hit <kbd>1</kbd> and <kbd>w</kbd> to write changes
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Reboot instanceUnchanged: Reboot instance
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Log via SSH and run <code>resize2fs /dev/xvde1</code>Unchanged: Log via SSH and run <code>resize2fs /dev/xvde1</code>
Unchanged: </li>Unchanged: </li>
Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">Unchanged: <li style="margin: 0px 0px 0.5em;padding: 0px;border: 0px;font-size: 15px">
Unchanged: Finally check the new space running <code>df -h</code>Unchanged: Finally check the new space running <code>df -h</code>
Unchanged: </li>Unchanged: </li>
Unchanged: </ol>Unchanged: </ol>

Note: Spaces may be added to comparison text to allow better line wrapping.

No comments yet.

Leave a Reply