1

I recently made a full installation of Ubuntu 15.10 to a USB drive.

In order to make it faster, using RAM, I made /tmp folder to mount on RAM on boot, by adding this line to fstab:

tmpfs /tmp tmpfs defaults,noatime,nosuid,nodev,mode=1777 0 0

Which other system folders is safe to move to RAM in the same manner? By "safe" I mean folders that their contents either never change or the changes in them won't be needed after reboot.

I accept the risks from power failure, bad hardware or RAM getting overloaded.

4
  • Anything you don't need if you have a powercut (essentially).
    – Tim
    Feb 18, 2016 at 13:18
  • Define "safe" As ram is not saved to disk you will have data loss with any power failure or any problem with ram such as bad hardware or running out of ram
    – Panther
    Feb 18, 2016 at 13:26
  • safe I mean the system folders that their contents either never change or the changes won't be needed over reboot... I accept bad hardware and running out of RAM as needed risks... I really don't know what I actually need, that's why I'm asking this question Feb 18, 2016 at 14:25
  • Change the desktop enviroment if you need more performance. Mounting to RAM is not a good choice. Feb 18, 2016 at 16:26

3 Answers 3

3

Knowing that this is over a year old, I still feel the need to jump in here. For cases where I had loads of free (really never used) RAM I suffered from the same non-answers to a similar request, yet I always noticed that the systems were NOT using up all possible/available RAM. What I ended up doing was: I put as many of /etc /var /usr and /home into ramdisk as I could fit (I had about 12 GB RAM for that), and rsynced back to disk with a cron-job each of the mounted parts, so I would have a backup in case of power-failure. I also created an unload to disk before shutdown/reboot, and a return copy to RAM at boot using /etc/rc.local, so the machine would always be able to reboot and lose nothing. Rest assured that I've never even once needed the backup! And it's been running that way for 3 years on a debian server. Blazing fast IO response time by the way. Using tmpfs for it wasn't any good, certain software seemed to not want to run from tmpfs, but would run fine from a separate ramdisk I mounted. And I did have to use special mount options for some software that doesn't like to run from ram, but they are all use-case specific.

1

You're essentially asking "What system folders can I load into RAM rather than save on the disk".

The short and vague answer is that "You can load any folders into RAM by making them 'tmpfs' mount points in /etc/fstab, if and only if the folders contain temporary files or items that do not need to survive reboots", and, "We cannot answer this question with any specificity because there is no bounds on the scope of the question."

The longer, but equally as vague, answer is "What can or cannot be loaded into RAM cannot be described in the scope of a short answer here". Different systems and software handle caching of information, or storage of temporary files, slightly differently, and none of them are usually designed to utilize a tmpfs/ramdisk to store those files, as some of them need their caches to survive reboots.

For all intents and purposes, the only 'safe' directory for being loaded into RAM this way is /tmp, as the contents of that directory are extrememly regularly erased, by reboots. It should be kept in mind, though, that if you want to do this with /tmp you will likely need to give it a larger amount of ramdisk space (such as 1024MB or 1GB) which will detract from your available memory on the system.


TL;DR: Within the scope of this site, /tmp is one of the few items that can be sanely put into a RAM disk / tmpfs space. We cannot comment on whether any other system directories can be loaded into tmpfs, as we do not know the needs of your system, the needs of the software you need, nor what your ultimate goal is with such an endeavor.

6
  • I run Ubuntu on a USB drive, so my ultimate goal is to just minimize the read/write procedures on it, in order to make the system faster. I only use this for a recovery tool and also as a way to be on Internet, listen to music, watch movies etc, as long as my normal system is out of order. Feb 18, 2016 at 14:45
  • @HarvesteridiosMoufidios There is nothing you can do to make your system faster if you are running off of USB. The system bottleneck is the data transfer rate of USB compared to an actual installation to an HDD or SSD. You will not be able to increase the speed of your system in this manner; in fact, trying to put folders and system resources into RAM from the USB disk may actually reduce your performance on the system even more than it already is.
    – Thomas Ward
    Feb 18, 2016 at 14:47
  • I thought that, since this system is not indented for heavier use that the one described in my previous comment, it would be better to make the trade "longer boot time over faster performance", since my RAM is enough for this. Feb 18, 2016 at 14:52
  • @HarvesteridiosMoufidios your boot time wont' improve - that's the point. By using a USB disk as the place of the installation, you are already doing yourself a disservice by forcing it through the VERY LIMITED speed of a USB connection. Whether you move data off into RAM or not, you will still not improve your speed or boot times.
    – Thomas Ward
    Feb 18, 2016 at 14:53
  • I don't want to improve the speed of my boot times. In fact, I don't mind increasing them in order to have better performance. For example, moving /tmp to RAM already made a huge difference. Also disabling Firefox's use of disk and forcing it to use only RAM also helped and I still have enough RAM available for all these simple tasks I need. Feb 18, 2016 at 14:58
0

After putting the /tmp into ram and Firefox's cache (which it sounds like you did), the easiest way to improve performance for browsing, casual use, it to use the guest session, which is run out of ram. The desktop environment writes a large number of (hidden) files, so that gives you a big boost. Forgo any failure analysis, and put /var/log into ram too. Really, sounds like you want a persistent live media with the "toram" key on the boot line -- which copies the filesystem into ram and gives you really snappy (better than a hard disk) performance on first invocation). The USB filesystem will use caching anyway, so invocations after the first should be faster. Check out other locations with heavy writes with iotop, and consider putting them into ram.

1
  • What you suggest sounds like the frugal installation option that other distributions like puppy Linux offer. Is there an updated tutorial for doing this in Ubuntu 15.10 that you could point out for me? I have searched for this, but if you know a tutorial that it guaranteed to work I'll be thankful. Feb 18, 2016 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.