Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


kvm_repair_qcow2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
kvm_repair_qcow2 [2015/05/22 11:24] – [KVM repair qcow2 image] adminkvm_repair_qcow2 [2021/10/09 15:14] (current) – external edit 127.0.0.1
Line 1: Line 1:
 {{tag>[kvm qcow2 repair]}} {{tag>[kvm qcow2 repair]}}
-~~TOC~~ 
  
 =====KVM repair qcow2 image===== =====KVM repair qcow2 image=====
Line 22: Line 21:
 Image end offset: 27071414272</code> Image end offset: 27071414272</code>
   * Check again, if you're lucky you might try to boot the VM in rescue mode and repair the fileystem there.   * Check again, if you're lucky you might try to boot the VM in rescue mode and repair the fileystem there.
-  * If not, try to mount the image with nbd and fix it:<code>modprobe nbd max_part=16+  * If not, try to mount the image with nbd and fix it (eg. with testdisk):<code>modprobe nbd max_part=16
 qemu-nbd -c /dev/nbd0 image.qcow2 qemu-nbd -c /dev/nbd0 image.qcow2
 partprobe /dev/nbd0 partprobe /dev/nbd0
 mount /dev/nbd0p1 /mnt/image</code> mount /dev/nbd0p1 /mnt/image</code>
 +  * Or with guestfish:<code>yum install libguestfs-tools
 + guestfish --rw -a vmflow.qcow2
 +
 +Welcome to guestfish, the guest filesystem shell for
 +editing virtual machine filesystems and disk images.
 +
 +Type: 'help' for help on commands
 +      'man' to read the manual
 +      'quit' to quit the shell
 +
 +> run
 +> list-filesystems
 +/dev/sda1: ext4
 +> mount /dev/sda1 /
 +</code>
  
  
kvm_repair_qcow2.txt · Last modified: 2021/10/09 15:14 by 127.0.0.1