to-ram=XXX boot option

Asked by Alex

Hi!

Could you explain how the "to-ram=XXX" option works in comparison with casper's "toram" documented in https://wiki.ubuntu.com/BootToRAM , please? Is turnkey suitable to be hacked that way?

Thanks in advance!
Alex

Question information

Language:
English Edit question
Status:
Solved
For:
TurnKey Linux Edit question
Assignee:
No assignee Edit question
Solved by:
Alex
Solved:
Last query:
Last reply:
Revision history for this message
Alon Swartz (alonswartz) said :
#1

The to-ram option is documented in http://wiki.turnkeylinux.org/Reference/Boot_options
    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 http://wiki.turnkeylinux.org/Reference/Custom_packages) and the code is available on http://code.turnkeylinux.org

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 :
#2

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
            toram=*)

Thanks!
Alex

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

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.

Cheers,
Alon Swartz

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

Hi,

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 https://help.ubuntu.com/community/LiveCDCustomization and https://help.ubuntu.com/community/LiveCDCustomizationFromScratch 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: https://www.turnkeylinux.org/forum/general/20090528/running-live-and-persistent-mode ) 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. :-)

Cheers,
Alex

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

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 http://wiki.turnkeylinux.org/Reference/Developing_Live_CDs), 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 :
#6

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!