Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
TMPFS N00b
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Holysword
l33t
l33t


Joined: 19 Nov 2006
Posts: 946
Location: Greece

PostPosted: Mon Mar 02, 2015 7:07 am    Post subject: TMPFS N00b Reply with quote

So, I'm installing Gentoo in my old laptop (again) and this time I'm wondering if I should have a tmpfs enabled there or not...
Its old but it has 8GB memory. I've read the basics about the tmpfs but I still don't understand some things. Say I'm doing an emerge -auND world and I have 4GB of memory in the tmpfs. Let's assume that no package alone takes 4G, but that the sum of all the small packages does take 4GB or more. Does TMPFS "purge itself" once its full? I've heard it has some tricks with swap, should I activate 4GB in the tmps and, let's say, 20GB in the swap, can I compile even OO using this scheme or not?

Also, a very different question: I'd be interested in having a disk partition that stores data only temporarily and gets reset at startup. The data doesn't need to be shredded or obfuscated in any sense, just the OS should treat that partition as being empty every time I boot it. Is there any filesystem or trick to do that or would I have to create a init script to do so? If resorting to an initscript, which FS would you suggest (if I remember correctly reiser4 can be formatted super quickly, but maybe ext4 also has its tricks).
_________________
"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7134
Location: almost Mile High in the USA

PostPosted: Mon Mar 02, 2015 6:18 pm    Post subject: Reply with quote

portage, if the emerge succeeds, will clear out what it used for that merge in PORTAGE_TMPDIR regardless if it's put on tmpfs or real disk space.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43223
Location: 56N 3W

PostPosted: Mon Mar 02, 2015 6:51 pm    Post subject: Reply with quote

Holysword,

/tmp is cleared every boot by the startup scripts.

You need not have PORTAGE_TMPDIR in tmpfs to benefit from building in RAM. All it will do is save hard drive writes that are never read.
It works this way. If you have suffcient RAM to have PORTAGE_TMPDIR in tmpfs, the kernel will keep the files around in disk buffers anyway, so when the data is needed again, its read from the cache, not the drive. You will have redundant disk writes, which cost very little as they are accomplished using DMA.
They will use memory bandwidth. If you have as SSD, you wight want to avoid the extra writes.

You can set per package build environments, so the biggies buid normally and everything else builds in tmpfs.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7134
Location: almost Mile High in the USA

PostPosted: Mon Mar 02, 2015 7:40 pm    Post subject: Reply with quote

I've found that tmpfs is faster because of the initial unpacking of especially the large packages... That decompress phase is significantly sped up in tmpfs because eventually the dirty buffer writeback will force the machine to write all that data out, which takes time with all the seeks (lots of small files). Barriers will force the writebacks too.

I was initially thinking that the cache system would make disk usage as fast as tmpfs, but this small detail does make a difference. At least to people who don't need to debug failed compiles and have to worry the data has to stick around if the machine crashes.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
SDNick484
Apprentice
Apprentice


Joined: 05 Dec 2005
Posts: 212

PostPosted: Thu Mar 05, 2015 8:55 pm    Post subject: Reply with quote

On my previous laptop which is probably around the same generation as the one you're referring to (i.e. T400 Core2Duo w/ 8GB RAM and SSD), I used tmpfs for both /var/tmp/portage and /tmp. The primary reason was indeed to avoid wear & tear (i.e. extra writes) like NeddySeagoon suggests, and like eccerr0r mentions, it had the added benefit of faster decompressing (very noticeable with packages like gentoo-sources, etc.).

I used the following and it worked for all but the largest builds (i.e. openoffice, chromium, webkit-gtk, etc.):
swap 8GB (so I had ~16G of potential tmpfs space, but really you don't want to hit disk)
/tmp set to 512M
/var/tmp/portage set to 6G

If I was doing something that I knew needed addition space (i.e. streaming an HD flash video being written to /tmp), I would increase it on the fly via: mount -o remount,size=1536m tmpfs /tmp
Back to top
View user's profile Send private message
Holysword
l33t
l33t


Joined: 19 Nov 2006
Posts: 946
Location: Greece

PostPosted: Fri Mar 06, 2015 10:45 pm    Post subject: Reply with quote

Thank you everybody for the suggestions, I will surely try some combinations and then I'll let you know what I find out.

Meanwhile I'm trying several combinations of new things (systemd+wayland, hardened profile, KDE5, maybe I'll even go back to zen-sources)... oh boy, Gentoo IS FUN!
_________________
"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum