Meld Homepage , Electronic PCB PCBA , Software .NET AVR PLM BOM , Network TCP UDP MQTT , Microcontrollers AVR ARM , Powersupplys Switchmode , Nursecall MC5000 CD2000

Date: 2025-03-03
Updated: 2025-03-03
Author: Erik Leth Danielsen
disk recovery ddrescue testdisk ntfsfix virt-v2v

disk recovery ddrescue testdisk ntfsfix virt-v2v


Error when loading windows7 img in linux KVM Virt Manager



Short

eld@deb12eld:~$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0 111,8G  0 disk
├─sda1        8:1    0   100M  0 part
└─sda2        8:2    0 111,7G  0 part
sdb           8:16   1     0B  0 disk
nvme0n1     259:0    0 465,8G  0 disk
├─nvme0n1p1 259:1    0   512M  0 part /boot/efi
└─nvme0n1p2 259:2    0 465,3G  0 part /
eld@deb12eld:~$
eld@deb12eld:~$ sudo ddrescue -d /dev/sda /home/virt/xx.img /home/virt/xx.log
[sudo] password for eld:
GNU ddrescue 1.27
Press Ctrl-C to interrupt
Initial status (read from mapfile)
rescued: 52756 kB, tried: 917504 B, bad-sector: 0 B, bad areas: 0

Current status
     ipos:  120034 MB, non-trimmed:  204275 kB,  current rate:    174 MB/s
     opos:  120034 MB, non-scraped:        0 B,  average rate:   3784 kB/s
non-tried:    6361 MB,  bad-sector:        0 B,    error rate:    131 kB/s
  rescued:  113468 MB,   bad areas:        0,        run time:  8h 18m 50s
pct rescued:   94.52%, read errors:     3103,  remaining time:         50s
                              time since last successful read:          0s
Copying non-tried blocks... Pass 1 (forwards)
     ipos:   52822 kB, non-trimmed:  220856 kB,  current rate:    106 MB/s
     opos:   52822 kB, non-scraped:        0 B,  average rate:   3916 kB/s
non-tried:    2206 MB,  bad-sector:        0 B,    error rate:    131 kB/s
  rescued:  117607 MB,   bad areas:        0,        run time:  8h 19m 56s
pct rescued:   97.97%, read errors:     3356,  remaining time:         53s
                              time since last successful read:          0s
Copying non-tried blocks... Pass 2 (backwards)
     ipos:  119719 MB, non-trimmed:  228458 kB,  current rate:  21037 kB/s
     opos:  119719 MB, non-scraped:        0 B,  average rate:   3982 kB/s
non-tried:        0 B,  bad-sector:        0 B,    error rate:    720 kB/s
  rescued:  119805 MB,   bad areas:        0,        run time:  8h 21m  2s
pct rescued:   99.80%, read errors:     3472,  remaining time:         10s
                              time since last successful read:          0s
Copying non-tried blocks... Pass 5 (forwards)
     ipos:  119997 MB, non-trimmed:        0 B,  current rate:    607 kB/s
     opos:  119997 MB, non-scraped:    9675 kB,  average rate:   3955 kB/s
non-tried:        0 B,  bad-sector:    2190 kB,    error rate:    9728 B/s
  rescued:  120022 MB,   bad areas:     4268,        run time:  8h 25m 31s
pct rescued:   99.99%, read errors:     7751,  remaining time:         13s
                              time since last successful read:          0s
Trimming failed blocks... (forwards)
     ipos:  119997 MB, non-trimmed:        0 B,  current rate:       0 B/s
     opos:  119997 MB, non-scraped:        0 B,  average rate:   3879 kB/s
non-tried:        0 B,  bad-sector:    7971 kB,    error rate:    6656 B/s
  rescued:  120026 MB,   bad areas:     2774,        run time:  8h 35m 27s
pct rescued:   99.99%, read errors:    19042,  remaining time:          0s
                              time since last successful read:          4s
Scraping failed blocks... (forwards)
Finished
eld@deb12eld:~$

run it 2. time
eld@deb12eld:/home/virt$ sudo ddrescue -d /dev/sda /home/virt/xx.img /home/virt/xx.log
[sudo] password for eld:
GNU ddrescue 1.27
Press Ctrl-C to interrupt
Initial status (read from mapfile)
rescued: 120026 MB, tried: 7971 kB, bad-sector: 7971 kB, bad areas: 2774

Current status
     ipos:        0 B, non-trimmed:        0 B,  current rate:       0 B/s
     opos:        0 B, non-scraped:        0 B,  average rate:       0 B/s
non-tried:        0 B,  bad-sector:    7971 kB,    error rate:       0 B/s
  rescued:  120026 MB,   bad areas:     2774,        run time:          0s
pct rescued:   99.99%, read errors:        0,  remaining time:         n/a
                              time since last successful read:         n/a

Finished
eld@deb12eld:/home/virt$

eld@deb12eld:/home/virt$ sudo testdisk xx.img
TestDisk 7.1, Data Recovery Utility, July 2019
Christophe GRENIER 
https://www.cgsecurity.org
eld@deb12eld:/home/virt$

eld@deb12eld:/home/virt$ sudo fdisk -lu xx.img
Disk xx.img: 111,79 GiB, 120034123776 bytes, 234441648 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: 0xf8db52da

Device     Boot  Start       End   Sectors   Size Id Type
xx.img1    *      2048    206847    204800   100M  7 HPFS/NTFS/exFAT
xx.img2         206848 234438655 234231808 111,7G  7 HPFS/NTFS/exFAT
eld@deb12eld:/home/virt$

eld@deb12eld:/home/virt$ sudo mount -o loop,offset=$((206848 * 512))  xx.img /home/eld/Downloads/mnt
eld@deb12eld:/home/virt$ sudo umount /home/eld/Downloads/mnt

eld@deb12eld:/home/virt/images$ sudo ntfsfix -n xx.img //doesn't work
[sudo] password for eld:
Mounting volume... NTFS signature is missing.
FAILED
Attempting to correct errors... NTFS signature is missing.
FAILED
Failed to startup volume: Invalid argument
NTFS signature is missing.
Trying the alternate boot sector
Unrecoverable error
Volume is corrupt. You should run chkdsk.
No change made
eld@deb12eld:/home/virt/images$

eld@deb12eld:/home/virt$ sudo losetup -P -f xx.img
eld@deb12eld:/home/virt$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0 111,8G  0 loop 
├─loop0p1   259:3    0   100M  0 part 
└─loop0p2   259:4    0 111,7G  0 part 
sda           8:0    1     0B  0 disk 
nvme0n1     259:0    0 465,8G  0 disk 
├─nvme0n1p1 259:1    0   512M  0 part /boot/efi
└─nvme0n1p2 259:2    0 465,3G  0 part /
eld@deb12eld:/home/virt/images$

eld@deb12eld:/home/virt$ sudo mount /dev/loop0p2 /home/eld/Downloads/mnt
eld@deb12eld:/home/virt$ sudo umount /home/eld/Downloads/mnt

eld@deb12eld:/home/virt$ sudo ntfsfix /dev/loop0p2
Mounting volume... OK
Processing of $MFT and $MFTMirr completed successfully.
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/loop0p2 was processed successfully.
eld@deb12eld:/home/virt$

eld@deb12eld:/home/virt$ sudo losetup -d /dev/loop0 //delete loop

err: The Conversion to to KVM crashes:
eld@deb12eld:/home/virt$ sudo virt-v2v -i disk xx.img -o local -os /var/tmp

err: I also tried converting the img to QCOW2 this it didn't work:
eld@deb12eld:/home/virt$ sudo qemu-img convert -f raw -O qcow2 xx.img /home/virt/images/xx.qcow2
Back

Sources
Ddrescue: https://www.youtube.com/watch?v=jwMoIuLCfLE&t=246s
Gnome disk, Fdisk: https://www.youtube.com/watch?v=-1sUypbvewM
Loop: https://www.youtube.com/watch?v=tJtzSFOzLnE
Virt-v2v: https://libguestfs.org/virt-v2v.1.html
Privacy Policy © MELDCO APS | skovsgaardsparken 6 | 8362 hoerning | E-mail: info2@meldco.dk | VAT ID: 34576149 473458