Um ein Proxmox VMA Backup (.vma.lzo) außerhalb von Proxmox zu mounten, müssen vorher noch einige Pakete installiert werden.
Zum testen verwende ich ein Debian 8.6 x64 und ein VMA Backup Image eines Linux Servers.
Das Proxmox Repository einbinden um die benötigten Pakete zu erhalten.
$ echo deb "http://download.proxmox.com/debian jessie pve-no-subscription" >> /etc/apt/sources.list $ wget -O- "http://download.proxmox.com/debian/key.asc" | apt-key add - $ apt-get update
Wir downloaden das pve-qemu-kvm Paket.
$ apt-get download pve-qemu-kvm
Entpacken daraus nur die vma binary.
$ dpkg --fsys-tarfile ./pve-qemu-kvm_2.7.1-1_amd64.deb | tar xOf - ./usr/bin/vma > /usr/bin/vma
Die vma binary ausführbar machen.
$ chmod u+x /usr/bin/vma
Zuletzt noch die restlichen benötigten Pakete und Abhängigkeiten installieren.
$ apt install libaio1 librbd1 libiscsi4 glusterfs-common libjemalloc1 lzop
Die Vorbereitungen sind hiermit abgeschlossen. (vma und lzop lassen sich ohne Fehlermeldungen aufrufen)
$ vma usage: vma command [command options] vma list <filename> vma config <filename> [-c config] vma create <filename> [-c config] pathname ... vma extract <filename> [-r <fifo>] <targetdir> vma verify <filename> [-v] $ lzop Lempel-Ziv-Oberhumer Packer Copyright (C) 1996 - 2010 lzop v1.03 Markus Franz Xaver Johannes Oberhumer Nov 1st 2010 Usage: lzop [-dxlthIVL19] [-qvcfFnNPkUp] [-o file] [-S suffix] [file..] Commands: -1 compress faster -9 compress better -d decompress -x extract (same as -dPp) -l list compressed file -I display system information -t test compressed file -V display version number -h give this help -L display software license Options: -q be quiet -v be verbose -c write on standard output -oFILE write output to 'FILE' -p write output to current dir -pDIR write to path 'DIR' -f force overwrite of output files -n do not restore the original file name (default) -N restore the original file name -P restore or save the original path and file name -S.suf use suffix .suf on compressed files -U delete input files after successful operation (like gzip and bzip2) file.. files to (de)compress. If none given, try standard input.
Das Backup Image kopieren wir uns auf die lokale Maschine.
$ cp /path/to/backup/vzdump-qemu-108-2017_01_10-19_15_51.vma.lzo .
Das LZO Archiv entpacken. (wie erhalten dann ein VMA Archiv)
$ lzop -d ./vzdump-qemu-108-2017_01_10-19_15_51.vma.lzo # nach dem entpacken $ ls -la -rwxr-xr-x 1 root root 4574130688 Jan 10 19:15 vzdump-qemu-108-2017_01_10-19_15_51.vma -rwxr-xr-x 1 root root 1617646282 Jan 12 20:25 vzdump-qemu-108-2017_01_10-19_15_51.vma.lzo
Das VMA Archiv entpacken. (wie erhalten eine .raw und eine .conf Datei)
$ vma extract ./vzdump-qemu-108-2017_01_10-19_15_51.vma -v ./vm-108 # nach dem entpacken $ ls -la ./vm-108 -rw-r--r-- 1 root root 16106127360 Jan 12 20:32 disk-drive-virtio0.raw -rw-r--r-- 1 root root 799 Jan 12 20:28 qemu-server.conf
Die Partitionen des Images anzeigen lassen.
$ fdisk -l disk-drive-virtio0.raw Disk disk-drive-virtio0.raw: 15 GiB, 16106127360 bytes, 31457280 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x22d08280 Device Boot Start End Sectors Size Id Type disk-drive-virtio0.raw1 * 2048 30076927 30074880 14.3G 83 Linux disk-drive-virtio0.raw2 30078974 31455231 1376258 672M 5 Extended disk-drive-virtio0.raw5 30078976 31455231 1376256 672M 82 Linux swap / Solaris
Wir mounten die gewünschte Partition. (erste Partiton raw1, Startsektor 2048, Größe 14,3 GB)
$ mkdir /mnt/vm-108 $ mount disk-drive-virtio0.raw /mnt/vm-108 -o offset=$((2048*512))
Der Inhalt des gemounteten Images.
$ ls -la /mnt/vm-108/ drwxrwxr-x 2 root root 4096 Nov 3 06:39 bin drwxr-xr-x 3 root root 4096 Oct 23 15:01 boot drwxr-xr-x 4 root root 4096 Oct 23 14:52 dev drwxr-xr-x 91 root root 4096 Dec 27 06:29 etc drwxr-xr-x 3 root root 4096 Oct 23 15:01 home lrwxrwxrwx 1 root root 31 Oct 23 14:54 initrd.img -> /boot/initrd.img-3.16.0-4-amd64 drwxr-xr-x 14 root root 4096 Oct 23 14:56 lib drwxr-xr-x 2 root root 4096 Oct 23 14:52 lib64 drwx------ 2 root root 16384 Oct 23 14:51 lost+found drwxr-xr-x 3 root root 4096 Oct 23 14:51 media drwxr-xr-x 3 root root 4096 Oct 23 15:25 mnt drwxr-xr-x 2 root root 4096 Oct 23 14:51 opt drwxr-xr-x 2 root root 4096 Sep 12 06:09 proc drwx------ 3 root root 4096 Dec 4 13:41 root drwxr-xr-x 2 root root 4096 Oct 23 15:01 run drwxr-xr-x 2 root root 4096 Oct 23 16:04 sbin drwxr-xr-x 2 root root 4096 Oct 23 14:51 srv drwxr-xr-x 2 root root 4096 Apr 6 2015 sys drwxrwxrwt 7 root root 4096 Jan 10 18:40 tmp drwxr-xr-x 10 root root 4096 Oct 23 14:51 usr drwxr-xr-x 13 root root 4096 Oct 23 19:31 var lrwxrwxrwx 1 root root 27 Oct 23 14:54 vmlinuz -> boot/vmlinuz-3.16.0-4-amd64
Nicht wirklich komfortabel aber es geht. (Anleitung aus dem Proxmox Forum.)
Sehr hilfreicher artikel – vielen Dank dafür !
Freut mich, danke. :)
Auch Jahre später immer noch äußerst hilfreich und zugleich gutes Anschauungsmaterial, wie sich zur Not einzelne Binaries aus Paketen nutzen lassen, ohne gleich das ganze Paket – oder im Falle von proxmox gar die gesamte Oberfläche – installieren zu müssen. Vielen Dank auch von mir
geht aber deutlich einfacher.
#!/bin/bash
echo "vmaRecover 1.0"
if [ -z ${1} ] || [ -z ${2} ] || [ "$1" == "-h" ] ; then
echo "vmaRecover.sh [clean]"
echo "Working dir contains subfolder with raw_image and loop folder for mounting file Systems."
exit 0
fi
file=$1
workingDir=$(echo "$2" | sed 's:/*$::')
recSubDir=/raw_image
if [ "${3}" == "clean" ]; then
echo "============================================================"
echo "Cleanup"
echo "============================================================"
echo Unmounting loop-Devices
umount ${workingDir}/loop*
losetup -D
echo remove ${workingDir}${recSubDir}
rm -r ${workingDir}${recSubDir}
echo remove ${workingDir}/loop*
rm -r ${workingDir}/loop*
exit 0
fi
if [ ! -f "$file" ]; then
echo "File does not exist: $file"
exit 1
fi
if [ -d "${workingDir}${recSubDir}" ]; then
echo "Folder must not exist: ${workingDir}${recSubDir}"
exit 1
fi
echo "============================================================"
echo "Extracting $file to ${workingDir}${recSubDir}"
echo "============================================================"
mkdir -p ${workingDir}
zstd -q -d -c ${file} | vma extract -v - ${workingDir}${recSubDir}
echo "============================================================"
echo "Create Loop Devices"
echo "============================================================"
loop=$(shuf -i 10-50 -n1)
rawFile=$(find ${workingDir}${recSubDir} -name "*.raw")
losetup /dev/loop${loop} ${rawFile}
sleep 1
partx -v --add /dev/loop${loop}
readarray parts < <(ls -1 /dev/loop${loop}p*)
echo "============================================================"
echo "Mount Image"
echo "============================================================"
for part in "${parts[@]}"
do
mkdir -p ${workingDir}/${part##*/}
mount ${part} ${workingDir}/${part##*/}
echo "Partition mounted: ${workingDir}/${part##*/}"
done
mount //192.168.178.254/Freigabe ${workingDir}/smb -o user=USER