手当たり次第に書くんだ

飽きっぽいのは本能

Ubuntu 20.04 autoinstallation

目次に戻る

概要

前提条件

OS

Ubuntu 20.04を使用します。

storage

qemu-kvm libvirt-daemon-system

storage

シングルディスク構成

  storage:
    config:

    # 1. disk
    - ptable: gpt
      path: /dev/sda
      wipe: superblock
      preserve: false
      name: ''
      grub_device: false
      type: disk
      id: disk-sda

    # 2. /boot/efi, partition-0, format-0, mount-0
    - device: disk-sda
      size: 1G
      wipe: superblock
      flag: boot
      number: 1
      preserve: false
      grub_device: true
      type: partition
      id: partition-0
    - fstype: fat32
      volume: partition-0
      preserve: false
      type: format
      id: format-0
    - path: /boot/efi
      device: format-0
      type: mount
      id: mount-0

    # 3. /boot, partition-1, format-1, mount-1
    - device: disk-sda
      size: 1.5G
      wipe: superblock
      flag: ''
      number: 2
      preserve: false
      grub_device: false
      type: partition
      id: partition-1
    - fstype: ext4
      volume: partition-1
      preserve: false
      type: format
      id: format-1
    - path: /boot
      device: format-1
      type: mount
      id: mount-1

    # 4. lvm, partition-2, lvm_volgroup-0
    - device: disk-sda
      size: -1
      wipe: superblock
      flag: ''
      number: 3
      preserve: false
      grub_device: false
      type: partition
      id: partition-2
    - name: vg0
      devices:
      - partition-2
      preserve: false
      type: lvm_volgroup
      id: lvm_volgroup-0

    # 5. /, lvm_partition-0, format-3, mount-3
    - name: vg0-root
      volgroup: lvm_volgroup-0
      size: -1
      wipe: superblock
      preserve: false
      type: lvm_partition
      id: lvm_partition-0
    - fstype: ext4
      volume: lvm_partition-0
      preserve: false
      type: format
      id: format-3
    - path: /
      device: format-3
      type: mount
      id: mount-3

複数ディスク構成

  storage:
    config:

    # 1. disk
    - ptable: gpt
      path: /dev/sda
      wipe: superblock
      preserve: false
      name: ''
      grub_device: false
      type: disk
      id: disk-sda
    - ptable: gpt
      path: /dev/sdb
      wipe: superblock
      preserve: false
      name: ''
      grub_device: false
      type: disk
      id: disk-sdb

    # 2. /boot/efi, partition-0, format-0, mount-0
    - device: disk-sda
      size: 1G
      wipe: superblock
      flag: boot
      number: 1
      preserve: false
      grub_device: true
      type: partition
      id: partition-0
    - fstype: fat32
      volume: partition-0
      preserve: false
      type: format
      id: format-0
    - path: /boot/efi
      device: format-0
      type: mount
      id: mount-0

    # 3. /boot, partition-1, format-1, mount-1
    - device: disk-sda
      size: 1.5G
      wipe: superblock
      flag: ''
      number: 2
      preserve: false
      grub_device: false
      type: partition
      id: partition-1
    - fstype: ext4
      volume: partition-1
      preserve: false
      type: format
      id: format-1
    - path: /boot
      device: format-1
      type: mount
      id: mount-1

    # 4. lvm
    - device: disk-sda
      size: -1
      wipe: superblock
      flag: ''
      number: 3
      preserve: false
      grub_device: false
      type: partition
      id: partition-2
    - name: vg0
      devices:
      - partition-2
      preserve: false
      type: lvm_volgroup
      id: lvm_volgroup-0
    - device: disk-sdb
      size: -1
      wipe: superblock
      flag: ''
      number: 4
      preserve: false
      grub_device: false
      type: partition
      id: partition-3
    - name: vg0
      devices:
      - partition-3
      preserve: false
      type: lvm_volgroup
      id: lvm_volgroup-1

    # 5. /, lvm_partition-0, format-3, mount-3
    - name: vg0-root
      volgroup: lvm_volgroup-0
      size: -1
      wipe: superblock
      preserve: false
      type: lvm_partition
      id: lvm_partition-0
    - fstype: ext4
      volume: lvm_partition-0
      preserve: false
      type: format
      id: format-3
    - path: /
      device: format-3
      type: mount
      id: mount-3

    # 6. /home, lvm_partition-1, format-4, mount-4
    - name: vg1-home
      volgroup: lvm_volgroup-1
      size: -1
      wipe: superblock
      preserve: false
      type: lvm_partition
      id: lvm_partition-1
    - fstype: ext4
      volume: lvm_partition-1
      preserve: false
      type: format
      id: format-4
    - path: /
      device: format-4
      type: mount
      id: mount-4

autoinstallの補足

基本的にtype:partition, format, mountで構成されます。LVMの場合はtype:lvm_volgroup, lvm_partitionが使用されます。

sizeに-1を指定すると限界値を割り当てます。

ブートパーティションはflag: bootとなります。

ディスク設定例

  storage:
    config:
    # Disk
    - ptable: gpt
      path: /dev/sda
      wipe: superblock
      preserve: false
      name: ''
      grub_device: false
      type: disk
      id: disk-sda
    - path: /dev/sdb
      wipe: superblock
      preserve: false
      name: ''
      grub_device: false
      type: disk
      id: disk-sdb

    # /boot/efi
    # partition-0: 1G
    - device: disk-sda
      size: 1G
      wipe: superblock
      flag: boot
      number: 1
      preserve: false
      grub_device: true
      type: partition
      id: partition-0
    # format-0: fat32
    - fstype: fat32
      volume: partition-0
      preserve: false
      type: format
      id: format-0
    # mount-0:
    - path: /boot/efi
      device: format-0
      type: mount
      id: mount-0

    # /boot
    # partition-1: 1.5G
    - device: disk-sda
      size: 1.5G
      wipe: superblock
      flag: ''
      number: 2
      preserve: false
      grub_device: false
      type: partition
      id: partition-1
    - fstype: ext4
      volume: partition-1
      preserve: false
      type: format
      id: format-1
    - path: /boot
      device: format-1
      type: mount
      id: mount-1

    # LVM
    # partition-2: LVM Physical Volume (PV), use up
    - device: disk-sda
      size: -1
      wipe: superblock
      flag: ''
      number: 3
      preserve: false
      grub_device: false
      type: partition
      id: partition-2
    # lvm_volgroup-0: LVM Volume Group (VG)
    - name: ubuntu-vg
      devices:
      - partition-2
      preserve: false
      type: lvm_volgroup
      id: lvm_volgroup-0
    # lvm_volgroup-1: LVM Volume Group (VG)
    - name: vg0
      devices:
      - disk-sdb
      preserve: false
      type: lvm_volgroup
      id: lvm_volgroup-1

    # /
    # lvm_partition-0: LVM Logical Volume(LV), use up
    - name: ubuntu-lv
      volgroup: lvm_volgroup-0
      size: 18861785088B
      wipe: superblock
      preserve: false
      type: lvm_partition
      id: lvm_partition-0
    # format-4: ext4
    - fstype: ext4
      volume: lvm_partition-0
      preserve: false
      type: format
      id: format-4
    # mount-4:
    - path: /
      device: format-4
      type: mount
      id: mount-4

    # /
    # lvm_partition-1: LVM Logical Volume(LV), use up
    - name: lv-0
      volgroup: lvm_volgroup-1
      size: 21470642176B
      wipe: superblock
      preserve: false
      type: lvm_partition
      id: lvm_partition-1
    # format-3: ext4
    - fstype: ext4
      volume: lvm_partition-1
      preserve: false
      type: format
      id: format-3
    # mount-3:
    - path: /home
      device: format-3
      type: mount
      id: mount-3

目次に戻る

Ubuntu 20.04 autoinstallation

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)

トップへ戻る