Problem: My startups were taking way too long. The drive would take 1-5m to show up on a fresh boot. My shutdowns also took between 30s - 1m.
After I switched to storing my drive contents in a 7z archive my shutdowns took about 5s and my drive was instantly available on startup.
Below is a step by step guide on how to use 7z archives with ImDisk for auto-save on shutdown and load on startup.
Let me know if I missed anything! This is very similar to another guide I seen, the main/only difference is the code for the scripts.
Step 1. Install 7-Zip: http://www.7-zip.org/
Step 2. Add the 7-Zip installation directory to your PATH
Right click on My Computer -> Properties -> Advanced system settings
At the bottom of this window click Environment Variables.
Under system variables go to "Path".
Double click on this string.
Directories are separated with a semi colon ( ; ). If there isn't a semi colon at the end, add one then type out the directory to your 7-Zip installation. You will need to re-open any command prompts you have open to use the updated Path.
Step 3. Create a "startup" script (.bat or .cmd) that creates the virtual disk and loads an archive onto the new disk.
Here's an example. This creates a drive in virtual memory and assigns in the letter G. It then extracts the archive E:\RAMDISK\GDRIVE.7z to G:\
imdisk -a -t vm -s 1536M -p "/fs:ntfs /q /y" -m G: 7z x GDRIVE.7z -oG:\
7z = 7zip
x = extract files, preserve directories
-o = extract files to this path (IE: -oC:\Extract\to\here\)
Step 4. Create a "shutdown" script (.bat or .cmd) that will simple store the contents of your drive in a 7z archive.
Here's an example.
7z a -mx0 e:\RAMDISK\GDRIVE.7z G:\
7z = 7zip
a = archive files
-mx0 = the compression level. mx0 is NO compression, it just stores the files in an archive. (Read More [scroll down to "Example -m switch"])
Step 5. Add these new scripts (the .bat or .cmd files) to the task scheduler.
Right-click My Computer -> Manage
On the left go to Task Scheduler -> Task Scheduler Library
At the top go to Action -> Create Task.
Under the General tab make sure the User is set to SYSTEM and check "Run with highest privileges" and "Hidden" at the very bottom.
Go to the Trigger tab. Click the New button
For Startup
Begin the task: At Startup
Make sure "Enabled" is checked at the bottom then click OK
For Shutdown
Begin the task: On an event
Tick "Basic"
Log: System
Source: USER32
Event ID: 1074
Make sure "Enabled" is checked at the bottom then click OK
Now go to the actions tab. Click new.
Action: Start a program
Program/script: Point it to the .cmd or .bat file you made for either shutdown or startup.
Leave Arguments and "Start in" blank unless you use those.
Make sure nothing is checked in the Conditions tab.
Go to the Settings tab.
Check "Allow task to be run on demand"
Check "Run task as soon as possible .."
You can leave "If the task fails, .." unchecked.
You can leave "Stop the task if it runs longer than .." unchecked. Feel free to configure this.
Uncheck "If the running task does not end when requested, force it to stop"
Uncheck "If the task is not scheduled to run again, .."
Set to Do not start a new instance
(The startup and shutdown tasks are identical except for the triggers)