Jump to content











Photo
- - - - -

Mount hard disk images at startup...

vhd img imdisk startup

Best Answer ppgrainbow , 25 August 2016 - 11:40 PM

Anyways, I enter this command at startup:

 

 

 

imdisk -a -f C:\DOS\BOOT\VOLUME\NETDRV0.IMG -v 1 -P -m G:
imdisk -a -f C:\DOS\BOOT\VOLUME\NETDRV1.IMG -v 1 -P -m H:

 

And now that I hidden the directory C:\DOS\BOOT\VOLUME, I can access the virtual drives G: and H: at startup! :)

 

The drives that I mounted at startup can be found in \HEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Service\ImDisk\Paramenters

 

In the registry key, it tells what drive letters (DriveLetterX) have been mounted and the hard disk image (filenameX) that gets mounted at startup. The registry also tells how many devices have been loaded (LoadDevices) and the image offset in bytes (ImageOffset). An image offset of 32,256 bytes (31.5 KB) translate to a image offset of 63 sectors and lastly the size of the drive in bytes. Since it's a FAT16 formatted hard disk image, each of the drives have 2,146,927,104 bytes (1.9995 GB) of disk space. CHKDSK reports the drive having 65,510 total clusters at 32 KB per cluster

 

I'm gonna try to mount the hard disk images again and as a folder mounting point to see if this procedure works as well.

 

Edit:It worked! I used this command to mount the hard disk images as a folder mounting point

imdisk -a -f C:\DOS\BOOT\VOLUME\NETDRV0.IMG -v 1 -P -m C:\DOS\NETWORK\DRIVE.0
imdisk -a -f C:\DOS\BOOT\VOLUME\NETDRV1.IMG -v 1 -P -m C:\DOS\NETWORK\DRIVE.1

 

If I want to stop mounting the hard disk images at startup, I would just delete the registry keys inside \HEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Service\ImDisk\Paramenters

 

If Olaf is seeing this, there needs to be a much easier way to mount hard disk images as a virtual drive or virtual folder mount point at startup! :)

Go to the full post


  • Please log in to reply
18 replies to this topic

#1 ppgrainbow

ppgrainbow

    Member

  • Members
  • 70 posts

Posted 24 August 2016 - 11:01 AM

Hey there! :hello:

 

I have a question regarding how to overcome the three IDE hard disk limit in Virtual PC 2007.

 

I already created two more 2 GB VHD hard disk images and I want to mount them as drives G: and H: and I want to be able to mount the drives at startup.

 

However, the draw back is that in any event that I log out, the mounted drives disappear and I need to find a way to forcefully dismount them.

 

Is there a way to mount the newly created hard disk images at startup and to find a way to prevent the mounted drives from disappearing when I log off? If so, how can it be done?

 

I've noticed that only Gizmo Drive mounts the hard disk images (VHDs and IMGs) at startup, but it's not 100% reliable.



#2 Rootman

Rootman

    Frequent Member

  • Advanced user
  • 382 posts
  • Location:USA

Posted 24 August 2016 - 12:12 PM

Could you create ONE drive (the third drive) and instead of making it ONE partition create 3 or more partitions on it? The same way you would partition a physical HDD?  That way there is ONE 'physical' drive represented by ONE disk file with several partitions mounted under the drive letters you want.



#3 ppgrainbow

ppgrainbow

    Member

  • Members
  • 70 posts

Posted 24 August 2016 - 07:26 PM

Could you create ONE drive (the third drive) and instead of making it ONE partition create 3 or more partitions on it? The same way you would partition a physical HDD?  That way there is ONE 'physical' drive represented by ONE disk file with several partitions mounted under the drive letters you want.

 

That sounds like a possibility. However, all three IDE hard disk images have been created.

 

I can mount the hard disk images using the "Mount as ImDisk Virtual Disk" found in the context menu.

 

One example is that I would like to mount a 2 GB FAT16 formatted VHD located at C:\DOS\FILES\DISK\Network Disk 1.vhd. The Mount New Virtual Hard Disk shows up and it assigns drive letter G:. ImDisk detects it as a hard disk and when I press OK, drive G: shows up in the Windows Explorer.

 

I need to find a way how it would be possible to mount a hard disk image at startup using the ImDisk command line since it's not possible to mount it at startup using the GUI interface.


Edited by ppgrainbow, 24 August 2016 - 07:26 PM.


#4 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 24 August 2016 - 07:28 PM

 

I need to find a way how it would be possible to mount a hard disk image at startup using the ImDisk command line since it's not possible to mount it at startup using the GUI interface.

http://reboot.pro/to...s-no-gui-shown/

 

More general:

imdisk -a -f "<your disk or drive image filename>" -m #:

 

The #: is for "assign a letter automatically".

 

To generate IMDISK command line help:
imdisk 2>imdiskhelp.txt

 

 

 

:duff:

Wonko



#5 cdob

cdob

    Gold Member

  • Expert
  • 1469 posts

Posted 24 August 2016 - 10:05 PM

I need to find a way how it would be possible to mount a hard disk image at startup

There are registry settings too. The disk image is mounted at driver start.
http://reboot.pro/to...it/#entry176658

However this was about a floppy like image.
No idea about a VHD hard disk image. Do you require a hard disk like image?

#6 ppgrainbow

ppgrainbow

    Member

  • Members
  • 70 posts

Posted 25 August 2016 - 01:49 AM

There are registry settings too. The disk image is mounted at driver start.
http://reboot.pro/to...it/#entry176658

However this was about a floppy like image.
No idea about a VHD hard disk image. Do you require a hard disk like image?

 

Thank you for the help. I do require a hard disk like image. :)



#7 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 25 August 2016 - 08:02 AM

Thank you for the help. I do require a hard disk like image. :)

Try mounting the disk with the -v switch and with the -P one, and check Registry.

What happens with (say):

imdisk -a -f "<your disk or drive image filename>" -v 1 -P -m #:

 

:duff:

Wonko



#8 v77

v77

    Silver Member

  • Team Reboot
  • 602 posts
  •  
    France

Posted 25 August 2016 - 08:48 AM

@ppgrainbow

 

The command given by Wonko may work (and is the most efficient) if you are using a fixed size VHD.
This command directly instructs the driver to mount the image file at startup (thanks to the -P switch).

Otherwise, as you are seemingly using the Toolkit, you already have the required executable to do it: DiscUtilsDevio.exe, located in the installation folder.
Start it in a command prompt to get the syntax help.
Now, you just have to create a scheduled task with this program and the proper arguments, something like:
"C:\Program Files (x86)\ImDisk\DiscUtilsDevio.exe" /filename="C:\DOS\FILES\DISK\Network Disk 1.vhd" /mount=G:

Don't forget to check "Run whether user is logged on or not", and "Run with highest privileges".
And in the settings, uncheck "Stop the task if it runs longer than".

Note that the drive letter may not be properly displayed by Explorer. If so, type G: in the address bar to see whether the drive exists.



#9 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 25 August 2016 - 11:26 AM

@v77

I am failing to find a reference to the IMDISK Toolkit  :unsure:

 

Assuming that we are talking of "pure" IMDISK and of a particular with a single partition/volume in it) VHD disk image of the "Fixed" type, (that IMDISK would consider a plain RAW image with a "Conectix" sector appended that will be ignored), 2 Gb in size (and most probably with a FAT16 or FAT32 formatted volume) for the sake of discussion/fun, how would IMDISK autodetect a MakeBootFat disk image? :dubbio:

 

As a partitioned media or as a superfloppy? 

 

In any case, (for ppgrainbow's interest which may want to rethink about the "requirement" for a hard disk image) no matter if the source is a superfloppy or a hard disk image, what is mounted and will be accessible through IMDISK will ALWAYS and ONLY be the volume (actually a "subset" of a volume, since what IMDISK makes doesn't even "hook" on the Mount Manager), so if the hard disk "form" is actually required it would be a good idea to switch to another driver such as Arsenal IMage Mounter (also by Olof) that will expose an actual hard disk like device.

 

:duff:

Wonko



#10 v77

v77

    Silver Member

  • Team Reboot
  • 602 posts
  •  
    France

Posted 25 August 2016 - 11:48 AM

I am failing to find a reference to the IMDISK Toolkit   :unsure:

 

He says: "ImDisk detects it as a hard disk". In the control panel interface, the device type remains on "Auto", no matter the loaded file. It's not the case for my interface (in fact, "Hard Disk" is just set by default, and I change the type according to the selected file).



#11 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 25 August 2016 - 01:22 PM

He says: "ImDisk detects it as a hard disk". In the control panel interface, the device type remains on "Auto", no matter the loaded file. It's not the case for my interface (in fact, "Hard Disk" is just set by default, and I change the type according to the selected file).

I see :), and there is no "Hard Disk" at all in IMDISK control panel, at the most there is "Harddisk Volume".

 

:duff:

Wonkio



#12 cdob

cdob

    Gold Member

  • Expert
  • 1469 posts

Posted 25 August 2016 - 02:18 PM

I do require a hard disk like image.

Imdisk dosn't provide a hard disk, one volume only.
Do you require a hard disk at running virtual machine, visible at disk manager?

Which operating system do you use at the virtual machine?
https://support.micr...en-us/kb/831461
https://blogs.msdn.m...irtual-pc-2007/
What about native VHD drivers?

#13 ppgrainbow

ppgrainbow

    Member

  • Members
  • 70 posts

Posted 25 August 2016 - 08:16 PM

Try mounting the disk with the -v switch and with the -P one, and check Registry.

What happens with (say):

imdisk -a -f "<your disk or drive image filename>" -v 1 -P -m #:

 

:duff:

Wonko

 

Thank you for the help. I'll do some research and try the command out. :)



#14 ppgrainbow

ppgrainbow

    Member

  • Members
  • 70 posts

Posted 25 August 2016 - 08:20 PM

Imdisk dosn't provide a hard disk, one volume only.
Do you require a hard disk at running virtual machine, visible at disk manager?

Which operating system do you use at the virtual machine?
https://support.micr...en-us/kb/831461
https://blogs.msdn.m...irtual-pc-2007/
What about native VHD drivers?

 

What I was refering to was a hard disk image and the operating system that I'm using is Windows Vista. There are no native VHD drivers for Windows Vista nor the guest OS that I'm using as a virtual machine. I'm running MS-DOS 6.22 as guest OS, btw.



#15 ppgrainbow

ppgrainbow

    Member

  • Members
  • 70 posts

Posted 25 August 2016 - 11:40 PM   Best Answer

Anyways, I enter this command at startup:

 

 

 

imdisk -a -f C:\DOS\BOOT\VOLUME\NETDRV0.IMG -v 1 -P -m G:
imdisk -a -f C:\DOS\BOOT\VOLUME\NETDRV1.IMG -v 1 -P -m H:

 

And now that I hidden the directory C:\DOS\BOOT\VOLUME, I can access the virtual drives G: and H: at startup! :)

 

The drives that I mounted at startup can be found in \HEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Service\ImDisk\Paramenters

 

In the registry key, it tells what drive letters (DriveLetterX) have been mounted and the hard disk image (filenameX) that gets mounted at startup. The registry also tells how many devices have been loaded (LoadDevices) and the image offset in bytes (ImageOffset). An image offset of 32,256 bytes (31.5 KB) translate to a image offset of 63 sectors and lastly the size of the drive in bytes. Since it's a FAT16 formatted hard disk image, each of the drives have 2,146,927,104 bytes (1.9995 GB) of disk space. CHKDSK reports the drive having 65,510 total clusters at 32 KB per cluster

 

I'm gonna try to mount the hard disk images again and as a folder mounting point to see if this procedure works as well.

 

Edit:It worked! I used this command to mount the hard disk images as a folder mounting point

imdisk -a -f C:\DOS\BOOT\VOLUME\NETDRV0.IMG -v 1 -P -m C:\DOS\NETWORK\DRIVE.0
imdisk -a -f C:\DOS\BOOT\VOLUME\NETDRV1.IMG -v 1 -P -m C:\DOS\NETWORK\DRIVE.1

 

If I want to stop mounting the hard disk images at startup, I would just delete the registry keys inside \HEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Service\ImDisk\Paramenters

 

If Olaf is seeing this, there needs to be a much easier way to mount hard disk images as a virtual drive or virtual folder mount point at startup! :)


Edited by ppgrainbow, 25 August 2016 - 11:46 PM.


#16 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 26 August 2016 - 07:47 AM

If I want to stop mounting the hard disk images at startup, I would just delete the registry keys inside \HEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Service\ImDisk\Paramenters

 

If Olaf is seeing this, there needs to be a much easier way to mount hard disk images as a virtual drive or virtual folder mount point at startup! :)

 

Well, yes and no. :w00t:

 

Meaning that the -P parameter should write the data to the Registry, and once it is run (and the data is written to the Registry) at each following boot the same drives are mounted:

 

 

-P Persistent. Along with -a, saves registry settings for re-creating the
same virtual disk automatically when driver is loaded, which usually
occurs during system startup. Along with -d or -D, existing such
settings for the removed virtual disk are also removed from registry.

There are some limitations to what settings could be saved in this way.
Only features directly implemented in the kernel level driver are
saved, so for example the -p switch to format a virtual disk will not
be saved.
 

Once (IF) you are done with it, unmounting the drive(s) with -d -P or -D -P should also remove the Registry entries (no need to fiddle with the Registry).

 

I am failing to see in what this is "not easy" or how it could be made "easier". :unsure:

 

And again (as a further reminder), since you are using fixed size VHD's, what you are actually using are RAW hard disk images, and - as such - there are several drivers for such hard disk image that will expose to the OS a "virtual hard disk" (UNLIKE the "virtual volume" that IMDISK exposes).

This in normal filesystem level operation won' t make much difference, but - as an example - MOUNTVOL , DISKPART and the Mount Manager won't see the volume(s)/drive(s), formatting will produce a non-bootable result, a number of hard disk related tools managing the MBR and hidden sectors that are simply "not there".

 

:duff:

Wonko



#17 ppgrainbow

ppgrainbow

    Member

  • Members
  • 70 posts

Posted 26 August 2016 - 06:15 PM

Thank you for the explanation. I'm pretty sure that I'm gonna have fun writing data to the mounted hard disk images (with the exception of formatting since it will not work). :D


Edited by ppgrainbow, 26 August 2016 - 06:17 PM.


#18 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 27 August 2016 - 08:11 AM

Thank you for the explanation. I'm pretty sure that I'm gonna have fun writing data to the mounted hard disk images (with the exception of formatting since it will not work). :D

And - again - what you will have mounted with IMDISK  will be volume images and formatting will work fine though the result won't be bootable because of the "wrong" Sectors Before in the PBR.

And possibly (but this won't be your case since you are using FAT) the $BootMirr won't be created in the case of NTFS formatting :dubbio:.

 

:duff:

Wonko



#19 ppgrainbow

ppgrainbow

    Member

  • Members
  • 70 posts

Posted 28 August 2016 - 02:37 AM

And - again - what you will have mounted with IMDISK  will be volume images and formatting will work fine though the result won't be bootable because of the "wrong" Sectors Before in the PBR.

And possibly (but this won't be your case since you are using FAT) the $BootMirr won't be created in the case of NTFS formatting :dubbio:.

 

:duff:

Wonko

 

That's correct. That's why it's always a good idea to use the mounted non-bootable volume images as network drives that I can use under an MS-DOS guest operating system so that Virtual PC can share the volume images. :)

 

I haven't used the disk images yet, but I will do so later tonight.







Also tagged with one or more of these keywords: vhd, img, imdisk, startup

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users