VirtualBox

Opened 8 years ago

Last modified 8 years ago

#15552 new defect

attaching differencing vhd on host makes it unusable on guest

Reported by: lfmeloman Owned by:
Component: virtual disk Version: VirtualBox 5.0.22
Keywords: Cc:
Guest type: Windows Host type: Windows

Description

When you attach a differencing VHD on Windows host using diskpart or mmc, there's a chance that VBox will no longer understand the format of that VHD. If guest booted, it will see a corrupted filesystem.

I attach my VHD file on Windows 7 host. It's virtual size is 50G and it has one partition formatted to NTFS. I created a dummy VM in VBox GUI to manage snapshots. Currently, the chain consists of 4 image files.

I didn't boot the guest until now. When I did, guest chkdsk spew tons of errors. Then I stopped the guest and attached the VHD on host again. chkdsk showed no errors.

I went further and restored the 'good' backup (there's a backup of all the .vhd and .vbox files I made before the guest boot). Marked the volume as readonly using diskpart and compared the contents of the block device using cygwin. They're indeed different!

Attachments (1)

VBox.log (110.0 KB ) - added by lfmeloman 8 years ago.

Download all attachments as: .zip

Change History (4)

by lfmeloman, 8 years ago

Attachment: VBox.log added

comment:1 by lfmeloman, 8 years ago

In VM settings the disk is attached to a SATA controller with caching=off.

The image hierarchy is not broken. I checked that the output of VBoxManage showhdinfo and detail vdisk matches for each vhd file.

To compare the contents of the block devices I calculate md5sum of each 1Mb chunk using cygwin and put it into a text file, then compare the text files:

# on host
</dev/sdd split -b $((1024*1024)) --filter=md5sum >sums-host.txt

# on guest
</dev/sdb split -b $((1024*1024)) --filter=md5sum >sums-guest.txt

After repeaded attach/detach vdisk and guest boots I can tell that OS does not write to the disk (because I used the diskpart command att vol set readonly). Each incarnation of sums-host or sums-guest does not differ from the previous one, but there's about 2000 different lines between sums-host and sums-guest

Last edited 8 years ago by lfmeloman (previous) (diff)

comment:2 by lfmeloman, 8 years ago

Was able to create a 5Mb archive with such broken image: https://drive.google.com/file/d/0B40Hp1Tx6I6eRGpmV2dsT1ZsMlk/view?usp=sharing

It contains just one file "bigfile". The leaf image is {b4aabbb3-6e63-4be1-806e-9358d6ff848b}.vhd . When attached to host, its md5sum is a4b477f13e6b4f16b422838591e0f789 . When attached to Windows 2012 guest, the checksum is different every time, probably due to corrupted FS.

What I did:

C:\>
mkdir C:\testvhd

diskpart

DISKPART>

create vdisk file=v:\vm\testvhd2\aatestvhd.vhd type=EXPANDABLE maximum=50000
select vdisk file=v:\vm\testvhd2\aatestvhd.vhd
attach vdisk
convert mbr
create partition primary
format fs=ntfs label="testvhd" quick
assign mount=C:\testvhd


REM create bigfile (write random data at random positions)

detach vdisk

REM add aatestvhd.vhd to the VM

REM create snapshot

select vdisk file=v:\vm\testvhd2\Snapshots\{190fa42d-e3a6-4043-9da5-f0171dc208cc}.vhd
attach vdisk

REM update bigfile (write random data at random positions)

detach vdisk
REM create snapshot

select vdisk file=v:\vm\testvhd2\Snapshots\{1f05a118-d620-4113-834d-ab17a62ecfba}.vhd
attach vdisk

REM update bigfile

detach vdisk
REM create snapshot

select vdisk file=v:\vm\testvhd2\Snapshots\{4c40c3ab-fcfe-4a52-af73-1a6e29c476d4}.vhd
attach vdisk

REM update bigfile

detach vdisk
REM create snapshot

select vdisk file=v:\vm\testvhd2\Snapshots\{b4aabbb3-6e63-4be1-806e-9358d6ff848b}.vhd
attach vdisk

list vol
sel vol 6
att vol set readonly
detach vdisk
Last edited 8 years ago by lfmeloman (previous) (diff)

comment:3 by aeichner, 8 years ago

Thanks for provided image, I'll have a look at it.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use