Jump to content











Photo
* * * * * 1 votes

vMount

vhd

  • Please log in to reply
188 replies to this topic

#176 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 2849 posts
  • Location:Nantes - France
  •  
    France

Posted 3 weeks ago

Just a short note about my previous comment:

with usebackq and by passing to findstr (which accepts arguments without quotes) I found the batch solution to get the volume number from the disk number via diskpart:

@echo off
SETLOCAL EnableExtensions enabledelayedexpansion

SET DSK=1
for /F "usebackq tokens=2" %%a in (`"(echo select disk %DSK% ^& echo detail disk) | diskpart | findstr Partition"`) do (set VOLN=%%a)
echo VOLUME NUMBER FOR DISK %DSK% IS: %VOLN%

Sometimes taking a break is really useful ^_^

 

Cheers,

V.

 

Not willing to spoil the fun (well done, really) but keep in in mind that one disk can have multiple volumes : what happens then?

 

/Erwan



#177 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 2849 posts
  • Location:Nantes - France
  •  
    France

Posted 3 weeks ago

Also, also not related to how to map volumes and drives, referencing here a script around vmount where i go from the output ot attachvhd (giving me a disk number), then mapping it to a logical drive letter.

 

Once you have a logical drive letter, you are not too far away from a volume guid...

 

PS : wondering how much time before I get slapped by Wonko about probably misusing disk and drive keywords :)

 

EDIT : link fixed.

rem get drive letter
FOR /F "tokens=* USEBACKQ" %%F IN (`vmount-win64 attachvhd %vhd%`) DO (
SET drive=%%F
)
...
echo %drive:~17,1%
rem get drive letter
FOR /F "tokens=* USEBACKQ" %%F IN (`vmount-win64 devices Harddisk%drive:~17,1%`) DO (
SET letter=%%F
)
echo %letter%
...


#178 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 2849 posts
  • Location:Nantes - France
  •  
    France

Posted 3 weeks ago

Latest vmount version will dislay the disk number "behind" a volume (NEW).

If need be, i could also add the partition number.

 

Hopefully I did not introduce any nasty bugs as this is monday (back to work) and it has been a while I did not put my fingers on vmount :)

 

vmount-win64 volumes
#;VolumeGuid;Drive;VolName;FS;Size;Disk
0;\\?\Volume{e26e7b15-122a-11e7-82bf-806e6f6e6963}\;;[R'serv' au systSme];NTFS;349MB;0
1;\\?\Volume{876ebd81-ce10-11e8-8334-94de80c2a41e}\;E:\;[DATA];NTFS;152624MB;1
2;\\?\Volume{c91f3411-92db-11ea-835b-001a7dda7113}\;G:\;[];NTFS;510MB;2
3;\\?\Volume{e26e7b16-122a-11e7-82bf-806e6f6e6963}\;C:\;[SYSTEME];NTFS;114126MB;0
4;\\?\Volume{c3ccf19b-9cbc-11e8-8325-806e6f6e6963}\;D:\;;;;;

To sum it up, we have the volume options (above) where we have the volume guid, the logical driver letter and the disk number (and possibly the partition number if one asks gently).

 

From a disk number, you can jump to a partition or device, and from there (based on the drive letter), you can jump to a volume using FOR /F "tokens=* USEBACKQ" %%F IN ...

 

Next to volumes, where you can get pretty much everything in one go (guid, letter, disk number...), we also have the disks, partitions and devices options.

 

Volumes can be filtered on guid field (NEW).

Disks can be filtered on the productid field.

Partitions is filtered on the device field.

Devices is filtered on the drive field.

vmount-win64 disks
DiskNr;SN;ProductId;Size;Type;Removable
0;[01020304];WDC_WDS120G2G0A-00JH30;114480MB;SATA;NON-REMOVABLE
1;[56B682DC];Hitachi_HDP725016GLA380;152627MB;SATA;NON-REMOVABLE
2;[D1842729];Virtual_Disk;512MB;UNKNOWN;NON-REMOVABLE
vmount-win64 partitions
Drive;VolName;FS;Device;Size
C:;[SYSTEME];NTFS;\device\harddisk0\partition2;114126MB
E:;[DATA];NTFS;\device\harddisk1\partition1;152625MB
G:;[];NTFS;\device\harddisk2\partition1;511MB
R:;[RAMDRIVE];NTFS;\device\imdisk0;1024MB
vmount-win64 devices
Device;Drive;size
\device\harddisk2\partition1;G:;511MB;
\device\harddisk0\partition1;;350MB;
\device\harddisk0\partition2;C:;114126MB;
\device\harddisk1\partition1;E:;152625MB;

  • ReTokener likes this

#179 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 2849 posts
  • Location:Nantes - France
  •  
    France

Posted 3 weeks ago

 

Dear Erwan,

I have further tested "attachvhd" and "partitions" commands and have a couple of things to report.

Imagine attaching a vhd file, with NOLETTER option; from the "vmount attachvhd" output you get the new disk number.
The same new disk in "vmount disks" output which has maybe never been attached before.

The partition in the vhd is not mounted yet and, to be able to see mount points in Windows Disk Manager, you want to mount it with:

vmount assign x:\ \\?\Volume{GUID}\
vmount assign x:\mount\ \\?\Volume{GUID}\

There seems to be no way to get the Volume{GUID} information as it is avaliable only from within "vmount volumes" but it's shown only if the volumes are already mounted ( and as volume letters, not paths ).

 

 

I cannot reproduce it right now on my win10.

If i attach a vhd with noletter, i can see it listed in my volumes.

Normally, if there is a recognizable filesystem on the disk, I believe windows will always assign it a volume.

Similar to inserting a USB key ?



#180 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 2849 posts
  • Location:Nantes - France
  •  
    France

Posted 3 weeks ago

I am afraid I have edited (instead of quoted) Virgus post 175 and I see no way back :(

 

@Virgus : terribly sorry about that :(

Hopefully this post was quoted later on by somebody else (but me) and these last posts will still make sense.

Time to end it there : sticky finders...



#181 virgus

virgus

    Newbie

  • Members
  • 20 posts
  •  
    Italy

Posted 3 weeks ago

Hello Erwan I'll reply going backwards...

 

#180

I am afraid I have edited (instead of quoted) Virgus post 175 and I see no way back :(

@Virgus : terribly sorry about that :(

 

I've seen that the comment 174 was cut in half, never mind. The important thing is that you could read it.

In the first part I was thanking Wonko and Maro for their tips which helped me quite a lot actually (some results also in comment #175).

Hope they'll read about my gratitude for their help here :)

 

#179

I cannot reproduce it right now on my win10.

If i attach a vhd with noletter, i can see it listed in my volumes.

I'm using it on a W7 Ultimate x64 and unfortunately unmounted volumes don't appear. Nor do volumes mounted to a folder path.

And also mounted A: volume does not appear, while B: volume is there...

 

Normally, if there is a recognizable filesystem on the disk, I believe windows will always assign it a volume.

I made another test: I removed every mountpoint detached the VHD and then re-attached and no mountpoints are created. So that's fine, vMount behaves correctly, I must have messed with all the tests I've done. :merc:

 

#178

Latest vmount version will dislay the disk number "behind" a volume (NEW).

If need be, i could also add the partition number.

 

[...] (and possibly the partition number if one asks gently).

:hyper: Great to hear that !!! Thanks!
:loleverybody: Yes please, we'll be greateful for life :yahoo:
 
#177

Also, also not related to how to map volumes and drives, referencing here a script around vmount where i go from the output ot attachvhd (giving me a disk number), then mapping it to a logical drive letter.

 

Once you have a logical drive letter, you are not too far away from a volume guid...

Your url in the link has been messed up I think, but I got the idea.

 

I suppose that the difference between W7 and W10 with volume command created many of my issues.

Hope that you have a spare W7 install to test it. Or please, if I could help somehow with debug info, don't hesitate to ask.

 

#176

Not willing to spoil the fun (well done, really) but keep in in mind that one disk can have multiple volumes : what happens then?

 

:dubbio: Good point, I confess that the objection popped into my mind but at the moment I'm burnt and cannot think about vhds with more than one partition :hmm:

 

Thanks for your good news and for the detailed replies

(and to those precious ones of Wonko's and Maro's as well)

and talk to you soon!

V.


Edited by virgus, 3 weeks ago.


#182 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15278 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 3 weeks ago

There is still (IMHO) the issue with the "other" name for volumes, i.e. the \\?\Device\HarddiskVolumen

 

If you could try on a same machine, both the vmount with the various options:

vmount-win64 volumes

vmount-win64 disks

vmount-win64 partitions

vmount-win64 devices

 

And dd --list

http://www.chrysocome.net/dd

http://www.chrysocom...dd-0.6beta3.zip

 

In my little batches I didn't use those names but dd --list lists them just fine.

 

 

Spoiler

 

And both Olof's dosdev:

http://www.ltr-data.se/opencode.html/

 

 

 

C:\appoggio\diskparttests>OLdosdev.exe /Q C: D: E: G: H: I: J:
C: => \Device\HarddiskVolume1
D: => \Device\HarddiskVolume2
E: => \Device\Harddisk2\DP(1)0-0+8
G: => \Device\Harddisk3\DP(1)0-0+9
H: => \Device\Harddisk4\DP(1)0-0+a
I: => \Device\CdRom0
J: => \Device\Harddisk5\DP(1)0-0+b

and MS own dosdev:

http://priede.bf.lu....RPT_CLUSTER.EXE

 

C:\appoggio\diskparttests>MSdosdev.exe
C: = \Device\HarddiskVolume1 [Fixed]
D: = \Device\HarddiskVolume2 [Fixed]
E: = \Device\Harddisk2\DP(1)0-0+8 [Removable]
G: = \Device\Harddisk3\DP(1)0-0+9 [Removable]
H: = \Device\Harddisk4\DP(1)0-0+a [Removable]
I: = \Device\CdRom0 [CDRom]
J: = \Device\Harddisk5\DP(1)0-0+b [Removable]

 

use the "other" names.

 

:duff:

Wonko



#183 ReTokener

ReTokener

    Frequent Member

  • Developer
  • 241 posts

Posted 3 weeks ago

Dear Erwan

thanks a lot for enhancing vmount tool.

We really appreciate this a lot.

 

Best regards   T.


  • erwan.l and virgus like this

#184 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 2849 posts
  • Location:Nantes - France
  •  
    France

Posted 3 weeks ago

Dear Erwan

thanks a lot for enhancing vmount tool.

We really appreciate this a lot.

 

Best regards   T.

 

Thanks ReTokener for your kind words :)

Always a pleasure to contribute over here !


  • virgus likes this

#185 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 2849 posts
  • Location:Nantes - France
  •  
    France

Posted 3 weeks ago

 

#178

:hyper: Great to hear that !!! Thanks!
:loleverybody: Yes please, we'll be greateful for life :yahoo:
 
 

 

Done, latest version now displays both disk# and part#.

As always, disks start at index 0 while part start at index 1.

vmount-win64 volumes
#;VolumeGuid;Drive;VolName;FS;Size;Disk#;Part#
0;\\?\Volume{e26e7b15-122a-11e7-82bf-806e6f6e6963}\;;[R'serv' au systSme];NTFS;349MB;0;1
1;\\?\Volume{876ebd81-ce10-11e8-8334-94de80c2a41e}\;E:\;[DATA];NTFS;152624MB;1;1
2;\\?\Volume{e26e7b16-122a-11e7-82bf-806e6f6e6963}\;C:\;[SYSTEME];NTFS;114126MB;0;2
3;\\?\Volume{c3ccf19b-9cbc-11e8-8325-806e6f6e6963}\;D:\;;;;;

  • ReTokener and virgus like this

#186 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 2849 posts
  • Location:Nantes - France
  •  
    France

Posted 3 weeks ago

There is still (IMHO) the issue with the "other" name for volumes, i.e. the \\?\Device\HarddiskVolumen

 

....

:duff:

Wonko

 

You mean like done in CloneDisk.

 

Yes, I need to figure out the different (multiple) ways to word a (NT or DOS or ???) device name.

Is there a standard or convention even?

 

0aT5jOt.png


  • virgus likes this

#187 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15278 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 3 weeks ago

Is there a standard or convention even?

IF there is one, it is not at all clear, the dd --list is the only program AFAICR that lists *all* possible names, possibly also Olof's dosdev with the "right" comand lines but its output is "huge" and not easily parsable.

 

The "rule" must be EITHER:

"Win32 Available Volume Information" <- according to dd --list

\Device\HarddiskVolumen

OR

"NT Block Device Objects" <- according to dd --list

\\?\Device\Harddiskm\Partition

OR both :w00t:,

 

and the instant you decide if #1,#2 or both, you encounter this (JFYI):

http://reboot.pro/to...ssible/?p=88825

 

For our common uses, the \Device\HarddiskVolumen provides not any particularly useful info (besides a possible name/id that could be used in other command line programs), whilst:

\\?\Device\Harddiskm\Partitionn additionally tells us on which disk it is.

 

Ideally it could be a parameter/switch to show the one or the other name (or both), depending on uses.

 

:duff:

Wonko


  • virgus likes this

#188 ReTokener

ReTokener

    Frequent Member

  • Developer
  • 241 posts

Posted 3 weeks ago

 

Done, latest version now displays both disk# and part#.

As always, disks start at index 0 while part start at index 1.

A man of his word.  :thumbup:

Thank you Erwan

 

Sincerely   T.


  • virgus likes this

#189 virgus

virgus

    Newbie

  • Members
  • 20 posts
  •  
    Italy

Posted 3 weeks ago

EDIT : link fixed.

Very interesting experiment! I'll try asap to do the same. :fine:

 

Done, latest version now displays both disk# and part#.

As always, disks start at index 0 while part start at index 1.

Thanks, great job !!! Looking forward to test the new version :jump:


Edited by virgus, 3 weeks ago.






Also tagged with one or more of these keywords: vhd

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users