Jump to content











Photo
- - - - -

Ramdisk from boot and formated ?


  • Please log in to reply
45 replies to this topic

#26 XIII

XIII

    Newbie

  • Members
  • 13 posts

Posted 24 February 2010 - 11:20 PM

My apologies for reviving this topic, but I hope you will help me anyway.

I've been using the Gavotte ram disk on Windows XP and was very happy with that. Now I'm migrating to Windows 7 64-bits and need a new ram disk solution. ImDisk seems the perfect candidate (especially now that it's signed!), but I just can't get it working (or find documentation that helps me in doing that).

This is what I'm trying to achieve: a 512MB RAM disk mounted as Z: which is empty, except for the directory "temp" (I got all of this almost by default from Gavotte). I use this ramdisk to story temporary Firefox and Internet Explorer files.

This is how I tried to do it:
- created a 512MB file, mounted it, created the "temp" directory and unmounted it
- created a txt version of it with apiregutil from this forum
- created a new sparse(!) imagefile c:\ramdisk.img from this txt version using the same apiregutil
- made sure the ImDisk service autostarts
- added this to the registry:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\ImDisk\Parameters]

"Flags0"=dword:00000200

"FileName0"="\\DosDevices\\c:\\ramdisk.img"

"DriveLetter0"="Z"

"LoadDevices"=dword:00000001
Unfortunately nothing seems to happen at boot, there is no Z: drive, and I don't see any error/log.
(the image file does load from the command line when I try to mount it manually after booting)

How can I debug this? What do I do wrong? How to solve it?

#27 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 25 February 2010 - 09:17 AM

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\ImDisk\Parameters]

"Flags0"=dword:00000200

"FileName0"="\\DosDevices\\c:\\ramdisk.img"

"DriveLetter0"="Z"

"LoadDevices"=dword:00000001
Unfortunately nothing seems to happen at boot, there is no Z: drive, and I don't see any error/log.
(the image file does load from the command line when I try to mount it manually after booting)


The registry settings looks okay to me. When I tested your settings on a Vista 32 machine right now I got another strange result, the drive letter seems not be created. The virtual disk is though created so I could just run dosdev -r Z: \Device\ImDisk0 to give it drive letter Z:, but the one assigned by ImDisk did not show up. Strange, I need to check why. Can you check and see if the disk you are missing shows in Control Panel applet or imdisk -l on command line? In that case a workaround meanwhile could be that you create a drive letter association in the HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices registry key.

Also, I have to say that I have not tested a lot the startup parameters for ImDisk on 64 bit platforms so I get a feeling that there can be something wrong there. I will try to debug it but it will take a few days because I do not currently have any 64 bit machines to use for debugging.

Meanwhile you can of course also check to make absolutely sure that the settings really got imported into the registry and that they look like expected there and things like that.

#28 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 25 February 2010 - 01:05 PM

What do I do wrong?


Nothing done wrong, you just hit a bug :lol:

http://www.boot-land...amp;gopid=92498

How to solve it?


I just published an updated version 1.2.4 where the drive letter problem is fixed. Install that one and see if that helps.

Thank you for reporting this problem! :rolleyes:

#29 XIII

XIII

    Newbie

  • Members
  • 13 posts

Posted 25 February 2010 - 07:53 PM

Wow, you're fast! Thanks!

I've downloaded and installed this new build, but unfortunately nothing changes... (as far as I can see) :lol:

There is no drive in the ImDisk Control Panel and "imdisk -l" reports "No virtual disks.".

I can mount the disk manually using "imdisk -a -f c:\ramdisk.img -m z:" which results in a 512MB Z: drive with a "Temp" directory.

If I try to mount the same image using the Control Panel something weird happens: a pop up asks me to select a partition in the disk image, where I can choose either to use the entire image file, or one out of 4 partitions. What's weird is the size of these partitions: 875.5GB, 259.6GB, 259.5GB, and 26.84MB (yes, it's really GigaByte for the first 3 partitions!).

Perhaps this helps in deducing what's wrong when automatically loading the image?

(BTW: registry settings listed before are correctly imported in the registry; I copied the text in my previous post from an exported text file of the registry)

#30 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 25 February 2010 - 07:58 PM

What's weird is the size of these partitions: 875.5GB, 259.6GB, 259.5GB, and 26.84MB (yes, it's really GigaByte for the first 3 partitions!).

Perhaps this helps in deducing what's wrong when automatically loading the image?


Well, that seems like meaning that the bootsector of your presumably unpartitioned (or super-floppy) image is read like it was the MBR of a partitioned one.

How is the image created initially? :lol:

Wonko

#31 XIII

XIII

    Newbie

  • Members
  • 13 posts

Posted 25 February 2010 - 08:16 PM

How is the image created initially?

imdisk -a -f ramdisk.img -s 512MB -p "/fs:ntfs /q /y" -m z:

mkdir z:\Temp

imdisk -d -m z:

ApiRegUtil.exe makehddinfo ramdisk.img ramdisk.txt

ApiRegUtil.exe makehdd 20000200 ramdisk.txt ramdisk.img sparsefile
The last two steps I performed to have a sparse file (resulting ramdisk.img size is 512MB, size on disk is 5,37MB)

#32 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 25 February 2010 - 08:20 PM

There is no drive in the ImDisk Control Panel and "imdisk -l" reports "No virtual disks.".


I came to think about something. You do not happen to try to set the driver to load at "boot", do you? In that case it would not work. Either "system" or "automatic" should do, but not "boot". The reason is that at boot-time the driver cannot access the C: drive to load the image.

If I try to mount the same image using the Control Panel something weird happens: a pop up asks me to select a partition in the disk image, where I can choose either to use the entire image file, or one out of 4 partitions. What's weird is the size of these partitions: 875.5GB, 259.6GB, 259.5GB, and 26.84MB (yes, it's really GigaByte for the first 3 partitions!).

Perhaps this helps in deducing what's wrong when automatically loading the image?


That just means that the boot record of the image is for some reason seen as a master boot record, but that happens sometimes. The MBR auto-detection code is not 100% safe. It should not mean anything when the image is mounted by the driver at startup because there is no MBR auto-detection involved at that time.

(BTW: registry settings listed before are correctly imported in the registry; I copied the text in my previous post from an exported text file of the registry)


Ok.

#33 XIII

XIII

    Newbie

  • Members
  • 13 posts

Posted 25 February 2010 - 08:27 PM

You do not happen to try to set the driver to load at "boot", do you?

I don't think I even know how to that... Can you tell me how (to check)?

This is what I did to start ImDisk (after reading that here on the forum):
sc config imdisk start= auto
However, when I just looked at the Services I only saw ImVirtual Disk Driver Helper which is set to manual.

I guess I need to try this with it set to "Automatic" or "Automatic (Delayed Start)"?

(the latter is new to me, never saw that in XP)

#34 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 25 February 2010 - 08:36 PM

I don't think I even know how to that... Can you tell me how (to check)?

This is what I did to start ImDisk (after reading that here on the forum):

sc config imdisk start= auto


Good. Either "auto" or "system" should be fine, if you would have typed "boot" it would have meant problems loading the image file.

However, when I just looked at the Services I only saw ImVirtual Disk Driver Helper which is set to manual.

I guess I need to try this with it set to "Automatic" or "Automatic (Delayed Start)"?


No, the service you see there is another thing and it is not needed in this case.

#35 XIII

XIII

    Newbie

  • Members
  • 13 posts

Posted 25 February 2010 - 08:40 PM

No, the service you see there is another thing and it is not needed in this case.

OK, then I don't need to experiment with that.

But I can use other suggestions now...

#36 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 25 February 2010 - 08:47 PM

imdisk -a -f ramdisk.img -s 512MB -p "/fs:ntfs /q /y" -m z:

mkdir z:\Temp

imdisk -d -m z:

ApiRegUtil.exe makehddinfo ramdisk.img ramdisk.txt

ApiRegUtil.exe makehdd 20000200 ramdisk.txt ramdisk.img sparsefile
The last two steps I performed to have a sparse file (resulting ramdisk.img size is 512MB, size on disk is 5,37MB)


I am not familiar with the tools you are using for this so I cannot say for sure, but to me it looks like you are doing things in the wrong order. Or rather, in unnecessary order. But, since your image file is perfectly mountable I would say things do not go wrong anyway.

I, personally, would have done like this:

fsutil file createnew c:\ramdisk.img 0

fsutil sparse setflag c:\ramdisk.img

imdisk -a -f ramdisk.img -s 512MB -p "/fs:ntfs /q /y" -m z:

mkdir z:\Temp

imdisk -d -m z:

But, again, the image works the way you create it too, so it should not be a problem anyway. There must be another problem with mounting when the driver is loaded. I have no 64 bit system here at the moment to test this on. I would think that someone with a 64 bit machine with a debugger attached could figure out what is going wrong. Unfortunately it could take a couple of days before I could help with that.

#37 XIII

XIII

    Newbie

  • Members
  • 13 posts

Posted 25 February 2010 - 08:55 PM

Oh, by the way: I just remember that I (always?) get a "Z: Access is denied." error when I try to unmount the image using "imdisk -d -m z:".

I can only unmount using the control panel, which first complains that the drive is locked...

(BTW using your -cleaner- method the size on disk is 26,3MB, using the ApiRegUtil found here on the forum -but nowhere else?- it is 5,37MB; not that this really matters...)

#38 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 25 February 2010 - 09:07 PM

Oh, by the way: I just remember that I (always?) get a "Z: Access is denied." error when I try to unmount the image using "imdisk -d -m z:".

I can only unmount using the control panel, which first complains that the drive is locked...


The corresponding way to force dismount on command line is to type imdisk -D -m z: instead. The reason that you cannot use a "clean" dismount is that you are not running with elevated privileges. If you right-click on Command Prompt on Start Menu and select "Run as administrator" it would work. The same with Control Panel applet, if you run that "as administrator" it would not complain that it cannot do a safe dismount (unless, of course, the device really is in use by another program, but that is another matter).

(BTW using your -cleaner- method the size on disk is 26,3MB, using the ApiRegUtil found here on the forum -but nowhere else?- it is 5,37MB; not that this really matters...)


Okay, my method does not go through the image file afterwards and mark zeroed areas as "sparse" so if anything is actually written as zeroes it will get allocated. That is probably why it gets larger allocation in that case.

#39 XIII

XIII

    Newbie

  • Members
  • 13 posts

Posted 25 February 2010 - 09:27 PM

The reason that you cannot use a "clean" dismount is that you are not running with elevated privileges. If you right-click on Command Prompt on Start Menu and select "Run as administrator" it would work.

I was running with elevated privileges (I already did exactly what you described here).

I have no idea what else might be accessing the disk...

Anyway, I hope you/we will find a solution for the autostart someday soon (my main "concern").

#40 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 26 February 2010 - 07:30 PM

I was running with elevated privileges (I already did exactly what you described here).

I have no idea what else might be accessing the disk...


But you wrote that you typed imdisk -d -m Z: and not imdisk -D -m Z: (notice the difference). The latter corresponds to confirming removal of disk in use in the GUI.

Anyway, I hope you/we will find a solution for the autostart someday soon (my main "concern").


Some thoughts meanwhile (and while I am waiting for my ISP to fix my cable modem):

Do you see any error messages when you type sc config imdisk start= auto, such as Access denied or something?

Can you please try to set the driver to demand load again with sc config imdisk start= demand and then reboot. After that, type net start imdisk at an elevated command prompt. It should write a message about that it is starting "ImDisk Virtual Disk Driver" and then that it was started successfully. At this point, does your Z: drive show up somewhere, Control Panel applet, imdisk -l or in Explorer or something?

#41 XIII

XIII

    Newbie

  • Members
  • 13 posts

Posted 27 February 2010 - 09:07 PM

But you wrote that you typed imdisk -d -m Z: and not imdisk -D -m Z: (notice the difference). The latter corresponds to confirming removal of disk in use in the GUI.

Sorry, did not know the difference...

Do you see any error messages when you type sc config imdisk start= auto, such as Access denied or something?

No:

[SC] ChangeServiceConfig SUCCESS
Rebooting now for the remainder of your request...

#42 XIII

XIII

    Newbie

  • Members
  • 13 posts

Posted 27 February 2010 - 09:16 PM

Can you please try to set the driver to demand load again with sc config imdisk start= demand and then reboot. After that, type net start imdisk at an elevated command prompt. It should write a message about that it is starting "ImDisk Virtual Disk Driver" and then that it was started successfully.

Yes:

C:\Windows\system32>net start imdisk



The ImDisk Virtual Disk Driver service was started successfully.

At this point, does your Z: drive show up somewhere, Control Panel applet, imdisk -l or in Explorer or something?

No Z: drive in any of the options (config panel, explorer, imdisk -l):

C:\Windows\system32>dir Z:

The system cannot find the path specified.



C:\Windows\system32>imdisk -l

No virtual disks.


#43 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 02 March 2010 - 10:15 PM

I found it. It was an embarrassing ugly bug. Quite awful actually. :exclamation: :exclamation: :exclamation:

Fixed it now. For some reason I had skipped the whole block of code that auto-detected disk size from image file size in 64 bit versions when all I wanted to skip was the 2 GB disk size limit check.

Thank you for reporting this and being helpful testing various things when I was on the completely wrong track. :cheers:

#44 XIII

XIII

    Newbie

  • Members
  • 13 posts

Posted 02 March 2010 - 11:15 PM

Fixed it now.

Confirmed! :exclamation:

Thank you very much!

#45 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 02 March 2010 - 11:31 PM

I found it. It was an embarrassing ugly bug. Quite awful actually. :cheers: :exclamation: :cheers:

Fixed it now. For some reason I had skipped the whole block of code that auto-detected disk size from image file size in 64 bit versions when all I wanted to skip was the 2 GB disk size limit check.


Don't worry, noone noticed it :exclamation: , and I will remind you of your mistake only for the next 42 years. :(

:exclamation:

Wonko

#46 yjstone

yjstone
  • Members
  • 4 posts

Posted 30 March 2010 - 02:17 PM

Hi,Olof,Thanks for your amazing tool.
Now i got a ploblem about mounting IMG on booting(my imdisk version is 1.2.8)
I added this to the registry:
[codebox]Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ImDisk] "Start"=dword:00000002 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ImDisk\Parameters] "DriveLetter0"="Y" "FileName0"="\\??\\E:\\test.IMG "LoadDevices"=dword:00000001 [/codebox] after booting,I can't see Y: driver in explorer ,but I can see it in imdisk Control Panel applet and CMD
imdis_applet.jpg
cmd.jpg
How to solve it?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users