to-ram=XXX boot option

Asked by Alex


Could you explain how the "to-ram=XXX" option works in comparison with casper's "toram" documented in , please? Is turnkey suitable to be hacked that way?

Thanks in advance!

Question information

English Edit question
TurnKey Linux Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Revision history for this message
Alon Swartz (alonswartz) said :

The to-ram option is documented in
    to-ram=XXX Load the system into memory if XXX (reserved RAM size in MB) is available

I think that pretty much explains the option usage.

The code is implemented in a forked version of casper (see and the code is available on

We developed the to-ram option for a different project, but we thought that it would be a nice addon feature and decided to include it by default.

I hope the above is helpful.

Revision history for this message
Alex (alessandro-b) said :

Thanks for replying so fast!

Quoting myself: "Is turnkey suitable to be hacked that way?", i.e. converted to an image loaded from the hard disk to RAM. I'll look carefully at the code, however I assume the answer is yes, isnt'it?

BTW, the parameter is listed as "to-ram" in the documentation, but in the code is "toram" (without hyphen):

parse_cmdline() {
    for x in $(cat /proc/cmdline); do
        case $x in


Revision history for this message
Alon Swartz (alonswartz) said :

Oops! Good catch. I updated the wiki to reflect the correct boot param (toram), thanks!

Regarding your question, I re-read the wiki page (skimmed it the first time, so I missed the crux of the matter, sorry!).
Correct me if I'm wrong, but from what I understand it explains how to customize an *installed* ubuntu system to boot using casper so it runs in non-persistent mode - interesting concept.

I don't see why this wouldn't work with TurnKey, and would be interested in your findings.

What is actually more interesting is why you would want to? What are you trying to achieve?
The only use-case I can think of is to run customized turnkey appliance in non-persistent mode, with the ability to reboot into a clean instance of the customized installation.

Alon Swartz

Revision history for this message
Alex (alessandro-b) said :


actually that page shows how to boot from a squashfs image on the harddisk and then load the uncompressed system to ram. The squashfs may be created starting from a livecd as well as from an installed system (see and respectively: I presume you know them, however ). The benefit I'm looking for is avoiding "Abrupt poweroff: Since the hard disk is only momentarily used in read-only mode during boot, then never touched again, there are few or no negative consequences of an abrupt poweroff. If a system is used where power is inconsistent, or the system is regularly used in a context where fast shutoffs are required, this is very handy." That way the core system is rock-solid like a firmware: system and applications may be updated only deploying a new squashfs image to the machine. Adding *persistent* mode (see my post on your forum: ) would do the trick and allow users to save their data and logs. However I know there are some issues with persistent mode in Hardy (some solutions have already been provided on the bugtracker). If persistent mode is not available, some scripts to mount rw a partition when needed may be (easily ?) written.

I'm still working on it and would be glad to cooperate with you, if I'm not on the wrong way. Any feedback on my thoughts would be greatly appreciated. :-)


Revision history for this message
Alon Swartz (alonswartz) said :

Hey Alex,

Thanks for your detailed explanation of your requirements.
Depending on what type of data your require to be persistent dictates the type of persistence you need. If all you need is to store data, the easiest solution would be to boot a vanilla TurnKey appliance, and just mount a data device, that being on the local machine or on the network.

On the other hand, if what you need is to customize the actual system (install packages, custom configurations) you would either need to hack the livecd (see, create a couple of hook scripts which perform the customization at each boot, or use the solution you mentioned above.

What ever direction you decide, let us know and we will try to provide the assitance you need.

Good luck!

Revision history for this message
Alex (alessandro-b) said :

Hi Alon,

Thanks for your answer.

I am trying to add persistence to your casper code as well as some fixes for inodes corruption.

I'll let you know!