I did it a bit differently. Because I don't mind if the FS is not expanded 
at AMI creation time I just expand it. And the next AMI boot it will be 
ready and expanded. 

Therefore I added the follow code in the packer user_data_file:
# resize root fs if the volume is bigger
echo "ROOT DISK RESIZING" > /tmp/root_disk_resize.log
# wait for facter
while ( ! /usr/bin/facter ); do sleep 15 ; done >> /tmp/root_disk_resize.log 
2>&1
OS_RELEASE=$(facter operatingsystemmajrelease 2>&1 )
ROOT_DEVICE=$(facter ec2_block_device_mapping_root 2>&1 )
# Install epel
rpm -ivh https://ftp.fau.de/epel/epel-release-latest-${OS_RELEASE}.noarch.rpm 
>> /tmp/root_disk_resize.log 2>&1
yum install -y cloud-utils-growpart gdisk >> /tmp/root_disk_resize.log 2>&1
# resize partition
growpart -v  ${ROOT_DEVICE} 1   >> /tmp/root_disk_resize.log 2>&1
# resize filesystem
resize2fs -p ${ROOT_DEVICE}1    >> /tmp/root_disk_resize.log 2>&1
# remove epel to avoid to interfere with the rest of the installation
rpm -e epel-release        >> /tmp/root_disk_resize.log 2>&1
...




On Saturday, September 7, 2013 at 12:12:01 AM UTC+2, Sean Mackrory wrote:
>
> Is it possible in packer to edit the size of the root volume in the EC2 
> builders in Packer? This is an option when launching an instance using the 
> Classic Wizard in the AWS Web Console, but I don't see any options that 
> apply to the root volume in the documentation.
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/ebc632b8-1954-44fa-9575-c393c5522f75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to