Jump to content











Photo
- - - - -

vMount

vhd

  • Please log in to reply
109 replies to this topic

#101 erwan.l

erwan.l

    Platinum Member

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

Posted 3 weeks ago

dear erwan

thanks again for extending skills of vmount. :good:

it would certainly be helpful if the internal version number was also changed to identify the different files.
the here downloadable file in the forum is still called version 0.8.

dare you and finally give vmount the deserved 1 before the comma. ;)

 

Sincerely   T.

 

Good idea indeed.

Now done  : i will let my IDE handle the build number (autoincrement) and my code will automatically handle this as well.

Now in version 1.0.0.0 :)

 

Also, I have sligthly reviewed latest 2 commands and added 1 new one.

 

You can turn either a VHD/VHDX or (new) a flat disk image file into a VHD/VHDX (fix or dynamic).

You can now also (new) turn a VHD/VHDX (fixed or dynamic) into a flat disk image file.

As source, you can actually even input \\.\physicaldriveX (up to you then to put the disk offline or readonly before).

 

No fancy code here to convert from one format to the other : all I do is read 1MB blocks and feed this into ms virtual disk api who will do it all (VHD<->VHDX, Fixed<->Dynamic, VHD/VHDX<->IMG).

vmount convert2fixed path_to_vhd_or_vhdx_or_img path_to_vhd_or_vhdx
vmount convert2dynamic path_to_vhd_or_vhdx_or_img path_to_vhd_or_vhdx
vmount convert2img path_to_vhd_or_vhdx path_to_img

  • ReTokener likes this

#102 ReTokener

ReTokener

    Frequent Member

  • Developer
  • 157 posts

Posted 2 weeks ago

dear erwan

works very well  on Win10 / PE5:

 

vmount convert2fixed path_to_vhd_or_vhdx_or_img path_to_vhd_or_vhdx
vmount convert2dynamic path_to_vhd_or_vhdx_or_img path_to_vhd_or_vhdx
vmount convert2img path_to_vhd_or_vhdx path_to_img

 

 

 

Testing vmount(1.0) on PE5 (MistyPE and PESE) I stumbled across this output of "vmount partitions" command:

 

 

v1.0
2019-05-03 17:06:19 : File: X:\Program Files\vmount\vmount-win64.exe

2019-05-03 17:06:19 : Command: X:\PROGRA~1\vmount\VMOUNT~2.EXE partitions
C: [Windows]    NTFS    \device\harddisk0\partition2    31991MB         289465344
D: [TMP]    NTFS    \device\harddisk1\partition1    9998MB          1048576
X: [Boot]    NTFS    \Device\Ramdisk{d9b257fc-684e-4dcb-ab79-03cfa2f6b750}0MB             0

 

old version(0.9) returned

 

v0.9
2019-05-03 17:06:46 : File: X:\Program Files\vmount\vmount64.exe

2019-05-03 17:06:46 : Command: X:\PROGRA~1\vmount\vmount64.exe partitions
C: [Windows]    NTFS        \device\harddisk0\partition2    31991MB
D: [TMP]    NTFS        \device\harddisk1\partition1    9997MB
X: [Boot]    NTFS        \Device\Ramdisk{d9b257fc-684e-4dcb-ab79-03cfa2f6b750}    507MB

 

Regards   T.



#103 erwan.l

erwan.l

    Platinum Member

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

Posted 2 weeks ago

dear erwan

works very well  on Win10 / PE5:

 

 

 

 

Testing vmount(1.0) on PE5 (MistyPE and PESE) I stumbled across this output of "vmount partitions" command:

 

 

old version(0.9) returned

 

Regards   T.

 

Good catch !

 

Latest version now includes the starting offset of a partition (the last number on each line).

Now for a partition like a ramdisk...i need to figure this out or simply accept that in this case it will report 0.

 

Also, I was before using getdiskfreespace API to retrieve the partition size but actually result was slightly incorrect and therefore switched to IOCTL_DISK_GET_PARTITION_INFO_EX but then again for a partition like a ramdisk, i need to figure this out :)

 

The output/display matter will be an easy fix : i had not accounted for strings longer than 32 chars...

 

I shall be back shortly with a proper solution !



#104 erwan.l

erwan.l

    Platinum Member

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

Posted 2 weeks ago

New version out fixing the issue reporting by Tokener in previous post.

 

About below commands

vmount convert2fixed path_to_vhd_or_vhdx_or_img path_to_vhd_or_vhdx
vmount convert2dynamic path_to_vhd_or_vhdx_or_img path_to_vhd_or_vhdx
vmount convert2img path_to_vhd_or_vhdx path_to_img

Note that convert2img has been renamed to convert2raw (but convert2img will still work).

Also note that for now there is no progress status : something that will come in a future version.

 

Some examples below :

 

vmount convert2fixed c:\test.vhd c:\test.vhdx

vmount convert2fixed c:\test.vhdx c:\test.vhd

vmount convert2fixed c:\test.img c:\test.vhd

vmount convert2fixed c:\test.img c:\test.vhdx

vmount convert2fixed \\.\physicaldrive1 c:\test.vhdx

vmount convert2fixed \\.\physicaldrive1 c:\test.vhd

 

All above examples would also work with convert2dynamic

 

vmount convert2raw c:\test.vhd c:\test.img

vmount convert2raw c:\test.vhdx c:\test.img

vmount convert2raw c:\test.vhd \\.\physicaldrive1

vmount convert2raw c:\test.vhdx \\.\physicaldrive1

 

When using convert2raw against a physicaldrive, you have to put the drive offline before (using vmount offline disk_numX).


  • ReTokener likes this

#105 erwan.l

erwan.l

    Platinum Member

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

Posted A week ago

Cross posting.

See here an example script to convert a vhd to an iso using vmount.

Some interesting batch usages : retrieve the physicaldrive of the mounted vhd, and the logical drive letter of the created partition.



#106 ReTokener

ReTokener

    Frequent Member

  • Developer
  • 157 posts

Posted 5 days ago

 

 

 

dear erwan

thanks for updating vMount-program.

 

this is what vmount returns now on parameter "partitions":

 

B: [RamDisk]    NTFS    \Device\ImDisk0                 122MB           32256
C: [OSx64]    NTFS    \device\harddisk0\partition1    40952MB         1048576
D: [TMP]    NTFS    \device\harddisk1\partition1    9997MB          1048576
X: [Boot]    NTFS    \Device\Ramdisk{d9b257fc-684e-4dcb-ab79-03cfa2f6b750}           507MB           0

 

 

- \device\harddisk has 32 chars / \Device\Ramdisk has 64 chars.

Under which rule is the name for Ramdisk extended to 64 characters?

 

- each line has a TAB delimiter between [Label] and the rest,

  (in vmount64 all single details were separated by TABs.)

 

this is what vmount returns on parameter "volumes":

 

\\?\Volume{0b91fbc5-6501-11e9-a47c-806e6f6e6963}\

\\?\Volume{640f3fcc-1587-11e9-aa2d-806e6f6e6963}\
D:\

\\?\Volume{3f999bcc-171e-11e9-b7e7-806e6f6e6963}\
C:\

here the output is separated by CR delimiter.

 

Where is the advantage using mixed delimiters?

 

If this behavior is intended then it is so, if not, it would be a great advantage to use TAB delimiters in the output.

This way the output could be splittet with a certain delimiter and the details could be used as parameters for other vmount-commands. - Just a thought.

 

Regards   T.

 

 

 

 

 



#107 erwan.l

erwan.l

    Platinum Member

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

Posted 5 days ago

Hi Retokener,

 

For partitions, if the name is longer than 32 chars, then I go for a 64 chars buffer.

I was originally using tab (or #9) but display was crappy.

Using fixed buffers gives a much better display.

I realise (now?  :) ) that you are may be batching on top of vmount and that 32->64 condition is may be not practical.

if this is the case, feel free to suggest a way that would suit you (and probably others) better.

I could use a delimiter char like "|" but again it becomes hard to read.

 

About volumes, valid point : does not make much sense to adopt different output/layout.

I will use the same layout as "partitions" (and "disks") for all outputs now : how does it sound?

 

Thus, doing so the batch posted (here) may not work anymore :)

Does not matter much and I'll be interested to see how you would retrieve the drive letter in the "volume" based on a filter.

 

Regards,

Erwan


  • ReTokener likes this

#108 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 5 days ago

IMHO, the "right" approach (that should be carved in stone and taught to anyone willing to write a command line program as FIRST thing) is to know that a command line program will be likely used EITHER:
1) interactively (on command line)
OR:
2) automated via batch or other scripting language

As such, EACH and EVERY program should have ALWAYS:
1) a "default" behaviour, VERY human readable
2) a "batch" behaviour, activated by a command line switch (possibly) still human readable AND suitable to be copied/pasted into - say - an Excel or Word table and/or easily parsable from batch (please read as TAB delimited)

AND ADDITIONALY (where applicable):
3) a /v and possibly also a /vv (verbose and very verbose) switches to allow optionally additional output
4) a /s or /c (short or concise) switch to allow optionally to remove for the output *anything* that is not strictly necessary (as an example the initial line(s) with progtam name and version, Author, etc. i.e. anything that would require in a batch FOR loop a "skip=" parameter)
5) in some cases further modifiers "filtering" or "limiting" the output

:duff:
Wonko

P.S. How would you parse the output of the "normal" mountvol command?

Not exactly "simple":

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET M=0
FOR /F "tokens=1 delims= " %%? IN ('MOUNTVOL^|FIND "\"') DO SET /A M+=1&SET L_!M!=%%?
FOR /L %%? IN (1,1,%M%) DO CALL :do_ %%?
GOTO :EOF
:do_
SET /A N=%1+1
IF "!L_%1:~0,4!"=="\\?\" IF "!L_%N%:~-2,2!"==":\" (ECHO !L_%1! mounted as !L_%N%:~-3,3!) ELSE (ECHO !L_%1! NOT MOUNTED)

  • ReTokener likes this

#109 ReTokener

ReTokener

    Frequent Member

  • Developer
  • 157 posts

Posted 5 days ago

 

 

 

dear members / friends

 

I will use the same layout as "partitions" (and "disks") for all outputs now : how does it sound?

yes, sounds very good!

 

 

suitable to be copied/pasted into - say - an Excel or Word table and/or easily parsable from batch (please read as TAB delimited)

sounds very good too!

 

comparing the TAB and the fixed Output:

Compared - TAB- Fixed.jpg

 

Thanks a lot   T.

 

 

 

 

 



#110 erwan.l

erwan.l

    Platinum Member

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

Posted 8 hours ago

3 new commands added in latest version 1.0.0.7

 

vmount changeparttypegpt \\.\PhysicalDriveX part_numY {11223344-1122-1122-AABB-112233445566}
vmount changepartattributesgpt \\.\PhysicalDriveX part_numY $0000000000000000
vmount disklayout \\.\PhysicalDriveX

About changeparttypegpt & changepartattributesgpt :

-Partition types and attributes are documented here.
-The same can be achieved in Clonedisk partition editor.
 
disklayout is "beta" for now but had to be introduced in early phase along so one can actually check the result of changeparttypegpt and changepartattributesgpt.






Also tagged with one or more of these keywords: vhd

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users