29 lines
462 B
Bash
Executable File
29 lines
462 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
RED='\e[31m'
|
|
GREEN='\e[32m'
|
|
YELLOW='\e[33m'
|
|
RESET='\e[0m'
|
|
|
|
img_file="PBX-Test.img"
|
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
echo -e "${RED}You must be root to do this." 1>&2
|
|
exit 100
|
|
fi
|
|
|
|
losetup -fP $img_file
|
|
loop_device=$(losetup -l | grep $img_file | cut -d ' ' -f1)
|
|
echo $loop_device
|
|
|
|
vgchange -a y PBX-vg
|
|
|
|
lvreduce -L 12G -r PBX-vg/root
|
|
|
|
partclone.ext4 -c -s /dev/mapper/PBX--vg-root | lz4 -z >./PBX-root.img.lz4
|
|
|
|
vgchange -a n PBX-vg
|
|
|
|
losetup -D
|