KVM: qcow2 Disk-Image mit Hilfe von qemu mounten

This post was published 10 years 7 months 27 days ago, so the post may be outdated.

Bei der Virtualisierungstechnologie KVM gibt es verschiedenste Disk-Formate bei der Erstellung zur Auswahl – eines dieser Formate ist qcow2. Nach der Löschung einer KVM Maschine, benötigte ich die Daten der virtuellen Festplatte erneut und hatte zum Glück noch ein Backup zur Hand. Mit Hilfe von qemu-nbd ist es möglich, das Image problemlos in einen Ordner zu mounten.

Das Mounten des Images geht wie folgt:
modprobe nbd max_part=8 # Kernel-Modul laden
qemu-nbd --connect=/dev/nbd0 /home/kvm/100/hdd.qcow2 # Image als Device hinzufügen
mount /dev/nbd0p1 /mnt/ # erste Partition der HDD nach /mnt mounten

Nun kann man einfach auf die Daten unter /mnt/ zugreifen.
Zum Trennen werden folgende Befehle benötigt:

umount /mnt/ # Ordner unmounten
qemu-nbd --disconnect /dev/nbd0 # Device trennen

Patrik Kernstock

May I introduce my self? I am Patrik Kernstock, 25 years old, perfectionist, born in Austria and living in Ireland, Cork. Me explained in short: Tech- and security enthusiast, series & movies junky. Interesting in Linux, Container-stuff and many software solutions by Microsoft, Veeam and VMware.

0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x