Skip to main content

Creating Disk Image

qemu-img convert -f qcow2 -O raw PBX.qcow2 PBX.img

# Shrink the internal partitions
# gparted and lvm idr go google it u chud
losetup -fP PBX.img
vgchange -a y PBX-vg
lvreduce -L 13G -r PBX-vg/root
lvreduce -L 976M PBX-vg/swap_1
gparted /dev/loop0
vgchange -a n PBX-vg
losetup -d /dev/loop0


fdisk -l ./PBX.img

# Change first number to be the ending sector from fdisk
fdisk PBX.img
truncate --size=$[(#ChangeME+100)*512] PBX.img

# Set the output dir to your USB stick to save time writing to local disk and rewriting againt to USB
dd if=PBX.img bs=64M conv=sync status=progress | lz4 -z > /mnt/USB/Images/PBX.img.lz4