Working on getting RHEL virtual appliances setup in the Amazon cloud this is how you resize the root filesystem after taking a snapshot of the original, creating a larger EBS from the snap, removing the old /dev/sda and attaching the EBS volume you just created.
- Verify that the device /dev/sda is where the / filesystem resides
- # df -h
- Verify that the device /dev/sda is larger than the usable space
- # fdisk -l
- Open fdisk with /dev/sda specified
- # fdisk /dev/sda
- Delete the current partition
- Command (m for help): delete
- Create a new primary partition
- Command (m for help): n
- p
- Partition number (1-4): 1
- Use the entire disk for the new partition
- “enter”
- “enter”
- Verify that the only thing that has changed on /dev/sda is the size
- Command (m for help): p
- Write out the new configuration
- Command (m for help): w
- Reboot
- reboot -n
- Extend the file system
- # resize2fs -p /dev/sda1
- Verify that the disk size and usable size are the same
- fdisk -l
- Enjoy!
I have had success using a similar method in Ubuntu, but then you have to be careful to leave the boot area and removing the swap partition first. Take a screenshot of fdisk -l /dev/sda before you start mucking around – you’ll be glad you did 🙂
–Nat