← history for chapter-7/disk-increase.sh
98d214a6chapter-7/disk-increase.sh10 lines⬡ raw↓ download
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#! /bin/bash -x

MACHINE_NAME="my-machine" # whatever your machine or 'domain' in the Libvirt jargon
BACKUP_IMAGE="/var/lib/libvirt/images/${MACHINE_NAME}.qcow2-backup"
CURRENT_IMAGE="/var/lib/libvirt/images/${MACHINE_NAME}.qcow2"
PRIMARY_DISK="/dev/sda1" # The partition to enlarge

# Make image 40G in size:

qemu-img create -f qcow2 -o preallocation=metadata ${CURRENT_IMAGE} 40G