Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create multiple partitions within an EBS via HashiCorp Packer

I am trying get an Amazon AMI and add multiple partitions to the EBS volume then generate a new AMI, where I should be able to spin up new EC2 instances using this newly generated AMI. I am attempting this via HashiCorps Packer Tool.

This is the output I expect:

[root@ip-xx-xx-xx-xx ~]# lsblk
NAME                      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
xvda                      202:0    0   200G  0 disk
├─xvda1                   202:1    0    30G  0 part /
├─xvda2                   202:2    0 165.0G  0 part
│ └─appsvg-lv_root (dm-0) 253:0    0    15G  0 lvm  
│ └─appsvg-lv_u001 (dm-1) 253:0    0    50G  0 lvm  /u001
│ └─appsvg-lv_u002 (dm-2) 253:0    0    50G  0 lvm  /u002
│ └─appsvg-lv_u002 (dm-3) 253:0    0    50G  0 lvm  /u003
└─xvda3                   202:3    0   5.0G  0 part [SWAP]

Do I need to use chroot_mount or ami_block_device_mappings (array of block device mappings) or launch_block_device_mappings...

Little confused with this... Any support would be appreciated. Thanks

like image 774
Johnny Timm Avatar asked Dec 11 '25 18:12

Johnny Timm


1 Answers

Use UserData or use a packer shell provisioner to configure LVM

like image 86
Sudharsan Sivasankaran Avatar answered Dec 15 '25 05:12

Sudharsan Sivasankaran



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!