Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resize the root filesystem during AMI creation with packer?

I faced the the problem that some apache logs filled so quick that the root filesystem was not big enough.

I am using an AMI created with packer and centos 6.

How can I resize the root FS during the AMI creation to have it ready for later usage?

like image 349
Alex Avatar asked Dec 08 '25 10:12

Alex


1 Answers

You can just add a Block Device Mapping insi

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

You must check you AMI which device name use it could be /dev/sda1 or /dev/xvda

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html

like image 94
Jefferson Avatar answered Dec 11 '25 13:12

Jefferson