[SOLVED] using loads of ram--loading Slackware and maybe other stuff into RAM
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
using loads of ram--loading Slackware and maybe other stuff into RAM
My PC has 64 GB RAM because for 10+ years I have used a PC for distributed computing, like BOINC, GIMPs, and I have other projects I thought potentially could have used a lot (even opening large art files, or maybe one day, programming).
Someone on FreeNode IRC ##slackware suggested with the amount of RAM I have, I should load Slackware (and maybe other stuff) into RAM. How would I go about doing this?
One part of the filesystem you can safely mount in RAM is /tmp, by changing it in /etc/fstab
Code:
tmpfs /tmp tmpfs defaults,nodev,nosuid 0 0
I think by default it allows for half of your RAM (but doesn't allocate it until something is actually put into /tmp). Some people talk about mounting /var into RAM as well, but this doesn't seem like a good idea since /var is expected to persist across reboots.
My PC has 64 GB RAM because for 10+ years I have used a PC for distributed computing, like BOINC, GIMPs, and I have other projects I thought potentially could have used a lot (even opening large art files, or maybe one day, programming).
Someone on FreeNode IRC ##slackware suggested with the amount of RAM I have, I should load Slackware (and maybe other stuff) into RAM. How would I go about doing this?
makes not that much sense, you need to read the distro and load it into ram,
there can you start the program directly also, might be faster
the view milliseconds you gain when starting binaries, ...
dlls are in the ram
hd has super fast chace
ssd is fast ..
and if you have persistent data you need to sync it anyway
no, makes onlly senes if you load from a slow medium like sdcars ...have spezial requirements...
I don't think it's a good idea to load the entire system into RAM if it's solely for a performance boost (check this post from TobiSGD). As he says, it makes more sense to run the system from a decent SSD and do disk intensive stuff in /tmp (mounted in RAM). If it's just for fun or to set up some kind of non-persistent system then I guess so.
One part of the filesystem you can safely mount in RAM is /tmp, by changing it in /etc/fstab
Code:
tmpfs /tmp tmpfs defaults,nodev,nosuid 0 0
I think by default it allows for half of your RAM (but doesn't allocate it until something is actually put into /tmp). Some people talk about mounting /var into RAM as well, but this doesn't seem like a good idea since /var is expected to persist across reboots.
You can specify how much space tmpfs will use also, some programs like icecat will need to be compiled elsewhere for being fat though.
Well, I experimented with zram a while ago...
I had a read-only "gold image" (in RAM) that was used in 6 or 7 VMs (windows server 2003)
They had a read-write snapshot where changes were recorded (on a HDD).
Needless to say that they went a lot faster
I would actually suggest not rebooting as a method and just suspending when you're done with the computer.
Linux already uses all that ram since every program, every file is automatically loaded into ram after you open it initially.
Run this command to see information about your ram:
So while you can setup something that loads everything into ram at bootup, the kernel is already doing a lot of this automatically. If you work with a diverse amount of stuff and not rebooting (resetting the ram usage), you've probably already been making use of a lot of your total capacity.
This secondary page to linuxatemyram makes the point pretty well.
Code:
$ time python hello.py
Hello World! Love, Python
real 0m1.026s
user 0m0.020s
sys 0m0.020s
$ time java Hello
Hello World! Regards, Java
real 0m2.174s
user 0m0.100s
sys 0m0.056s
$
Wow. 1 second for Python, and 2 seconds for Java? That's a lot just to say hello. However, now all the file required to run them will be in the disk cache so they can be fetched straight from memory. Let's try again:
$ time python hello.py
Hello World! Love, Python
real 0m0.022s
user 0m0.016s
sys 0m0.008s
$ time java Hello
Hello World! Regards, Java
real 0m0.139s
user 0m0.060s
sys 0m0.028s
$
Yay! Python now runs in just 22 milliseconds, while java uses 139ms. That's 45 and 15 times faster! All your apps get this boost automatically!
I do not normally shut off, reboot, or suspend my computer, and will not start doing the last since I never seem to be able to come out of it. Ok, maybe I will not load Slackware to RAM, since I already have a SSD. The '/tmp' directory is something I wanted to not load to RAM, because if I build packages with SBo, forget, reboot, then they will all be gone.
The '/tmp' directory is something I wanted to not load to RAM, because if I build packages with SBo, forget, reboot, then they will all be gone.
You can have sbopkg build your source code in /tmp with the resulting packages stored elsewhere. For that you want to edit /etc/sbopkg/sbopkg.conf and change
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.