Forum
  • Search
  • Member List
  • Calendar
Hello There, Guest! Login Register — Login with Facebook

[IDEA] Making best use of 512mb Pi with tmpfs
Thank you for your donation

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
Idea: Making best use of 512mb Pi with tmpfs
9th Apr, 2013, 08:06 AM
Post: #1
JayBlanc Offline
Registered
Posts: 20
Joined: Apr 2013
Reputation: 4
Making best use of 512mb Pi with tmpfs
THIS IS DEPRICATED, DO NOT TRY IT.

This will no longer have a beneficial effect with future changes to memory handling and swap space in the next version. I recommend reversing the changes if you made them.

---------------------
Having a recent Rev.B I've modified my xbian set up to make a bit better use of the memory available.

First, I've mounted /tmp as a tmpfs. The defaults are fine because half of hardware memory as the top limit appears okay for the intended use. (Deliberately leaving /var/tmp alone as that may have large files written to it.)

Add the following line to /etc/fstab
Code:
tmpfs   /tmp         tmpfs   nodev,nosuid    0    0

Stopping XBMC, I symlink ~/.xbmc/temp to /tmp/, ~/.xbmc/userdata/addon_data/cache and ~/.xbmc/userdata/addon_data/script.common.plugin.cache to /tmp/, then reboot.

Terminal

sudo /etc/init.d/xbmc stop
rm /home/xbian/.xbmc/temp
ln -s /tmp /home/xbian/.xbmc/temp
rm /home/xbian/.xbmc/userdata/addon_data/cache
ln -s /tmp /home/xbian/.xbmc/userdata/addon_data/cache
rm /home/xbian/.xbmc/userdata/addon_data/script.common.plugin.cache
ln -s /tmp /home/xbian/.xbmc/userdata/addon_data/script.common.plugin.cache

Then create cron.daily script that reaps old files from /tmp/ to try and prevent overflow on a device that is rarely rebooted.

Code:
#!/bin/sh
#/etc/cron.daily/reaptmp

find /tmp/ -type f -mtime +3 -exec rm {} \;

Remember to run chmod a+r on the file so it will run every day. Then reboot.

Benefit: Noticeable responsiveness improvements in addons that create and process temporary files. Particularly ones that process downloaded rss/xml files, or download subtitle files.

Drawbacks: Caches cleared on reboot. But reboots are hopefully uncommon for XBian.

If anything fills /tmp/ with data over ~190mb, it's going to fail. I've yet to see this happen, and I don't know of any xbmc addon that would do this. If you know of a addon that uses creates temporary files over ~190mb, you might want to ask the addon's creator to store these files in a cache in it's addon_data directory. .xbmc/temp/ and common_cache appear to be intended for small temporary files only. tmpfs can be expanded beyond free memory, because it uses swap, but it can never be set above total hardware memory due to memory allocation handling.

There is the minor possibility that this could cause an issue due to file name collisions with something else. I haven't seen this happen on xbian, but it might be worth making a init script that properly creates a unique directory name in /tmp/ and creates the symlinks on boot.
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


Messages In This Thread
Making best use of 512mb Pi with tmpfs - JayBlanc - 9th Apr, 2013 08:06 AM
Making best use of 512mb Pi with tmpfs - Koenkk - 9th Apr, 2013, 08:52 AM
RE: Making best use of 512mb Pi with tmpfs - CurlyMo - 9th Apr, 2013, 06:15 PM
RE: Making best use of 512mb Pi with tmpfs - JayBlanc - 13th Apr, 2013, 05:19 AM
RE: Making best use of 512mb Pi with tmpfs - mk01 - 15th Apr, 2013, 02:03 PM
RE: Making best use of 512mb Pi with tmpfs - namtih - 16th Apr, 2013, 02:53 AM
RE: Making best use of 512mb Pi with tmpfs - JayBlanc - 21st Jun, 2013, 07:18 AM
RE: Making best use of 512mb Pi with tmpfs - mk01 - 23rd Jun, 2013, 01:22 AM
Re: RE: Making best use of 512mb Pi with tmpfs - f1vefour - 23rd Jun, 2013, 05:44 AM

  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:

Current time: 23rd May, 2025, 02:16 PM Powered By MyBB, © 2002-2025 MyBB Group.