Open ajay-sudosu opened 3 months ago
we have 3 templates for Ubuntu, two produce raw images (flat, LVM) and the other one (cloudimg) gives you a TGZ image. Raw images have a fixed partition table defined in the template, so you probably should use the cloudimg
template.
Ok so cloudimg template worked fine now partitions are as it is, but is there a way I can manage it with .iso format because I have my own downloaded iso image? I dont see any fixed partition table defined in the template for LVM?
This is the lvm template:
source "qemu" "lvm" {
boot_command = ["
build { sources = ["source.qemu.lvm"]
provisioner "file" { destination = "/tmp/curtin-hooks" source = "${path.root}/scripts/curtin-hooks" }
provisioner "shell" { environment_vars = ["HOME_DIR=/home/ubuntu", "http_proxy=${var.http_proxy}", "https_proxy=${var.https_proxy}", "no_proxy=${var.no_proxy}"] execute_command = "echo 'ubuntu' | {{ .Vars }} sudo -S -E sh -eux '{{ .Path }}'" expect_disconnect = true scripts = ["${path.root}/scripts/curtin.sh", "${path.root}/scripts/networking.sh", "${path.root}/scripts/cleanup.sh"] }
post-processor "compress" { output = "custom-ubuntu-lvm.dd.gz" } }
No, you cannot use an ISO, the cloudimg
template requires a pre-installed image.
In the lvm
template, the storage layout is defined in ubuntu/user-data-lvm
. Currently we set the layout to lvm
and let Subiquity (the Ubuntu installer) to do auto-partition of the disk, but you can change this (see docs)
Can I forbid the subiquity not to change the existing paritititons of the machine?
This is the user-data-lvm:
autoinstall: version: 1 identity: hostname: ubuntu username: ubuntu password: "$6$canonical.$0zWaW71A9ke9ASsaOcFTdQ2tx1gSmLxMPrsH0rF0Yb.2AEKNPV1lrF94n6YuPJmnUy2K2/JSDtxuiBDey6Lpa/" keyboard: layout: us variant: '' ssh: install-server: true storage: grub: update_nvram: true swap: size: 0 layout: name: lvm late-commands:
Now, if I am changing the format of layout from lvm to direct , packer is not able to create image. I just don't want the partitions to change after I deploy the image created by packer.
use the flat
template instead, the result is a tgz-image that should work for you
Tried with flat file also. Actually while deploying the Custom ubuntu OS at the time of installing os I ssh into the machine and I saw my partitons were as it is like below: sda 8:0 0 36.4T 0 disk ├─sda1 8:1 0 512M 0 part /tmp/tmpfobid504/target/boot/efi └─sda2 8:2 0 36.4T 0 part /tmp/tmpfobid504/target sdb 8:16 0 18.2T 0 disk └─sdb1 8:17 0 300G 0 part /tmp/tmpfobid504/target/var/test
But when system reboots this is all gone.
Could there be an issue of cloud config that is auto configure partitions after reboot?
In tha above case I created a partition as /var/test in 'sdb' block of size 300Gb:
I think there's a misconception about how disk partitioning works. MAAS won't leave the disk as they were, it will either apply the Storage Layout configured for this machine or use the partitioning defined by the image (in case you use a raw
image)
I am confused how MAAS Ubuntu image is doing the same, MAAS provided Ubuntu image is not changing any configurations of the machines. Can you please brief about how MAAS provided Ubuntu image was created like the way Custom image is being created using packer.
Official Ubuntu images are not built using packer, but the install process is roughly the same:
For non-raw images (flat, cloudimg), the final disk layout should be what you see in the machines's Storage
tab in MAAS, not what existed before. Please check if MAAS has the desired layout, and file a bug for MAAS if the end result is not what you set there.
Creating a custom Ubuntu image using packer and deploying it on a server machine. Before deploying this custom image lets say I have a partitions on dev/sda and dev/sdb/test but after deploying this custom image my partitions are changed as below: sda 8:0 0 36.4T 0 disk ├─sda1 8:1 0 512M 0 part /boot/efi ├─sda2 8:2 0 1G 0 part /boot └─sda3 8:3 0 6.5G 0 part └─ubuntu--vg-ubuntu--lv 253:0 0 6.5G 0 lvm /
It is providing 6.5G to root I dont why deployment is changing my partitions. I am using the packer repo at: https://github.com/canonical/packer-maas.