Skip to content

Instantly share code, notes, and snippets.

@vadimkozhin
Forked from shamil/mount_qcow2.md
Last active July 15, 2023 13:14
Show Gist options
  • Save vadimkozhin/d367938e85cb74d969486cff23a10c9c to your computer and use it in GitHub Desktop.
Save vadimkozhin/d367938e85cb74d969486cff23a10c9c to your computer and use it in GitHub Desktop.

Revisions

  1. vadimkozhin revised this gist Jul 15, 2023. No changes.
  2. vadimkozhin revised this gist Jul 15, 2023. No changes.
  3. @shamil shamil revised this gist Jul 15, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions mount_qcow2.md
    Original file line number Diff line number Diff line change
    @@ -24,3 +24,4 @@ edit files, or recover something without the virtual machine running.

    umount /mnt/somepoint/
    qemu-nbd --disconnect /dev/nbd0
    rmmod nbd
  4. @shamil shamil revised this gist Jul 15, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mount_qcow2.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ edit files, or recover something without the virtual machine running.

    modprobe nbd max_part=8

    **Step 2- Connect the QCOW2 as network block device**
    **Step 2 - Connect the QCOW2 as network block device**

    qemu-nbd --connect=/dev/nbd0 /var/lib/vz/images/100/vm-100-disk-1.qcow2

  5. @shamil shamil created this gist Jul 15, 2014.
    26 changes: 26 additions & 0 deletions mount_qcow2.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    How to mount a qcow2 disk image
    -------------------------------

    This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords,
    edit files, or recover something without the virtual machine running.

    **Step 1 - Enable NBD on the Host**

    modprobe nbd max_part=8

    **Step 2- Connect the QCOW2 as network block device**

    qemu-nbd --connect=/dev/nbd0 /var/lib/vz/images/100/vm-100-disk-1.qcow2

    **Step 3 - Find The Virtual Machine Partitions**

    fdisk /dev/nbd0 -l

    **Step 4 - Mount the partition from the VM**

    mount /dev/nbd0p1 /mnt/somepoint/

    **Step 5 - After you done, unmount and disconnect**

    umount /mnt/somepoint/
    qemu-nbd --disconnect /dev/nbd0