Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
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.
Say I have a machine with 512MB of ram in it and I create a 9.5GB swap partition. Then I put the necessary stuff in to /etc/fstab to mount a 10GB tmpfs partition. Is that an OK thing to do, or is it a hideously bad liable to cause the system to lock up under certain circumstances?
I've done a quick test creating a 1GB tmpfs partition and filling it by creating a big file with dd and the system kept running OK. But maybe I was lucky.
Why am I thinking of this? Because I'm thinking about a web kiosk set up where users would just be able to run Firefox and nothing else and I'd make /home a tmpfs partition for both speed and as it's wiped out by a reboot. Even with Firefox's disk cache usage left at the default 50MB there shouldn't be more than about 100MB in /home at any one time, but I'd be using hardware with only 512MB ram and I'm thinking having lots of space in /home just in case someone manages to write a bunch of stuff there (though I'd lock Firefox down and remove the file chooser dialogues) might be a good idea.
While you might be able to make it work it wouldn't really have the desired effect. In fact I suspect it would likely worsen overall performance.
This is because once the physical ram is exceeded you're immediately dropping back down to disk speed when you access swap. Additionally because you've tied up almost all your physical ram with this tmpfs you'd have caused a memory constraint on the rest of your processing (remember you need for man than tmp space for running processes).
In fact this has a lot to do with the reason why most systems these days do "paging" rather than "swapping" because performance on systems that used to do heavy swapping generally was horrible.
If you truly need the additional performance you really want to increase RAM rather than try to do this.
So you want to use disk to emulate ram to emulate a disk, odd thing.
If you really need such a huge amount of space on tmpfs, then it's definitely time to upgrade your box and buy more ram. If you are going to be swapping 9.5GB or ram at any time, your box will be definitely locked during hours to do simple tasks.
Why am I thinking of this? Because I'm thinking about a web kiosk set up where users would just be able to run Firefox and nothing else and I'd make /home a tmpfs partition for both speed and as it's wiped out by a reboot.
Perhaps it would be easier just to create a script to clear the home folder
Perhaps it would be easier just to create a script to clear the home folder
Well yeah, wiping out the contents of /home every time the machine is rebooted is trivial. I was thinking of having /home in tmpfs for speed. There would be potentially thousands of users of the kiosk each of whom have to log in with their own usercode. So I'd have home directories created for them using pam_mkhomedir (or whatever the module's called, not on a Linux box right now) and having /home in tmps dramatically reduces the time between someone logging in and being able to do stuff. Just leaving /home on the harddisk is of course the easiest thing to do, I just like the idea of making the time between login and usability as short as possible.
But it overall it sounds like using tmpfs could potentially be more trouble than it's worth so I probably won't bother.
You can try... It's a trivial thing to setup, but really, I doubt it's worth it.
Remember that firefox is not the lightest thing. Gtk2 and the gecko engine are two beasts in terms of ram usage, and if you are going to be using firefox all the time, your ram will most likely be filled completely almost always. That and tmpfs will bring your machine to it's knees, I bet. But, as said, trying doesn't hurt...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.