-
-
Notifications
You must be signed in to change notification settings - Fork 72
FAQ
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.
You could for example use Windows Scheduler (look in Control Panel) to schedule a command to run at system startup. Command should be something like:
imdisk -a -s 400M -m R: -p "/fs:ntfs /q /y"
This will create a 400 MB RAM disk as drive R: and format it as NTFS during system startup.
Change command line above and remove -p parameter (no need to format in this case) and include -f parameter with an image file name. For example:
imdisk -a -t vm -f C:\ramdisk.img -m R:
This will create a RAM disk and load contents of C:\ramdisk.img onto it.
Image file for my auto-created RAM disk is small and I want RAM disk expanded to larger size automatically.
Just add another command to be scheduled:
imdisk -e -s 400M -m R:
This will add 400 MB to RAM disk drive R:
You could of course put both commands in a batch file and schedule that batch file instead. This will make sure that they run in correct order:
imdisk -a -t vm -f C:\ramdisk.img -m R:
imdisk -e -s 400M -m R:
rawcopy -mld \\.\R: C:\ramdisk.img
The rawcopy program is available on web site: http://www.ltr-data.se/opencode.html
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?
If your 32 bit Windows version supports memory access above 4 GB through address window extension (AWE) and with physical address extension (PAE) turned on, it could be done through an additional memory allocation driver called awealloc. You can use this feature in other scenarios as well, if you just want to keep your RAM disk in physical memory at all times.
Create the RAM disk with the awe option (schedule this command with Windows Scheduler if you want it to happen automatically at system startup):
imdisk -a -s 400M -o awe -m R: -p "/fs:ntfs /q /y"
This will ask awealloc driver to allocate 400 MB and then create a RAM disk drive R: within that memory and format it with NTFS. The 400 MB will primarily be allocated from as high memory addresses as possible, but parts of it could be allocated at lower addresses if not enough memory is free or otherwise accessible at high ranges. Check Windows Event Log to see error messages during memory allocation.
ImDisk allocates memory for whole of RAM disk when RAM disk is created. Due to the way memory management works in Windows it might look like memory is not allocated until you put files on your RAM disk, but that is actually just a delay in committing memory pages and not a feature of ImDisk. When you delete files there is no way for ImDisk to tell Windows to "decommit" pages because all of RAM disk is allocated in one chunk.
Some of these problems could be partially solved with awealloc driver as discussed above, because with awealloc not all of RAM disk memory needs to be in virtual address space at all times. But apart from that, there is sadly no good solution in sight as it looks right now.
I would like to mount a vhd file from Microsoft Virtual PC, Virtual Server, Hyper-V etc. Can ImDisk do that?
Fixed size vhd files could be mounted without any special tweaks. Dynamically sized vhd files could be mounted through proxy mode with a program called devio. Download devio here: http://www.ltr-data.se/files/devio.exe Open a command prompt and type:
devio shm:vhd1 C:\harddisk.vhd
It will automatically find out that it is a vhd file and select first partition. There are various parameters available to devio if you want to mount as plain image or want another partition from the image file.
Then, create the virtual disk:
imdisk -a -t proxy -o shm -f vhd1 -m V:
Make sure you leave devio running while virtual disk is mounted. You will get all sorts of disk I/O error messages and trouble if you kill it before dismounting the virtual disk. The devio process will automatically exit when you dismount the virtual disk.
imdisk -d -m V:
You can change devio command line to open image file in read-only mode:
devio -r shm:vhd1 C:\harddisk.vhd
The vhd1 name here is just an example. It is the name of shared memory and synchronization objects used to communicate between ImDisk and devio. You can use any name you want but remember that it needs to be unique in case you mount many files simultaneously.
I would like to mount an image file of another format, for example vmdk or vdi. Could ImDisk do that?
ImDisk can not mount these formats natively, but it can interact with the DiscUtils library and that way mount them. You need to download a program called DiscUtilsDevio. Download DiscUtilsDevio package here.
Please note that .NET Framework 4.0 is needed for this to work. It is included in Windows 8 and later and can be downloaded and installed for older versions back to Windows XP.
Open a command prompt, change to directory where you extracted the files and run:
DiscUtilsDevio /mount=V: /filename=C:\harddisk.vdi
It will automatically find out that it is a vdi file and select first partition. There are various parameters available to DiscUtilsDevio if you want to mount as plain image or want another partition from the image file.
Make sure you leave DiscUtilsDevio running while virtual disk is mounted. You will get all sorts of disk I/O error messages and trouble if you kill it before dismounting the virtual disk. The DiscUtilsDevio process will automatically exit when you dismount the virtual disk.
imdisk -d -m V:
You can change DiscUtilsDevio command line to open image file in read-only mode:
DiscUtilsDevio /mount=V: /filename=C:\harddisk.vdi /readonly
If the image file has .bin suffix it is automatically treated as a CD/DVD image. If it is actually a disk volume image try to manually select "Harddisk volume" in Control Panel applet or specify -o hd at command line.
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.
You need to add -v partitionnumber to imdisk.exe command line to automatically find offset etc for mounting a specific partition with image file. You could also use the multipurpose -b switch with -b auto to mount first specified partition in partition table. The -b auto argument also works with other kind of known image file formats with headers that must be skipped to find the actual disk data.
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?
The subdirectory where the virtual disk will be mounted need to be on an NTFS volume and it needs to be empty (not even any hidden files or directories in it). This feature also requires Windows 2000 or later, it does not work on Windows NT 3.51 or 4.0.
First, create an empty directory where you want to mount your virtual disk:
md C:\vdisk
Then, mount your virtual disk. In this example we use type "vm" to copy image file C:vdisk.img to memory and thus create a RAM disk.
imdisk -a -t vm -f C:\vdisk.img -m C:\vdisk
Now C:\vdisk will point to your ImDisk drive, for example DeviceImDisk0 (drive number could be other than 0 if you have other virtual disks mounted, correct drive number will be shown on console).
When you want to dismount, type:
imdisk -d -m C:\vdisk
This will remove the reparse point at C:\vdisk and turn it back to an empty directory. If you instead type for example imdisk -d -u 0 you will just dismount the virtual disk but not remove the reparse point. In this case C:\vdisk directory will automatically point to the next ImDisk drive you create, and you do not need to specify that directory as mount point in that case.
imdisk -a -t vm -f C:\vdisk.img
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?
To make sure that filesystem drivers or filesystem filter drivers do not interfere with rawcopy, use the -d flag:
rawcopy -mld \\.\R: C:\ramdisk.img
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?
If you are calling imdiskinst.exe from a script or similar, define the environment variable IMDISK_SILENT_SETUP to the value of 1 before running imdiskinst.exe. This makes the install script skip message boxes and similar.
For completely non-interactive setup, for example included in other setup packages, it is recommended that you extract the contents of imdiskinst.exe (use 7-zip) to a temporary setup directory. Then, run rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 132 path-to-setup-files\imdisk.inf
or similar.
It is also possible to edit install.cmd in the setup package and remove all calls to msgbox.exe utility. That utility is only used to display message boxes.