vorathiel21 | Hi people, i wanna put /home/user/.cache and /tmp directories in /run/shm to increase performance and clean temp files on every reboot. Can i do this with symlinks ?? | 19:06 |
---|---|---|
cmaloney | vorathiel21: I'd recommend using tmpfs for /tmp | 19:29 |
cmaloney | https://askubuntu.com/a/173294/1614 | 19:30 |
cmaloney | as far as cache is concerned unless there's a reason not to write .cache I'd leave it alone | 19:31 |
cmaloney | reason being: | 19:31 |
cmaloney | There's a lot of things in there that will take longer to re-create | 19:31 |
cmaloney | eg: thumbnails and the like | 19:31 |
cmaloney | so you'll slow your machine down if you constantly re-create cache | 19:32 |
vorathiel21 | thanx for your answer. i've already try tmpfs . it worked fine . The thing is today i discover this /run/shm directory | 19:37 |
cmaloney | It's the same thing | 19:37 |
cmaloney | If you cd to /run and type `df .` you'll see that it's using tmpfs | 19:37 |
cmaloney | https://askubuntu.com/questions/169495/what-are-run-lock-and-run-shm-used-for | 19:39 |
vorathiel21 | don't you think if i put those directories under /run/shm , them will share the space ?? i think it's a waste of ram to declare separated tmpfs in fstab for /tmp and .cache ... if there is already a ramdrive available on /run/shm | 19:42 |
vorathiel21 | am i wrong ?? | 19:43 |
cmaloney | I think you're misunderstanding how Linux allocates RAM | 19:43 |
vorathiel21 | it can be possible | 19:43 |
cmaloney | tmpfs is not cordoned off the way you might think it would be for a physical disk | 19:44 |
cmaloney | eg: /run/shm doesn't have half of your memory allocated | 19:44 |
cmaloney | It's showing the maximum that it will allocate | 19:45 |
cmaloney | What is allocated is what you see when you run df | 19:45 |
cmaloney | Linux tries to keep as much in an internal cache as possible for performance | 19:46 |
cmaloney | and will free up those pages as memory pressures become larger | 19:46 |
cmaloney | That's why if you run `free` you'll notice that there's precious little memory left | 19:46 |
cmaloney | that's Linux trying to ensure that it goes to disk as few times as it can | 19:47 |
cmaloney | most of the time it'll read things from cache | 19:47 |
vorathiel21 | hmmm | 19:48 |
cmaloney | here's an easy test | 19:49 |
cmaloney | as root: | 19:49 |
cmaloney | sync; echo 1 > /proc/sys/vm/drop_caches | 19:49 |
cmaloney | that will clear out the cache | 19:49 |
cmaloney | then run (as a normal user) `watch free` | 19:49 |
cmaloney | and use your machine | 19:49 |
cmaloney | You'll notice it start to fill up the cache again | 19:49 |
vorathiel21 | i understand. So... linux already is doing what am trying to do | 19:50 |
cmaloney | Exactly | 19:51 |
cmaloney | changing /tmp to tmpfs is still a decent idea | 19:51 |
cmaloney | I do it on all of my machines | 19:51 |
cmaloney | but going much beyond that isn't going to give you what you think it will | 19:52 |
vorathiel21 | thank you for enlightening me on this | 19:55 |
cmaloney | no problem. glad I could help | 19:56 |
vorathiel21 | c ya | 19:56 |
cmaloney | ttyl | 19:56 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!