Storage LVM on bare metal server

Hi ,

i would like to create specific logical volume when i create a new server.
i can create specific LV and and mount in a specific mountpath in MAAS UI but i don’t find how create a logical volume and a mount this lv with maas cli , do you have example for make that

The process using the maas-cli it’s quite tedious.
Try this steps (sorry I can’t post the output now):

  1. Get block-device id of yout hard drives:
    maas $login block-devices read $system_id

  2. (OPTIONAL) Create partition to allocate lvm:
    maas $login partitions create $system_id $device_id size=$size

  3. Create Volume Group (VG):
    maas $login volume-groups create $system_id name=$name partitions=$id_partition
    or
    maas $login volume-groups create $system_id name=$name block_devices=$id_block-device

  4. Create Logical Volume (LV):
    maas $login volume-group create-logical-volume $system_id $vg_id name=$name size=$size

  5. Format the LV:
    maas $login block-device format $system_id $id_lv fstype=$fs

  6. Mount the LV:
    maas $login block-device mount $system_id $id_lv mount_point=$mp mount_options=$mo

Note: You can open the webui on the machine storage and see in realtime the changes of the commands.