tech:cloud_lvm_autoresize_partition_pv

Cloud LVM autoresize partition PV

#! /bin/bash
 
PV_PART=$(pvdisplay -c |cut -d: -f1 |awk '{print $1}' |head -1)
PV_DISK="${PV_PART/[0-9]/}"
parted -s "$PV_DISK" print fix > /dev/null
PARTNB_EXTENDED=$(parted -s "$PV_DISK" print |awk '/extended$/ {print $1}')
PARTNB_LVM=$(parted -s "$PV_DISK" print |awk '/lvm$/ {print $1}')
 
if [ ! -z ${PARTNB_EXTENDED+x} ]; then parted "$PV_DISK" resizepart "$PARTNB_EXTENDED" 100% ; fi
parted -s "$PV_DISK" resizepart "$PARTNB_LVM" 100%
pvresize "$PV_PART"

A corriger :

  • Si plusieurs PV. Car head -1 n'est pas une solution

Fonctionnalité à ajouter

  • UEFI ?
  • Lancement via cloudinit
tech/cloud_lvm_autoresize_partition_pv.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki