You are not logged in.

#1 2011-03-18 18:54:24

dylix
New member
From: Atlanta
Registered: 2011-03-17
Posts: 5

Mounting portage in ram...

I found this on gentoo forums a few years back, thought I'd share in case some of you don't know about it or forgot about it.. With all the ram most systems have these days, and how little of it linux uses, I see no reason why not..

Basically all this does is mount /var/tmp/portage into RAM.. saves on hd wear and speeds up things quite a bit..

/etc/fstab
none          /var/tmp/portage tmpfs          nr_inodes=1M,size=2048M 0 0

I have 8gb of ram, so i give 2gb of it to this. I've found this to be plenty big enough to compile chromium, which is probably the most compiling intensive app I have installed.. Even on my old system where I only had 2gb of ram i gave it 1gb and never had a problem with most compiling, except for chromium.. I'm sure openoffice would also be an exception..

Anyways, do you guys have anything mounted into ram?

Last edited by dylix (2011-03-19 15:01:24)

Offline

#2 2011-03-18 19:06:31

whiteghost
Member
From: north dakota
Registered: 2010-10-10
Posts: 155

Re: Mounting portage in ram...

same as you,
plus /tmp
i have ripped dvds in tmpfs folders.
sometimes put fold@home in tmpfs
very useful

Offline

#3 2011-03-18 22:22:34

jeanfrancis
Staff
From: Québec (Canada)
Registered: 2010-10-07
Posts: 267

Re: Mounting portage in ram...

Thanks for sharing this. I knew that was an option, but maybe not for my 2G RAM laptop. But now that I have 6G, I'll consider this! I'm doing some little tests to view the impact in building time.

Offline

#4 2011-03-19 17:30:41

ulenrich
Member
Registered: 2010-10-07
Posts: 220

Re: Mounting portage in ram...

Don't using ccache as it is not as fast as a fast cpu compiling - it is possible to compile even chromium below 800 Mib. Libreoffice nearly needs 9 Gibyte which is when I unmount /var/tmp/portage.

Offline

#5 2011-03-20 00:24:00

jeanfrancis
Staff
From: Québec (Canada)
Registered: 2010-10-07
Posts: 267

Re: Mounting portage in ram...

How much time do you guys save approximatively when using tmpfs instead of you hard drive? For chromium, I only saved about 1 minute out of 22.

Offline

#6 2011-03-20 02:48:54

whiteghost
Member
From: north dakota
Registered: 2010-10-10
Posts: 155

Re: Mounting portage in ram...

jeanfrancis wrote:

How much time do you guys save approximatively when using tmpfs instead of you hard drive? For chromium, I only saved about 1 minute out of 22.

i have not checked. does save writes to disk though.

and since it takes long enough to rip a dvd i did not compare that either. but it sure seemed a lot faster.

using dvdrip i have set options to copy dvd to disk and write avi to tmpfs.

last time , having gone from 4 gb of ram to 8 gb i set dvdrip to copy dvd to tmpfs then rip avi to disk.

jeanfrancis, are you using an ssd hard drive? that would lessen the impact of using tmpfs.

i have an ssd and want to limit writes to it. one thing that has really speeded up with ssd
is updating files with emerge --sync.

Last edited by whiteghost (2011-03-20 02:51:29)

Offline

#7 2011-03-20 02:57:28

jeanfrancis
Staff
From: Québec (Canada)
Registered: 2010-10-07
Posts: 267

Re: Mounting portage in ram...

I don't have an ssd. Maybe chromium build is not a good example and I may have better overall performance. I'll check with other packages soon and post results here.

Offline

#8 2012-03-21 23:51:45

defer
Member
From: Finland
Registered: 2011-01-07
Posts: 11

Re: Mounting portage in ram...

From /etc/fstab. I havent messed with it for a while. I like having logs in tmpfs, since my system hasnt freezed for ages. I couldnt get /var/run to work on tmpfs when i tried. I guess i should remove these "mode=0777" options for security. My system has 3GB of DDR3 + 512MB swapfile.

# ramdisks
tmpfs           /var/tmp        tmpfs   nr_inodes=1M,size=2048M,mode=0777,noatime       0 0
tmpfs           /tmp            tmpfs   size=512M,mode=0777,noatime,nodev,nosuid        0 0
tmpfs           /var/log        tmpfs   size=8M,noatime,nosuid,noexec                   0 0
# tmpfs         /var/run        tmpfs   mode=0755,size=16M,noatime,nosuid               0 0

Offline

#9 2012-03-22 14:28:15

Juippisi
Member
From: /home
Registered: 2012-03-01
Posts: 51

Re: Mounting portage in ram...

jeanfrancis wrote:

Thanks for sharing this. I knew that was an option, but maybe not for my 2G RAM laptop.

I use tmpfs as my portage build dir even with 1 GB RAM that my laptop has.

The impact in compiling speed isn't huge, if there even is any. But I'm pretty sure this takes away the pain from your HDD and makes it last longer.


ulenrich wrote:

Libreoffice nearly needs 9 Gibyte which is when I unmount /var/tmp/portage.

There is no need to manually unmount portage build, dir, just set the environment specifically for packages you want to build outside the normal build dir. Example can be found from here,
http://en.gentoo-wiki.com/wiki/Portage_ … fs_.2F_HDD

Basically,

starmine portage # p
/etc/portage

starmine portage # cat package.env 
app-office/libreoffice notmpfs.conf
app-office/openoffice notmpfs.conf
www-client/firefox notmpfs.conf

starmine portage # cat env/notmpfs.conf 
PORTAGE_TMPDIR="/var/tmp/notmpfs"
none                    /var/tmp/portage        tmpfs   size=3G           0 0
none                    /tmp                            tmpfs   size=512M       0 0

Offline

#10 2012-03-23 03:54:49

d2_racing
Staff
From: Québec (Canada)
Registered: 2010-10-05
Posts: 425

Re: Mounting portage in ram...

If I understand right, you don't use your tmpfs for libreoffice,openoffice and firefox.

For the rest, you use your tmpfs that has a 3G size.

Nice trick tongue

Offline

#11 2012-03-23 04:31:01

imaginasys
Member
Registered: 2010-10-07
Posts: 97

Re: Mounting portage in ram...

Thanks!  It works like a charm!

I had deleted my 3GB tmpfs since libreoffice demanded 6GB... And I kept forgetting to unmount it before compiling libreoffice.
Now I'm back at using that sleeping memory (I have 6GB and want to use all of it).

Regards,

            BT

On a HP Pavilion AMD A6-3400M APU with Radeon(tm) HD 6520 Graphic/6GB DDR3 RAM
running Linux zeus 3.3.0-rc7-funtoo-kvm #3 SMP PREEMPT Tue Mar 20 23:57:46 EDT 2012 x86_64 AMD A6-3400M APU with Radeon(tm) HD Graphics AuthenticAMD GNU/Linux

Offline

#12 2012-03-23 11:50:56

imaginasys
Member
Registered: 2010-10-07
Posts: 97

Re: Mounting portage in ram...

defer wrote:

From /etc/fstab. I havent messed with it for a while. I like having logs in tmpfs, since my system hasnt freezed for ages. I couldnt get /var/run to work on tmpfs when i tried. I guess i should remove these "mode=0777" options for security. My system has 3GB of DDR3 + 512MB swapfile.

# ramdisks
tmpfs           /var/tmp        tmpfs   nr_inodes=1M,size=2048M,mode=0777,noatime       0 0
tmpfs           /tmp            tmpfs   size=512M,mode=0777,noatime,nodev,nosuid        0 0
tmpfs           /var/log        tmpfs   size=8M,noatime,nosuid,noexec                   0 0
# tmpfs         /var/run        tmpfs   mode=0755,size=16M,noatime,nosuid               0 0

Watch out, you must use the mount point /var/tmp/portage instead of /var/tmp for you tmpfs because /var/tmp/notmpfs will be in your /var/tmp and will be in memory...

Regards,

             Bernard :-)

Offline

#13 2012-03-29 02:51:14

rh1
_Member
From: Eastern Shore, VA
Registered: 2010-10-08
Posts: 388

Re: Mounting portage in ram...

i should remove these "mode=0777" options for security

Mode should be 1777 for /tmp and /var/tmp.

Offline

#14 2012-03-29 09:11:25

strowi
Member
From: Germany, Bonn
Registered: 2010-10-08
Posts: 70

Re: Mounting portage in ram...

Hi,

i have been using this script since a couple of years to dynamically mount /var/tmp/portage only when i run emerge. That way the ram is only used when compiling stuff..

http://git.hasnoname.de/linux/scripts/tree/sbin/tmerge

Offline

#15 2012-03-30 19:08:35

Juippisi
Member
From: /home
Registered: 2012-03-01
Posts: 51

Re: Mounting portage in ram...

strowi wrote:

That way the ram is only used when compiling stuff..

As it is with tmpfs too smile

Offline

#16 2013-07-29 11:09:50

defer
Member
From: Finland
Registered: 2011-01-07
Posts: 11

Re: Mounting portage in ram...

My current setup:

none		/var/tmp	tmpfs	size=2048M,noatime	0 0
none		/tmp		tmpfs	size=128M,noatime	0 0
none		/var/log	tmpfs	size=8M,noatime,noexec,nosuid 0 0

I have SSD and im trying to minimize wearing. Im considering configuring chromium to build in some other directory since its too large for tmpfs.

Offline

Board footer

Powered by FluxBB