parted /dev/sda print
Per il tipo di partizione GPT comparirà:
export vgname=$(vgscan | grep "Found volume" | cut -f 6 -d " " | sed -e "s/\"//g")
export disk_max=$(parted -s /dev/sda unit mb print free | grep -Ei 'libre|libero|Livre|free' | awk '{print $2/1000}' | cut -d "M" -f1 | awk 'END{print}')
export disk_min=$(parted -s /dev/sda unit mb print free | grep -Ei 'libre|libero|Livre|free' | awk '{print $1/1000}' | cut -d "M" -f1 | awk 'END{print}')
parted -s /dev/sda unit gb mkpart primary $disk_min $disk_max
export partition_number=$(parted -s /dev/sda unit mb print | sort -nk1 | tail -n1 | awk '{ print $1}')
vgextend $vgname /dev/sda$partition_number
lvextend -l +100%FREE /dev/$vgname/root
xfs_growfs /dev/$vgname/root
resize2fs /dev/$vgname/root
Questa procedura è valida per il primo resize. Per i successivi, non essendo possibile effettuare il resize con la partizione principale attiva, contattare il Servizio clienti.
DEBIAN/UBUNTU
#Adding a secondary partition to the primary disk (Debian/Ubuntu)
export disk_max=$(parted -s /dev/sda unit mb print free | grep -Ei 'libre|libero|Livre|free' | awk '{print $2/1000}' | cut -d "M" -f1 | awk 'END{print}')
export disk_min=$(parted -s /dev/sda unit mb print free | grep -Ei 'libre|libero|Livre|free' | awk '{print $1/1000}' | cut -d "M" -f1 | awk 'END{print}')
parted /dev/sda unit GB mkpart primary $disk_min $disk_max
export last_partition=$(parted -s /dev/sda print | grep -v "^$" | awk 'END{print $1}')
vgextend vg01 /dev/sda$last_partition
lvextend -l +100%FREE /dev/vg01/root
resize2fs /dev/vg01/root
CentOS 6
#Adding a secondary partition to the primary disk (CentOs 6)export disk_max=$(parted -s /dev/sda unit mb print free | grep -Ei 'libre|libero|Livre|free' | awk '{print $2/1000}' | cut -d "M" -f1 | awk 'END{print}')
export disk_min=$(parted -s /dev/sda unit mb print free | grep -Ei 'libre|libero|Livre|free' | awk '{print $1/1000}' | cut -d "M" -f1 | awk 'END{print}')
parted /dev/sda unit GB mkpart primary $disk_min $disk_max
reboot
export last_partition=$(parted -s /dev/sda print | grep -v "^$" | awk 'END{print $1}')
vgextend vg01 /dev/sda$last_partition
lvextend -l +100%FREE /dev/vg01/lv_root
resize2fs /dev/vg01/lv_root
CentOS 7
#Adding a secondary partition to the primary disk (CentOs 7)
export disk_max=$(parted -s /dev/sda unit mb print free | grep -Ei 'libre|libero|Livre|free' | awk '{print $2/1000}' | cut -d "M" -f1 | awk 'END{print}')
export disk_min=$(parted -s /dev/sda unit mb print free | grep -Ei 'libre|libero|Livre|free' | awk '{print $1/1000}' | cut -d "M" -f1 | awk 'END{print}')
parted /dev/sda unit GB mkpart primary $disk_min $disk_max
export last_partition=$(parted -s /dev/sda print | grep -v "^$" | awk 'END{print $1}')
vgextend vg01 /dev/sda$last_partition
lvextend -l +100%FREE /dev/vg01/root
xfs_growfs /dev/vg01/root