This project is read-only.

Scanning directories on a VHD return different results when mounting the VHD file and using the OS filesystem

Jul 18, 2012 at 4:46 PM

I created a virtual HD using Windows 7 Pro, SP1.  I then applied a Windows 7 Pro (Gold) image from a WIM file to this VHD.  Mounting both the WIM and VHD files and then scanning the directory structures results in identical results.  Examining the directory structure of the WIM file using DiscUtils also results in similar results (there is a dir which the OS file system returns an access denied exception and the DiscUtils virtual WIM doesn't). Examining the directory structure of the VHD file using DiscUtils results in a radically different result.  There are multiple directories which the DiscUtils.Vhd does not see which the OS filesystem as well as the DiscUtils.Wim do.

Please let me know what other information I can provide to help demonstrate this.

David D. Hall

Jul 29, 2012 at 1:48 PM

Hi,

I've tried to reproduce this, but don't see any real problems, comparing the output of DIR with the output of enumerating the folders using DiscUtils.  The folder '\Users\All Users' doesn't enumerate in DiscUtils, but this is because there's no support for SYMLINK / SYMLINKD reparse points in DiscUtils.  Can you provide more details on which folders are missing?

Thanks,

Ken

Aug 1, 2012 at 1:05 PM

Ken, when I use the VDH class to recursively spin through all the directories in a .VHD partition what I get is shown below:

\ - files: 0
fileCount: 0
 dirCount: 1
emptyDirs: 1
populatedDirs: 0

On the otherhand, when I mount the VHD via the Management snap-in and run the same code (except using DiskInfo objects where I used DiscDiskInfo objects), I get what is shown below:

$RECYCLE.BIN\ - files: 0
$RECYCLE.BIN\S-1-5-21-1802859667-647903414-1863928812-571646\ - files: 1
Access to the path 'D:\CSharpTest\MountVHD\System Volume Information\' is denied.
Boot\ - files: 6
Boot\cs-CZ\ - files: 1
Boot\da-DK\ - files: 1
Boot\de-DE\ - files: 1
Boot\el-GR\ - files: 1
Boot\en-US\ - files: 2
Boot\es-ES\ - files: 1
Boot\fi-FI\ - files: 1
Boot\Fonts\ - files: 5
Boot\fr-FR\ - files: 1
Boot\hu-HU\ - files: 1
Boot\it-IT\ - files: 1
Boot\ja-JP\ - files: 1
Boot\ko-KR\ - files: 1
Boot\nb-NO\ - files: 1
Boot\nl-NL\ - files: 1
Boot\pl-PL\ - files: 1
Boot\pt-BR\ - files: 1
Boot\pt-PT\ - files: 1
Boot\ru-RU\ - files: 1
Boot\sv-SE\ - files: 1
Boot\tr-TR\ - files: 1
Boot\zh-CN\ - files: 1
Boot\zh-HK\ - files: 1
Boot\zh-TW\ - files: 1
D:\CSharpTest\MountVHD\ - files: 2
fileCount: 38
 dirCount: 29
emptyDirs: 1
populatedDirs: 28

The .VHD file is the System Reserved partition from a standard Windows 7 installation.

I could send you the C# project and the VHD file if I had an email address.  Please let me know if I can provide further information.

David D. Hall

Aug 1, 2012 at 1:08 PM

Ken, some additional information:

1) the .VHD was created by Windows 7 and originally mounted via the management snap-in.
2) the .VHD was "populated" by applying a .WIM image to it.
3) the dir and file counts from the mounted .VHD agree with the dir and file counts from the .WIM file
4) information gathered using DiscUtils WIM file support agrees with informatio gathered from a mounted .WIM file.

David D. Hall

Aug 4, 2012 at 2:37 PM

Those files are marked Hidden/System - have you tried setting the NTFS options in discutils to include hidden / system files?

        fs.NtfsOptions.HideHiddenFiles = false;
        fs.NtfsOptions.HideSystemFiles = false;

Ken

Aug 6, 2012 at 3:20 PM

That was indeed the piece that I was missing.

Thanks so much!
David