[Openstack-operators] Diskimage-builder lvm

Andreas Scheuring scheuran at linux.vnet.ibm.com
Tue Mar 27 07:52:52 UTC 2018


Hi, I recently did it like this:


For Ubuntu: Cherry picked: https://review.openstack.org/#/c/504588/


export DIB_BLOCK_DEVICE_CONFIG='
  - local_loop:
      name: image0
      size: 3GB

  - partitioning:
      base: image0
      label: mbr
      partitions:
        - name: root
          flags: [ boot, primary ]
          size: 100%
  - lvm:
      name: lvm
      pvs:
        - name: pv
          options: ["--force"]
          base: root

      vgs:
        - name: vg
          base: ["pv"]
          options: ["--force"]

      lvs:
        - name: lv_root
          base: vg
          size: 1800M

        - name: lv_tmp
          base: vg
          size: 100M

        - name: lv_var
          base: vg
          size: 500M

        - name: lv_log
          base: vg
          size: 100M

        - name: lv_audit
          base: vg
          size: 100M

        - name: lv_home
          base: vg
          size: 200M
  - mkfs:
      name: root_fs
      base: lv_root
      label: cloudimage-root
      type: ext4
      mount:
        mount_point: /
        fstab:
          options: "defaults"
          fsck-passno: 1

'

# See https://bugs.launchpad.net/ubuntu/+source/lvm2/+bug/1573982
# See https://bugs.launchpad.net/diskimage-builder/+bug/1715686 <https://bugs.launchpad.net/diskimage-builder/+bug/1715686>
# need to specify lvm2 module to include it into the ramdisk
disk-image-create -p lvm2 ubuntu-minimal


# -> During boot the kernel was still not able to find the root disk (identified along uuid)
# Executing the following command in the initramfs emergency shell made the volume appear for me
$ vgchange -ay
$ blkid
# /dev/vda1: UUID="O11hwE-0Efq-SwO7-Bko8-hVe6-jyOT-7UAiza" TYPE="LVM2_member" PARTUUID="7885c310-01"
# /dev/mapper/vg-lv_root: LABEL="cloudimage-root" UUID="bd6d2d2c-3ca6-4032-99fc-bf20e246e22a" TYPE=“ext4”
exit



Maybe things are going more smoothly with other distros, or maybe things have been fixed in the meanwhile… Or I did something wrong…

Good luck!

---
Andreas Scheuring (andreas_s)



On 26. Mar 2018, at 17:43, Ignazio Cassano <ignaziocassano at gmail.com> wrote:

Hi all,
I read diskimage-builder  documentatio but is not clear for me how I can supply lvm configuration to the command. 
Some yaml files are supplied but diskimage seems to expect json file.
Please, could anyone post an example? 
Regards
Ignazio

_______________________________________________
OpenStack-operators mailing list
OpenStack-operators at lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-operators/attachments/20180327/87bf80ef/attachment.html>


More information about the OpenStack-operators mailing list