4

This question is in continuation to this question. I download a lot of small files (a few MBs) which I delete after being done with them. So can I make it that all changes to be saved to my filesystem be made in the RAM if it's under certain size? For example, if I set the limit to 128 MB, all files under that size will be saved to the RAM, and only saved to the HDD before shutdown.

2
  • If those small files are thrown away after use, you can use a ramdisk as well. For example, my /tmp is mounted tmpfs (which resides in the RAM). If I need to peek into the source of a package, I apt-get source it in /tmp. When done, I remove it if I think about it.
    – Lekensteyn
    Sep 12, 2011 at 14:22
  • My understanding is that tmpfs uses swap for storage, while ramfs uses RAM - see thegeekstuff.com/2008/11/overview-of-ramfs-and-tmpfs-on-linux
    – Sergey
    Sep 12, 2011 at 21:04

1 Answer 1

8

Firstly, the dangers of writing to an SSD drive may be greatly exaggerated - unless you're planning to prolong its life beyond year 2100 :)

Secondly, keeping the data in RAM and then writing it to the disk later in one go is basically what Linux filesystem does anyway - though the emphasis is on preserving the data, not minimizing the number of writes.

Thirdly, you can create a ramdisk and save your temporary data there. Then I imagine you could have some script which rsync's the contents of the ramdrive with a folder on the disk. Then you can either invoke it manually (Big Save Button on your desktop) or add it to shutdown scripts. The whole thing would be pretty unreliable though.

I mean - moving swap and logs off an SSD is one thing, but, say, not saving a document I'm working on to minimize the number of writes may be a bit extreme :)

1
  • 2
    It's a 16 GB USB, even if exaggerated, at the rate I download and delete data, I'd say it'd hardly live two years.
    – Oxwivi
    Sep 13, 2011 at 8:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .