I am running a package that adds data to the end of 140–300 files each time through the process.

I'm thinking of moving the process to a RAM disk, and using rsync to copy it back when done. My goal is to reduce wear by eliminating disk head seeks.

Will this work? If so, how do I go about creating the RAM disk?

  • Have you benchmarked it? The kernel already buffers writes, so the data won't be written as long as there's memory available. Have you actually observed all those disk seeks, or are you just imagining them? – Gilles Jun 3 '14 at 23:46

I imagine that this can work if you do have enough ram for the process's demands. I propose using tmpfs instead of ramfs; this way you 'll prevent kernel hiccups when out of ram.

Just create a mount point and then mount a tmpfs on it (like here):

 # mkdir /mnt/tmpfs.ramdisk
 # mount -t tmpfs -o size=100M tmpfs /mnt/tmpfs.ramdisk

You can of course add a permanent entry in /etc/fstab:

tmpfs   /mnt/tmpfs.ramdisk  tmpfs  nodev,nosuid,noexec,nodiratime,size=100M 0  0

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.