New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AWS Centos 6 AMIs do not resize the root partition #34
Comments
I can't see to ssh back into my aws instances once I run the commands. Did you have this issue? |
Hello Team, [root@ip-******** ec2-user]# df -h |
Hey mihir-govil, here is how I was able to solve it Use 'lsblk' to verify that you do indeed have more space on your device than is showing in your root partition. If so, run the following command "sudo growpart /dev/xvda 1" |
I'd also like to add that you may need to install the |
FYI, we're also seeing this issue in Centos 7: https://getchef.zendesk.com/agent/tickets/10386 (internal Chef ticket) |
The newer Marketplace Chef Server built on Centos 7 doesn't auto resize its root partition because the As a workaround until
Reference: https://help.ubuntu.com/community/CloudInit |
The images published today contain growpart and expand as expected. Thanks for reporting it y'all. |
@Purple90 thanks, it worked: After I typed Then I didn't have to reboot, I just typed |
Disk /dev/xvda: 530 GiB, 569083166720 bytes, 1111490560 sectors Here's my partition table When I try to resize partition using growpart growpart /dev/xvda 1NOCHANGE: partition 1 is size 16769024. it cannot be grown ANy suggestion on how to go ahead with this? |
@shonry27 same issue here |
@CrashLaker, I have the same issue as @shonry27 and can't seem to find an answer for it. ubuntu@ip-192-0-2-100:~$ sudo growpart /dev/nvme1n1 2 |
hi @jackbtran |
Problem
The AWS Centos 6 AMIs do not resize the root partition to use all of the attached EBS volume. This is a big problem because the default size is only 10GB which fills up very quickly especially when
chef-server-ctl marketplace-setup
ends up upgrading Chef packages.The problem is that the AMI is relying on cloud-init's growpart module to resize the partition but apparently this only works for kernels > 3.8.
Reference: http://lists.openstack.org/pipermail/openstack/2014-August/008721.html
Here's the kernel in my Marketplace Chef Server I launched today.
Solutions
One solution would be to rebuild the Centos 6 AMIs using the old style of resizing which is described pretty well in the Mail List thread above and also in this blog post.
http://blog.backslasher.net/growroot-centos.html
After talking with @ryancragun though it seems that the better solution would be to build the AMIs using Centos 7 which is able to correctly use the cloud-init growpart module. Centos 7 build work is already underway so I think this is the direction @ryancragun plans to take to fix this issue.
Workaround
In the meantime you can use
fdisk
to resize the partition entry in the partition table while the partition is mounted and then reboot the instance. After the reboot finishes the entire EBS volume is completely available to the root partition without needing to runresize2fs
. As long as you follow the steps below carefully resizing the partition can be done without losing any data.The following is an example of the partition resizing procedure.
Be sure to login as the root user when running the following commands.
If you just launched the Marketplace Chef Server then you will want to wait approximately 15 minutes for the cloud-init work to finish running. Yes, it really takes that long. :)
You can run
pgrep -lf S53cloud-final
to see if the cloud-init process is still running.Once cloud-init is finished you can run
lsblk
to see that the EBS volume attached asxvda
has 30GB available but thexvda1
partition only has 10GB.First determine the Start sector of the
xvda1
partition. Make sure you usesectors
for units instead of the default ofcylinders
. The-u
flag changes the units to sectors.In this case the Start sector is
2000
.Now use the following command to set the units to sectors, delete the partition entry from the partition table and create a new partition entry using the same Start sector value,
2000
in this case. The empty line accepts the default End sector which will be the last sector of the disk. Thew
saves the modifications to the partition table.Now reboot the instance and when you log back in you can run
lsblk
ordf -h
to see that the partition has been resized.The text was updated successfully, but these errors were encountered: