LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 09-25-2011, 03:09 PM   #1
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,357
Blog Entries: 2

Rep: Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980
Running Slackware from RAM


I am thinking about running Slackware totally from RAM on one of my machines (may be with upgrading to 16GB before).
As far as I understand it the system has to be copied from disk to RAM at boot time, and when it is shutdown the system has to be copied back ( I would rather like it to be asked if that should happen at shutdown).

Has anybody achieved something like that already?
I tried to find information on that topic on the web, but either the information is not available or my Google-Fu is not good enough.
If anyone knows a link to a How-To or knows how to do that and can help me with it I would really appreciate that.

Sidenote: I am (currently) not interested in creating a live-system for that purpose (since it lacks the functionality of saving back changes at shutdown), may be I will look later at that for creating some kiosk systems. I am also at this point not interested in a discussion why I want to do that, at this point I want just to know if it is possible, and how to achieve it, if it is possible.

Thanks for your effort in advance.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 09-25-2011, 03:37 PM   #2
zk1234
Member
 
Registered: Oct 2010
Location: Poland
Distribution: 4MLinux, Slackware, Slitaz, Mint
Posts: 112

Rep: Reputation: 7
As far as I remember, Tiny Core (http://distro.ibiblio.org/tinycorelinux) is able to work in the way described by you.
 
Old 09-25-2011, 04:31 PM   #3
jamesf
Member
 
Registered: Dec 2004
Location: USA
Distribution: Slackware 12 and higher
Posts: 218

Rep: Reputation: 44
I've used two distros that run from RAM and allow saving state back to a hard drive.

Puppy Linux at http://puppylinux.org/main/Overview%...%20Started.htm

Slax (based on Slackware) at http://www.slax.org, maintainer's blog at http://www.tomas-m.com/blog/

The google search phrase "linux run from ram" returns quite a few hits. I found various distros and methods to do it there.

I can't find it now, but I know that I've read about some of the tools used to do this. IIRC, some distros use the "toram" boot argument to achieve it for that distro. Adding "toram" to the phrase above, and then telling google I wanted to search for "toram" rather than "to ram", brought up some more hits.

Good luck!
 
1 members found this post helpful.
Old 09-25-2011, 05:06 PM   #4
jefro
Guru
 
Registered: Mar 2008
Posts: 11,006

Rep: Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356
It is very possible to do what you want.

A lot of issues and a lot of choices need to be made.

One way is the live cd. It basically doesn't care since it is a live filesystem and it just loads up to ram each time and some options for persistent file someplace.

A way to create your own modified distro that boots to ram but most of the static files remain on hard drive. You may have to choose how much you want moved at boot.

Another is to create and format ramdrive at boot then copy over then chroot.

Look for search terms such as "toram" copy2ram and ramboot.

The best way is to get a revodrive.

Might look at setting up a iscsi target or pxe/gpxe/ipxe an install.


http://www.linuxquestions.org/questi...ilence-662116/

https://wiki.ubuntu.com/BootToRAM

http://www.vanemery.com/Linux/Ramdisk/ramdisk.html
 
Old 09-25-2011, 08:27 PM   #5
e5150
Member
 
Registered: Oct 2005
Location: Sweden
Distribution: Slackware
Posts: 73

Rep: Reputation: 41
I've been running my slackware from RAM since about mid 2007. So it is certainly possible.
In early attempts I did copy the system back to disk at shutdown. But I've come to prefer the method of having the system packed up in a tarball which I explicitly rebuild when I want to make changes stick across reboots (with the exception of /etc which crond copies from RAM every day, and then the latest backup is copied from disk at boot.) However I don't see any perticular problems with having a "live" system on disk copied to/from RAM at boot/shutdown.

Assuming you have a system installed on sdb1, which you want to run from tmpfs, here is a few things you would want/need to do:
* Create an initrd which fscks and mounts sdb1; mounts tmpfs; copies content of sdb1 to tmpfs; unmount sdb1; swich_root to mountpoint of tmpfs. I think the sample initrd in /usr/share/mkinitrd/initrd-tree.tar.gz is good enough, if you just rewrite the /init script.
* Edit /etc/rc.d/rc.S so that it doesn't whine about / being mounted read-write.
* Make an /etc/rc.d/rc.local_shutdown to copy the system back to disk, something like this would probably suffice:
echo 'Save state? [yes/NO]'
read ans
if [ "x$ans" = "xyes" ];then
rsync --one-file-system --archive --delete / /mnt/sdb1/
fi
* Keeping /var on disk so your log files are (at least somewhat) intact when the system crashes.

With some shell scripting knowledge it shouldn't be too hard to get a proof of concept up and running before trying to figure out all the details.
 
3 members found this post helpful.
Old 09-25-2011, 10:14 PM   #6
neymac
Member
 
Registered: May 2009
Distribution: Slackware64-14.0
Posts: 114

Rep: Reputation: 11
Try Porteus ( http://porteus.org/ )
 
1 members found this post helpful.
Old 09-25-2011, 10:50 PM   #7
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,357
Blog Entries: 2

Original Poster
Rep: Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980
Thanks for your answers.

Quote:
Originally Posted by jefro View Post
One way is the live cd. It basically doesn't care since it is a live filesystem and it just loads up to ram each time and some options for persistent file someplace.
AFAIK, most live distros do not copy themselves into RAM, otherwise it would not be possible to run a live-system on a machine where the size of the image exceeds the amount of RAM. You can observe this when you have to wait for the CD drive to spin up after issuing a command.

Quote:
Assuming you have a system installed on sdb1, which you want to run from tmpfs, here is a few things you would want/need to do:
* Create an initrd which fscks and mounts sdb1; mounts tmpfs; copies content of sdb1 to tmpfs; unmount sdb1; swich_root to mountpoint of tmpfs. I think the sample initrd in /usr/share/mkinitrd/initrd-tree.tar.gz is good enough, if you just rewrite the /init script.
* Edit /etc/rc.d/rc.S so that it doesn't whine about / being mounted read-write.
* Make an /etc/rc.d/rc.local_shutdown to copy the system back to disk, something like this would probably suffice:
echo 'Save state? [yes/NO]'
read ans
if [ "x$ans" = "xyes" ];then
rsync --one-file-system --archive --delete / /mnt/sdb1/
fi
* Keeping /var on disk so your log files are (at least somewhat) intact when the system crashes.

With some shell scripting knowledge it shouldn't be too hard to get a proof of concept up and running before trying to figure out all the details.
That seems to be exactly what I was looking for, thanks for that. I will try to make my way through that and come back if I have more questions about that.

Marking as solved, at least temporarily.
 
Old 09-26-2011, 12:25 PM   #8
ottavio
Member
 
Registered: Nov 2007
Posts: 312

Rep: Reputation: 46
Quote:
Originally Posted by TobiSGD View Post
I am thinking about running Slackware totally from RAM on one of my machines (may be with upgrading to 16GB before).
As far as I understand it the system has to be copied from disk to RAM at boot time, and when it is shutdown the system has to be copied back
You need something like unionfs:
http://en.wikipedia.org/wiki/UnionFS

You can reuse the shutdown scripts from Knoppix.
 
Old 09-26-2011, 12:35 PM   #9
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,357
Blog Entries: 2

Original Poster
Rep: Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980
Quote:
Originally Posted by ottavio View Post
You need something like unionfs:
http://en.wikipedia.org/wiki/UnionFS

You can reuse the shutdown scripts from Knoppix.
Wouldn't the system still reside on disk instead of in the RAM? I want the whole system to be in RAM, may be except some directories (/var, /home, may be some others).
Currently setting up a VM for experimenting with e5150's suggestions, but not much time left today. Work really can be annoying if one has a project in mind.
 
Old 09-26-2011, 05:23 PM   #10
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,357
Blog Entries: 2

Original Poster
Rep: Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980
Yeah, it works. Thanks again to e5150 for your solution, now I have to fiddle more with that (and get more RAM). Didn't expect it to be so easy, really a straight forward approach.
 
Old 05-28-2012, 09:15 PM   #11
pino_otto
Member
 
Registered: Dec 2005
Location: Italy
Distribution: Slackware
Posts: 83

Rep: Reputation: 18
Quote:
Originally Posted by TobiSGD View Post
Yeah, it works. Thanks again to e5150 for your solution, now I have to fiddle more with that (and get more RAM). Didn't expect it to be so easy, really a straight forward approach.
Can you publish your scripts?

Soon I should have a computer with 128 GB of RAM. So I would like to do the same thing.
 
Old 05-28-2012, 10:19 PM   #12
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,357
Blog Entries: 2

Original Poster
Rep: Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980
After getting a fast SSD I have abandoned this approach, since there is no real benefit anymore. So I don't have any scripts for that, I just have done what e5150 posted in post #5 and it worked. Of course there will be some fine-tuning after that.
 
Old 10-20-2012, 10:04 PM   #13
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949
Blog Entries: 8

Rep: Reputation: 201Reputation: 201Reputation: 201
Just curious, but what kind of speed increase did you get? I just built a monster and I'm trying to figure out something interesting to do with 32GB of memory.
 
Old 10-20-2012, 11:18 PM   #14
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,357
Blog Entries: 2

Original Poster
Rep: Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980
I didn't make benchmarks on that setup, it just felt fast (almost instant application starts, ...). Of course this also only makes a difference the first time you start an application if you have large amounts of RAM.
But even on a very fast SSD or running from RAM I found out that the real time that is needed to start something depends almost solely on the application itself. KDE will steel need some time to start, so does Firefox. You will get a better performance increase with just changing to lightweight alternatives.

I now have only one mount on my main system as tmpfs, the /tmp directory, where I do all the heavy works. Compilation of a kernel works with -j10 with minimal I/O waits on a six-core CPU.
 
1 members found this post helpful.
  


Reply

Tags
copy, ram, run, slackware


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System running out of RAM hc_andy Linux - Newbie 8 12-21-2008 05:40 PM
Running RH9 on 26Mb of RAM? albean Linux - Newbie 2 06-14-2004 01:26 PM
Running a file from ram Bd22 Linux - Software 3 02-01-2004 01:05 AM
any linux distro can running in RAM , not need CD_ROM reading when running. wangcity Linux - General 3 09-18-2003 05:45 AM


All times are GMT -5. The time now is 06:18 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration