XBMC on RAM Disk

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Palthron Offline
Junior Member
Posts: 10
Joined: Apr 2012
Reputation: 0
Post: #1
Seeing there's no simple how-to for running XBMC on RAM Disk using Microsoft Windows, here's a shot at it.
Please note that this is a Work-In-Progress, meaning please be kind to errors. Suggestions are greatly appreciated and immensely needed.

What we need
1. Microsoft Windows
2. XBMC Installer, either Stable Release or Nightly Builds
3. ImDisk Virtual Disk Driver by Olof Lagerkvist

Steps
1. Install ImDisk Virtual Disk Driver

2. Open the ImDisk applet from Control Panel.

3. Create a new disk by pressing the Mount New button
[Image: 3imdiskmountnew.png]

4. Fill the forms with :
  • Drive letter : R
  • Size of virtual disk : 3072
  • Size type of virtual disk : Megabytes
And press OK.
Close the ImDisk window.
[Image: 4imdiskmountnewparamete.png]

5. Run XBMC installer. On the fourth window of the installer, change the default path (C:\Program Files (x86)\XBMC\) to R:\XBMC\
[Image: 5xbmcinstallerpath.png]

At the end of the installation, untick the Run XBMC check box.
[Image: 5bxbmcinstallercomplete.png]

6. From the start menu (Or any other shortcut you intend to run XBMC from), enter the Properties window.
[Image: 6shortcutmodtoportable.png]

7. At the end of the target box, add -p parameter (do not omit the space in front of it). Press OK.
[Image: 7xbmcshortcutproperties.png]



Now you can test run XBMC from the RAM Disk to confirm all is working well.


To automatically populate RAM Disk with XBMC program folder at login, do the following :

1. Copy XBMC program folder (R:\XBMC) to, let's say, the root drive of C (C:\XBMC Backup Folder), resulting in a folder structure : C:\XBMC Backup Folder\XBMC

2. Using notepad, paste the following code :
Code:
echo off
cls
echo Invoking RAM Drive...
echo.
c:\windows\system32\imdisk -a -t vm -s 3072M -p "/fs:ntfs /V:RAMDisk /q /y" -m R:
echo.
echo Creating XBMC working folder...
echo.
md R:\XBMC
echo         Done.
echo Synchronizing XBMC program directory...
echo.
xcopy "C:\XBMC Backup Folder\XBMC" R:\XBMC /E /H /K /Q
echo.
echo Running XBMC on RAM Drive...
echo.
R:
cd R:\XBMC
start XBMC.exe -p
exit
And save it on the backup folder C:\XBMC Backup Folder as a batch file.
Give it a self-explanatory name, such as XBMC on RAMDisk.bat

3. Create a shortcut pointing to the batch file and save it on the startup folder (C:\Users\[USERNAME]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Do not point the shortcut to the All User startup folder (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup) as it will execute on another user's login activity, including Guests and RDPs.


To backup XBMC to the assigned backup folder and re-run XBMC, do the following :

1. Using notepad, paste the following code :
Code:
echo off
cls
echo.
echo Synchronizing XBMC program directory...
echo.
echo Securing fallback...
ren C:\XBMC Backup Folder\XBMC "XBMC Backup In Progress"
echo Creating container...
md "C:\XBMC Backup Folder\XBMC"
echo Execute backup...
xcopy R:\XBMC "C:\XBMC Backup Folder\XBMC" /E /H /K /Q
echo.
echo Running XBMC on RAM Drive...
echo.
R:
cd R:\XBMC
start XBMC.exe -p
echo Purge fallback...
rd "C:\XBMC Backup Folder\XBMC Backup In Progress" /s /q
exit
And save it on the backup folder C:\XBMC Backup Folder as a batch file.
Give it a self-explanatory name, such as XBMC Backup.bat

2. Create a shortcut pointing to the batch file and save it on, say, Desktop or any other place easily reachable. Run this shortcut periodically or before the computer goes off / restarting.




To do
  • Auto backup on shutdown
  • Automatic periodic backup
  • Ignore temp directory on backup
  • Try out normal non-portable installation method using symbolic lists


Note
  • This should be written at the beginning of the post, but here goes. The advantage of using RAM Disk in general is mostly speed. It's like replacing an HDD to an SSD, but in XBMC terms.
    And it theoretically reduces wear on mechanical drives and eliminating wake time delay caused by mechanical drives going idle after a certain time of inactivity; or write cycles of SSDs.
  • Default installation of XBMC 11.0 (Stable Release) should take no more than 100MB.
    In this walkthrough I assigned 3 GBs of space to accomodate thumbnails, skins, add-ons, etc. In the end it all depends on your XBMC configurations and RAM available. I'm recommending at least 1 GBs (1024 MBs) of space.
  • If request arise, I'll make another tutorial on how to save file as batch file. But for now I'm going to assume most XBMC readers are tech savvy enough.
  • The backup script can off course be executed through the Task Scheduler, but this is something I haven't yet done nor test myself (Mostly since i never shut down my HTPC). Anyone who's willing to test it under several scenarios (Proper shutdown; Restart; Log Off; User switch; Sleep; Hibernate; etc) would be greatly appreciated.
  • For each update especially for users running Nightly Builds, each update resets the shortcut, meaning we need to redo the shortcut mod after each installs.
  • Simple variables that can be changed according to your HTPC configurations are as follows:
    • RAM Disk drive size (Default 3GB) - 2 references
    • Backup path and folder name (Default C:\XBMC Backup Folder) - 5 references
    • XBMC working folder path and folder name (Default R:\XBMC) - 5 references
  • To users running Linux, there's a thread for that :Anyone running RAM Disk? that leads to the thread : [HOWTO] Create a persistent xbmc ramdisk in ubuntu (xbmclive)
  • Off topic, but if I made any grammatical error or weird phrasing on this post, a correction would be nice
(This post was last modified: 2012-10-31 08:50 by Palthron.)
find quote
baijuxavior Offline
Posting Freak
Posts: 1,565
Joined: Jan 2012
Reputation: 38
Location: India
Post: #2
What is the advantage of using RAM disk?
find quote
Palthron Offline
Junior Member
Posts: 10
Joined: Apr 2012
Reputation: 0
Post: #3
Speed mostly. It's like replacing an HDD to an SSD, but in XBMC terms.
And it theoretically reduces wear on mechanical drives and eliminating wake time delay caused by mechanical drives going idle after a certain time of inactivity; or write cycles of SSDs.

But speed mostly.
(This post was last modified: 2012-10-29 06:30 by Palthron.)
find quote
Palthron Offline
Junior Member
Posts: 10
Joined: Apr 2012
Reputation: 0
Post: #4
Just experimented with Symbolic Links using Link Shell Extension with normal XBMC installation (Not portable) and it works, survives reboots and all. It uses 2 symbolic links :
special://xbmc - C:\Program Files\XBMC OR
special://xbmc - C:\Program Files (x86)\XBMC (Windows 64 bit)
special://home - C:\Users\[username]\AppData\Roaming\XBMC

References : XBMC Wiki : Special Protocol
find quote
LordMerlin Offline
Member
Posts: 84
Joined: Sep 2009
Reputation: 0
Post: #5
Why a garden fence with copying folders when there are normal programs to create a RAM disk, which let you save a disc image and when you turn off the data stored on it and restored when you reboot from it automatically?
find quote
Palthron Offline
Junior Member
Posts: 10
Joined: Apr 2012
Reputation: 0
Post: #6
Simple reasons, I haven`t found one RAM Disk application that is free and to my liking. Should I put several alternatives to the original post along with each capabilities such as auto backup, compression, etc?

UPDATE : Post #8
(This post was last modified: 2012-10-30 08:04 by Palthron.)
find quote
Palthron Offline
Junior Member
Posts: 10
Joined: Apr 2012
Reputation: 0
Post: #7
UNTESTED
Using Symbolic Links for normal non-portable installation

What we need
1. Microsoft Windows
2. XBMC Installer, either Stable Release or Nightly Builds
3. ImDisk Virtual Disk Driver by Olof Lagerkvist
4. Link Shell Extension

Steps
01. Install ImDisk Virtual Disk Driver
02. Install Link Shell Extension
03. Open the ImDisk applet from Control Panel.
04. Create a new disk by pressing the Mount New button
05. Fill the forms with :
  • Drive letter : R
  • Size of virtual disk : 3072
  • Size type of virtual disk : Megabytes
And press OK.
Close the ImDisk window.
06. Run XBMC installer.
At the end of the installation, tick the Run XBMC check box
07. Let XBMC fully load once, then Exit XBMC.

08. Create a folder on RAM Disk labeled R:\XBMC.
09. Copy folder C:\Program Files\XBMC (Windows 32 bit) or C:\Program Files (x86)\XBMC(Windows 64 bit) to R:\XBMC resulting in R:\XBMC\XBMC
10. Rename R:\XBMC\XBMC to R:\XBMC\Installation Folder
11. Delete (Or backup and rename) folder C:\Program Files\XBMC (Windows 32 bit) or C:\Program Files (x86)\XBMC(Windows 64 bit)
12. Right click on folder R:\XBMC\Installation Folder. Select Pick Link Source
13. Right click on folder C:\Program Files (Windows 32 bit) or C:\Program Files (x86)(Windows 64 bit). Select Drop As... - Symbolic Link
14. Rename the newly created Symbolic Link (C:\Program Files\Installation Folder (Windows 32 bit) or C:\Program Files (x86)\Installation Folder(Windows 64 bit) to C:\Program Files\XBMC (Windows 32 bit) or C:\Program Files (x86)\XBMC(Windows 64 bit)

15. Copy folder C:\Users\[USERNAME]\AppData\Roaming\XBMC to R:\XBMC resulting in R:\XBMC\XBMC
16. Rename R:\XBMC\XBMC to R:\XBMC\Configuration Folder
17. Delete (Or backup and rename) folder C:\Users\[USERNAME]\AppData\Roaming\XBMC
18. Right click on folder R:\XBMC\Configuration Folder. Select Pick Link Source
19. Right click on folder C:\Users\[USERNAME]\AppData\Roaming. Select Drop As... - Symbolic Link
20. Rename the newly created Symbolic Link (C:\Users\[USERNAME]\AppData\Roaming\Configuration Folder) to C:\Users\[USERNAME]\AppData\Roaming\XBMC


To automatically populate RAM Disk with XBMC program folder at login, do the following :

1. Using notepad, paste the following code :

Windows 32 bit
Code:
echo off
cls
echo Invoking RAM Drive...
echo.
c:\windows\system32\imdisk -a -t vm -s 3072M -p "/fs:ntfs /V:RAMDisk /q /y" -m R:
echo.
echo Creating XBMC working folder...
echo.
md R:\XBMC
echo         Done.
echo Synchronizing XBMC program directory...
echo.
xcopy "C:\XBMC Backup Folder\XBMC" R:\XBMC /E /H /K /Q
echo.
echo Running XBMC on RAM Drive...
echo.
C:
cd "Program Files"
cd XBMC
start XBMC.exe
exit

Windows 64 bit
Code:
echo off
cls
echo Invoking RAM Drive...
echo.
c:\windows\system32\imdisk -a -t vm -s 3072M -p "/fs:ntfs /V:RAMDisk /q /y" -m R:
echo.
echo Creating XBMC working folder...
echo.
md R:\XBMC
echo         Done.
echo Synchronizing XBMC program directory...
echo.
xcopy "C:\XBMC Backup Folder\XBMC" R:\XBMC /E /H /K /Q
echo.
echo Running XBMC on RAM Drive...
echo.
C:
cd "Program Files (x86)"
cd XBMC
start XBMC.exe
exit

And save it on the backup folder C:\XBMC Backup Folder as a batch file.
Give it a self-explanatory name, such as XBMC on RAMDisk.bat

2. Create a shortcut pointing to the batch file and save it on the startup folder (C:\Users\[USERNAME]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Do not point the shortcut to the All User startup folder (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup) as it will execute on another user's login activity, including Guests and RDPs.


To backup XBMC to the assigned backup folder and re-run XBMC, do the following :

1. Using notepad, paste the following code :
Code:
echo off
cls
echo.
echo Synchronizing XBMC program directory...
echo.
echo Securing fallback...
ren C:\XBMC Backup Folder\XBMC "XBMC Backup In Progress"
echo Creating container...
md "C:\XBMC Backup Folder\XBMC"
echo Execute backup...
xcopy R:\XBMC "C:\XBMC Backup Folder\XBMC" /E /H /K /Q
echo.
echo Running XBMC on RAM Drive...
echo.
R:
cd R:\XBMC
start XBMC.exe -p
echo Purge fallback...
rd "C:\XBMC Backup Folder\XBMC Backup In Progress" /s /q
exit
And save it on the backup folder C:\XBMC Backup Folder as a batch file.
Give it a self-explanatory name, such as XBMC Backup.bat

2. Create a shortcut pointing to the batch file and save it on, say, Desktop or any other place easily reachable. Run this shortcut periodically or before the computer goes off / restarting.
(This post was last modified: 2012-10-30 04:31 by Palthron.)
find quote
Palthron Offline
Junior Member
Posts: 10
Joined: Apr 2012
Reputation: 0
Post: #8
RAM Disk softwares (WIP)

[Image: xbmconramdiskramdisksof.png]
(This post was last modified: 2012-10-30 08:11 by Palthron.)
find quote
rumpleforeskin Offline
Junior Member
Posts: 10
Joined: Oct 2012
Reputation: 0
Post: #9
I also employ a Ram Disk to speed up XBMC though in a slightly different way as I only have my thumbnail folder moved to the Ram Disk.

I have done this by moving my thumbnail folder from the local XBMC folder and pasting it to the Ram Disk
Then I used the mklink command (windows command prompt) which will create a link from the old thumbnail location to the new.
This way XBMC still believes that the thumbnail folder in in the original location even though it has been moved to the ramdisk

This is the command for creating the symlink (folder junction)
mklink /j c:\users\"USERNAME"\appdata\roaming\xbmc\userdata\thumbnails "RAMDISK DRIVE LETTER":\thumbnails
replace USERNAME and RAMDISK DRIVE LETTER

I use the asrock XfastRAM Ram Disk utility, it has the option to save and load the ramdisk conents automatically at shutdown and reboot. The only downside is that it is limited to users who have an AsRock motherboard.

This method basically loads all the artwork to the RAM after a reboot, when in XBMC this significantly speeds up the posters/fanart loading when going into "Movies" or "TV Shows".
The downside of this is that after a reboot i need to allow 1 min before launching XBMC for the data to be restored to the ramdisk.
This is good for as my XBMC machine only gets a reboot for windows updates every few weeks, the rest of the time it uses sleep, which preserves the data in RAM.
find quote
LordMerlin Offline
Member
Posts: 84
Joined: Sep 2009
Reputation: 0
Post: #10
Gavotte Ramdisk
Free, command line, load image, save image, unmanaged memory usage.
find quote
Palthron Offline
Junior Member
Posts: 10
Joined: Apr 2012
Reputation: 0
Post: #11
(2012-10-30 11:49)rumpleforeskin Wrote:  I also employ a Ram Disk to speed up XBMC though in a slightly different way as I only have my thumbnail folder moved to the Ram Disk.
That's how I did it originally. But since I've been using the Aeon MQ skin (Latest being version 4) and the extrapacks, I chose to backup the whole home folder as the skin itself kept backgrounds etc. on its own folder that sized up to 400MBs or more. I don't know how much impact differences it does to the performance, I just took the easy way.

(2012-10-30 11:49)rumpleforeskin Wrote:  I used the mklink command (windows command prompt) which will create a link from the old thumbnail location to the new.
This way XBMC still believes that the thumbnail folder in in the original location even though it has been moved to the ramdisk
MKLink IS a better implementation. Apparently I didn't do enough research. I'll update my post as soon as i experimented with it. Thank you.

NB : That is a disturbing username Big Grin


(2012-10-30 14:14)LordMerlin Wrote:  Gavotte Ramdisk
Free, command line, load image, save image, unmanaged memory usage.
Many thanks for the reference. I couldn’t find an official website, only references in various forums and newsgroups, e.g. TechSnack. But a quick read indicates a working set of command to mount/unmount image that can be executed from a command line. So maybe I've misunderstood your post. ImDisk does support image creation etc. but i opted for manual xcopy operation so as to easily maintain backups just like an ordinary folder; and rawcopy (the original command to make images from ImDisk) is oddly slower than manually copying folders in and out.
Either that or I've missed something in the GUI there. Is this what you meant on your first post?
find quote
LordMerlin Offline
Member
Posts: 84
Joined: Sep 2009
Reputation: 0
Post: #12
In the utility I offered you can save the image of the RAM disk. This can be done from the GUI or from command line.,
RamDisk Packer/Utility v1.1
Usage: rdutil {filename|drive:|registry} [filename|registry]
rdutil {load|save} filename
rdutil unpack packed unpacked
rdutil link dir target
find quote
Livin Offline
Posting Freak
Posts: 3,535
Joined: May 2004
Reputation: 17
Location: above ground
Post: #13
What is the rela-world speed comparison running RAM Disk vs on an SSD? In other words... is it noticeably faster when navigating and playing/stopping music, videos, scripts, etc?

I'm not an expert but I play one at work.
find quote
Livin Offline
Posting Freak
Posts: 3,535
Joined: May 2004
Reputation: 17
Location: above ground
Post: #14
so lots of chit chat but no one has any feedback on their results?

I'm not an expert but I play one at work.
find quote
Palthron Offline
Junior Member
Posts: 10
Joined: Apr 2012
Reputation: 0
Post: #15
(2012-12-14 08:17)Livin Wrote:  What is the rela-world speed comparison running RAM Disk vs on an SSD? In other words... is it noticeably faster when navigating and playing/stopping music, videos, scripts, etc?
Compared with Crucial M4, it's a wee bit faster on startup and the first thumbnails view (On wall view mode), but may not be as feasible if you're already on SSD.
Tested on an uninformed user, he said that it is noticeably faster compared to the previous setup (SSD). But to be fair, my SSD is nearly full with only 20GBs free space.

NB : MKLinks work wonders, but i haven't got the drive to write a full blown tutorial.
(This post was last modified: 2012-12-30 22:41 by Palthron.)
find quote