Jump to content











Photo
- - - - -

FAQs and How-Tos


  • Please log in to reply
83 replies to this topic

#1 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 09 October 2011 - 11:42 AM

*
POPULAR

This is a topic where I will collect frequently asked questions about ImDisk and related projects, together with answers or links to other topics with explanations, documentation etc.

  • I want a RAM disk to be automatically created and formatted when Windows starts up.

    Spoiler
  • I want my auto-created RAM disk to be pre-loaded with a disk image file.

    Spoiler
  • Image file for my auto-created RAM disk is small and I want RAM disk expanded to larger size automatically.

    Spoiler
  • How do I save a RAM disk as a disk image file from command line?

    Spoiler
  • I want a RAM disk that should be kept in physical memory at all times and never swapped out to disk. Or, I want to create a RAM disk that uses memory above "lost" 4 GB on 32 bit Windows versions. Can ImDisk do that?

    Spoiler
  • When I delete files from my RAM disk memory still seems to be used. What is wrong?

    Spoiler
  • I would like to mount a vhd file from Microsoft Virtual PC, Virtual Server, Hyper-V etc. Can ImDisk do that?

    Spoiler
  • I would like to mount an image file of another format, for example vmdk or vdi. Could ImDisk do that?

    Spoiler
  • I try to mount an image file named something.bin and it does not work. What could be wrong?

    Spoiler
  • My image file has a master boot record with partition table. When I mount it using Control Panel applet it asks me which partition to mount, but this does not seem to work from command line.

    Spoiler
  • I would like to mount a virtual disk to a subdirectory on my hard disk instead of using a drive letter. How to do that?

    Spoiler
  • When I try to use the rawcopy program to save disk contents as image file, I get corrupt image files that cannot be mounted later. What is wrong?

    Spoiler
  • I would like to script a silent install of ImDisk, but when I try imdiskinst.exe -y it still shows a message box at end of setup. Is there a way to avoid all kind of user interaction during setup?

    Spoiler
  • Is there any step-by-step guide to creating a RAM disk at system startup?

    Spoiler

Edited by Olof Lagerkvist, 11 February 2024 - 11:50 PM.
Added info about DiscUtilsDevio /mount switch and changed "bullet list" to "numbered list"

  • DfA, sambul61 and TrywareDk like this

#2 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 09 October 2011 - 01:07 PM

Thanks Olof!

Great FAQ post, written with clarity not many corporate writers can offer. I'd still suggest adding some numbering system to better visually differentiate Q and A groups, and make each group expandable by clicking on its Q, if forum Text Area formatting allows (not sure). :)

A couple of questions though:

- Is it possible to create a RAM disk at startup that will auto expand dynamically as more files added to it and auto shrink as some files are deleted from it, thus dynamically freeing RAM pages for other apps?

- How to Synch the RAM disk automatically with its original HD Copy at Windows Exit? Any extra apps required & command examples suggested?


#3 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 09 October 2011 - 01:19 PM

Thanks Olof!

Great FAQ post, written with clarity not many corporate writers can offer. I'd still suggest adding some numbering system to better visually differentiate Q and A groups, and make each group expandable by clicking on its Q, if forum Text Area formatting allows (not sure). :)


Thanks, and good suggestions! I will take a look at what forum features we could use to make it easier to read! :)

A couple of questions though:

- Is it possible to create a RAM disk at startup that will auto expand dynamically as more files added to it and auto shrink as some files are deleted from it, thus dynamically freeing RAM pages for other apps?


No, sorry, there are a couple of problems with this. First of all it would need a much more dynamical memory allocation than we have in ImDisk today. As it works right now, all memory (a fixed size) for a RAM disk must be allocated in one piece. There is no practical way to deallocate parts of it. This could be something for the future, but I feel we are quite a long way from that now.

- How to Synch the RAM disk automatically with its original HD Copy at Windows Exit? Any extra apps required & command examples suggested?


From reading other topics here, "psewar" is working on a solution. I will wait and see what that leads to. When that project is ready, I will add it to the FAQ/How-to list.

#4 Sophia

Sophia

    Member

  • Members
  • 85 posts
  •  
    Netherlands

Posted 10 October 2011 - 02:16 AM

First of all, I love the idea of an "FAQs and How-Tos" topic. Great job, Olof!

I have a question about a question...

"I want a RAM disk that uses memory above 4 GB in 32 bit Windows. Can ImDisk do that?"

Why would anyone who has 4GB+ RAM run a 32-bit version of Windows in the first place? I think adding a brief explanation might be good idea, for the ignorant like myself :)

#5 Uvais

Uvais

    Frequent Member

  • Advanced user
  • 180 posts

Posted 10 October 2011 - 03:51 AM

Thankss mannn :2nd:

#6 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 10 October 2011 - 06:12 AM

First of all, I love the idea of an "FAQs and How-Tos" topic. Great job, Olof!


Thanks! B)

I have a question about a question...

"I want a RAM disk that uses memory above 4 GB in 32 bit Windows. Can ImDisk do that?"

Why would anyone who has 4GB+ RAM run a 32-bit version of Windows in the first place? I think adding a brief explanation might be good idea, for the ignorant like myself :)


Well, I don't think that I would be the right person to answer that. There have been lots of questions about this 4GB+ RAM in 32 bit Windows and you could of course ask one of them why they are running 32 bit OS on a machine with that much memory... ;)

#7 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 10 October 2011 - 06:35 PM

I will take a look at what forum features we could use to make it easier to read! :)

Its looks like Spoiler and/or Special BBC Code features might be used to expend or shrink Q&A groups.

#8 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 11 October 2011 - 08:12 AM

Its looks like Spoiler and/or Special BBC Code features might be used to expend or shrink Q&A groups.


Thanks, I have used that now. Hope it looks okay! :thumbsup:

#9 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 11 October 2011 - 12:42 PM

Thanks Olof!

Ideally, if a user can click on a question, and see the expanded answer, it will be cleaner than current approach. I do understand forum format has some limitations, but with your advanced programming skills you might want to try Special BBC Code route. At least try to remove the word "Spoiler" which looks redundant in this content, and may be replace "Show" with "Answer" on the buttons. :)

If you get successful in doing that, please share your BBC Code with others, as quite a few people struggle to make all kind of Tutorials look better and more legible. I'd also suggest to keep all your answers in the 1-st post, and when a new question is asked that you feel is important or frequent, add the answer to the 1-st post and give the user a link to it if possible, so that clicking on that link would open the 1-st post at the said Answer line. If that's not possible, simply number Q&A groups, and give the user the right Group number in your reply to find it easily. As more Q&A blocks are added, the rational of hiding Answers will get more evident.

#10 gbrao

gbrao

    Frequent Member

  • Advanced user
  • 474 posts
  •  
    India

Posted 28 February 2012 - 02:47 AM

what's the right/best way to check if imdisk has been installed on a system ? using cmd/autoit. check if imdisk.exe and/or imdisk.sys exist ?

#11 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 28 February 2012 - 06:23 AM

what's the right/best way to check if imdisk has been installed on a system ? using cmd/autoit. check if imdisk.exe and/or imdisk.sys exist ?


First check if registry key HKLMSYSTEMCurrentControlSetServicesimdisk exists. If it does, the driver is installed. Then check if %SystemRoot%system32imdisk.cpl exists to see if API library is available.

From there it depends on language how you could load driver, check DLL/driver compatibility etc. With .NET or COM you try to create an instance of ImDiskCtl class. If that fails, try ImDiskAPI.LoadDriver(). If successful, create an instance of ImDiskCtl. On your ImDiskCtl instance, call CheckDriverVersion() to see that versions of DLL and driver is compatible. In C/C++ you open ?ImDiskCtl and if that fails call ImDiskLoadDriver() and try to open ?ImDiskCtl again. If successful, call ImDiskCheckDriverVersion() on your ?ImDiskCtl handle to verify matching DLL and driver versions.

#12 gbrao

gbrao

    Frequent Member

  • Advanced user
  • 474 posts
  •  
    India

Posted 28 February 2012 - 03:16 PM

should it be "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesImDisk" ?

#13 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 28 February 2012 - 03:27 PM

should it be "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesImDisk" ?


Yes, sorry. Corrected that now. Thanks for your correction!

#14 gbrao

gbrao

    Frequent Member

  • Advanced user
  • 474 posts
  •  
    India

Posted 29 February 2012 - 03:42 AM

does imdisk.exe return any return-code ?
for eg. if i want to find if a drive is a imdisk device.
i can use "imdisk -l -m R:" and then test the return-code.

any easier way to find which drives are imdisk devices ?
----------------
Edit :
could you please explain the "-t vm" parameter.
what's the difference between
imdisk -a -s 400M -m R: -p "/fs:ntfs /q /y"
and
imdisk -a -t vm -s 400M -m R: -p "/fs:ntfs /q /y"

#15 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 29 February 2012 - 08:17 AM

does imdisk.exe return any return-code ?
for eg. if i want to find if a drive is a imdisk device.
i can use "imdisk -l -m R:" and then test the return-code.


Yes. Return codes from imdisk.exe are as follows:

    IMDISK_CLI_ERROR_DEVICE_NOT_FOUND = 1,

    IMDISK_CLI_ERROR_DEVICE_INACCESSIBLE = 2,

    IMDISK_CLI_ERROR_CREATE_DEVICE = 3,

    IMDISK_CLI_ERROR_DRIVER_NOT_INSTALLED = 4,

    IMDISK_CLI_ERROR_DRIVER_WRONG_VERSION = 5,

    IMDISK_CLI_ERROR_DRIVER_INACCESSIBLE = 6,

    IMDISK_CLI_ERROR_SERVICE_INACCESSIBLE = 7,

    IMDISK_CLI_ERROR_FORMAT = 8,

    IMDISK_CLI_ERROR_BAD_MOUNT_POINT = 9,

    IMDISK_CLI_ERROR_BAD_SYNTAX = 10,

    IMDISK_CLI_ERROR_NOT_ENOUGH_MEMORY = 11,

    IMDISK_CLI_ERROR_PARTITION_NOT_FOUND = 12,

    IMDISK_CLI_ERROR_WRONG_SYNTAX = 13,

    IMDISK_CLI_ERROR_FATAL = -1


In this case, it returns 0 for an ImDisk device and 5 for other drives. Problem is that it could return 2 for any device, ImDisk or not, in case it does not have permission to open the device.

any easier way to find which drives are imdisk devices ?


No, I suppose this is the easiest scriptable method.

----------------
Edit :
could you please explain the "-t vm" parameter.
what's the difference between
imdisk -a -s 400M -m R: -p "/fs:ntfs /q /y"
and
imdisk -a -t vm -s 400M -m R: -p "/fs:ntfs /q /y"


These two command lines do exactly the same. You don't need to specify -t vm in this case because it is automatically used if you only specify a disk size and no file. If you specify a file however, the default behaviour is to just mount that file. If you rather want a type vm virtual disk with that image file pre-loaded you need to specify -t vm explicitly.

#16 gbrao

gbrao

    Frequent Member

  • Advanced user
  • 474 posts
  •  
    India

Posted 29 February 2012 - 11:12 AM

Thanks. The return-codes you mentioned above, is it documented somewhere ? I did not come across this information, just want to know if there is documentation somewhere that I'm not aware of.

btw : I'm (trying to) write a autoit script to do some of the more common ImDisk tasks. So far I've done a tab with "Create RAMdisk". Working on "UnMount" now. Don't tell me something like this already exists ;-)

Pic : http://img192.images...92/4048/crd.png
  • wimb likes this

#17 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 29 February 2012 - 12:23 PM

Thanks. The return-codes you mentioned above, is it documented somewhere ? I did not come across this information, just want to know if there is documentation somewhere that I'm not aware of.


I just copied the list from the source file cliimdisk.c. That return code list have never been documented other than in responses to questions in this forum. It fits pretty well here in FAQ.

btw : I'm (trying to) write a autoit script to do some of the more common ImDisk tasks. So far I've done a tab with "Create RAMdisk". Working on "UnMount" now. Don't tell me something like this already exists ;-)


Interesting project! But could you please start new threads for your projects, questions etc instead of posting everything here in the FAQ thread? Thanks! :cheers:

#18 jpretori

jpretori
  • Members
  • 1 posts
  •  
    South Africa

Posted 12 March 2012 - 11:23 AM

Hi Olaf,

In one of the FAQ's you say to use this commandline: imdisk -a -f \\.\awealloc -s 400M -m R: -p "/fs:ntfs /q /y"

In order to set up a disk above Windows's memory addressing limit.

I don't understand the "-f" parameter's syntax - I presume it's somehow telling ImDisk to "talk to awealloc for backing purposes"? Is it possible for me to also tell it to use a particular image file on disk? What would the syntax be?

#19 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 12 March 2012 - 12:23 PM

In one of the FAQ's you say to use this commandline: imdisk -a -f \\.\awealloc -s 400M -m R: -p "/fs:ntfs /q /y"

In order to set up a disk above Windows's memory addressing limit.

I don't understand the "-f" parameter's syntax - I presume it's somehow telling ImDisk to "talk to awealloc for backing purposes"?


Yes, that is correct. The awealloc.sys driver emulates a file with AWE allocated memory as storage, so that imdisk.sys thinks that it is working with a disk image file. That is why it is used with the -f parameter to imdisk.exe command line.

Is it possible for me to also tell it to use a particular image file on disk? What would the syntax be?


No, sorry, there is no support for that. I agree it could be useful sometimes and I have thought of a solution but nothing done to the matter so far.

A workaround could be to create and format the virtual disk like your command line above and then overwrite it with an image file.
Something like:
rawcopy -m C:\imagefile.img \\.\R:

Not a very nice solution, but it works.

#20 searockcliff

searockcliff
  • Members
  • 2 posts
  •  
    China

Posted 13 June 2012 - 03:36 AM

Thanks olof


I have a question:
How can I restrict processes accessing my RAM disk?
I want some process to access, but hide from other processes.

#21 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 13 June 2012 - 06:16 AM

I have a question:
How can I restrict processes accessing my RAM disk?
I want some process to access, but hide from other processes.


You can format your virtual disk with NTFS filesystem and set access control on files and directories. This file security will work just like any other drive.
  • searockcliff likes this

#22 searockcliff

searockcliff
  • Members
  • 2 posts
  •  
    China

Posted 13 June 2012 - 08:13 AM

You can format your virtual disk with NTFS filesystem and set access control on files and directories. This file security will work just like any other drive.


How can I allow only one process to read/write the RAM disk? It's in memory, I want the RAM disk is only for me to read/write.
I don't think NTFS support such kind.

#23 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

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

Posted 13 June 2012 - 08:20 AM

How can I allow only one process to read/write the RAM disk? It's in memory, I want the RAM disk is only for me to read/write.
I don't think NTFS support such kind.


You need to allow access only to the user account under which the process is running. There is, as far as I know, no other way.

#24 Kari-Erik Tammijärvi

Kari-Erik Tammijärvi
  • Members
  • 1 posts
  •  
    Sweden

Posted 08 September 2012 - 03:10 PM

Hello, I have one simple question. Regarding "rawcopy" is it possible to save image files into a different place? currently making a batch file for me so I can dump the image when I have added new stuf
I get a stupid error, I do know that rawcopy works but the problem is that I want to save them a directory with a "space"

My Batch line looks like this

START /WAIT "D:Ramdisk Imagesrawcopy.exe" -mld .R: "D:Ramdisk Imagesimage.img"

I know that it works as, well it did work when I tried.
can the problem be the cause that my Ramdisk is 9GB? I tried it out earlier with 256MB and 1GB drives earlier, and I am using 64 version of rawcopy

START /WAIT "D:Ramdisk Imagesrawcopy.exe" -mld .R: "D:mage.img"


Edit:
Noticed what I did wrong!

I wasn't supposed to launch it with "START /WAIT" at all! *LOL* actually it does it Rawcopy has that function. didnt think of it tehe! thanks anyway for reading this post

Edited by Kari-Erik Tammijärvi, 08 September 2012 - 03:21 PM.


#25 rollobsam

rollobsam

    Newbie

  • Members
  • 13 posts
  •  
    Australia

Posted 10 September 2012 - 09:11 AM

Sorry for posting in the wrong spot but, altho I am logged on to reboot.pro, I have tried numerous time to find a control or icon from which to post a new question- not having found in my searched the answer to my concerns.
I am no newbie but I can't see it anywhere
Thanks
Brian




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users