Root volume size

1,362 views
Skip to first unread message

Pierre Freund

unread,
Dec 22, 2016, 5:05:21 AM12/22/16
to Packer
Hello,

I would like to create an AMI of a database with data inside, for dev environments. I am using Terraform / Packer / Chef-solo.
The chef receipe download dumps from S3, and load it into the mongodb database.

I can't find how to tell Packer that my root volume device should be like 30Go, and not the default value 8Go.

The EBS-backed documentation shows how to add another disk with "launch_block_device_mappings", but I don't want to add a new one and make all the filesystems command.
If I try to modify xvda, Packer tells me that the volume is already in use.

I just want to set the root volume size, as it is possible natively in AWS.

How can I do ?

Thanks,

Pierre Freund

Loren Gordon

unread,
Dec 22, 2016, 7:01:04 AM12/22/16
to Packer
I do that with "launch_block_device_mappings". An example is below. The "device_name" for the root device will depend a bit on the underlying AMI, and whether it is PVM or HVM, but it should be the same as the Root Device Name associated with the AMI itself.

            "launch_block_device_mappings": [
                {
                    "device_name": "/dev/sda1",
                    "delete_on_termination": true,
                    "volume_size": 20,
                    "volume_type": "gp2"
                }
            ],

-Loren

Pierre Freund

unread,
Dec 22, 2016, 9:15:48 AM12/22/16
to packe...@googlegroups.com
Thanks very much.

I tried lot of combinations, I thought I tried this one, but obviously not :)

For debian 8 hvm, the right configuration is :

            "launch_block_device_mappings": [
                {
                    "device_name": "/dev/xvda",

--
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 a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/45tyuM68vWo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/d3670898-45e7-4bcc-981e-e4bca951eeea%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

ZillaYT

unread,
Jun 13, 2019, 2:36:17 PM6/13/19
to Packer
This setting doesn't work for me, I still get the default 8G AWS AMI partition.

amazon-ebs: xvda    202:0    0    8G  0 disk

amazon-ebs: └─xvda1 202:1    0    8G  0 part /

To unsubscribe from this group and all its topics, send an email to packe...@googlegroups.com.

Rickard von Essen

unread,
Jun 13, 2019, 3:44:42 PM6/13/19
to packe...@googlegroups.com
How do your template look like? 

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 packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/7169e9f3-6018-4b79-9090-23bd851272fa%40googlegroups.com.

ZillaYT

unread,
Jun 13, 2019, 5:32:56 PM6/13/19
to Packer
Like this (some info committed). I use AWS Ubuntu AMI ami-024a64a6685d05041 as my base AMI

{

 "variables" : {

   "aws_access_key" : "{{ env `AWS_ACCESS_KEY_ID` }}",

   "aws_secret_key" : "{{ env `AWS_SECRET_ACCESS_KEY` }}",

   "ssh_private_key" : "{{ env `SSH_PRIVATE_KEY` }}",

   "aws-ami-us-east-1" : "{{ env `AWS_BASE_AMI` }}"

 },

 "builders" : [

   {

      "type": "amazon-ebs",

      "ssh_username": "ubuntu",

   ....other info removed...

       "launch_block_device_mappings" : [

       {

          "device_name" : "/dev/xvda",

         "delete_on_termination" : true,

          "volume_size" : 50,

          "volume_type" : "gp2"

        },

        {

          "device_name" : "/dev/xvdb",

         "delete_on_termination" : true,

          "volume_size" : 500,

          "volume_type" : "gp2"

        }
     ],

     "provisioners" : [{...}[

To unsubscribe from this group and stop receiving emails from it, send an email to packe...@googlegroups.com.

ZillaYT

unread,
Jun 13, 2019, 5:54:17 PM6/13/19
to Packer
Ah, this worked

       {

         "device_name" : "/dev/sda1",

        "delete_on_termination" : true,

         "volume_size" : 250,

         "volume_type" : "gp2"

       },

Reply all
Reply to author
Forward
0 new messages