Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Using Portage TMPDIR on tmpfs
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
JonathanVQP
n00b
n00b


Joined: 30 Nov 2020
Posts: 58

PostPosted: Sun Dec 06, 2020 9:12 pm    Post subject: Using Portage TMPDIR on tmpfs Reply with quote

I am running Gentoo in Vmware using 16 Gigs of ram. I am trying to increase the emerge process by using ram to emerge. I am using tmpfs. I have read in previous forums that people have put /var/usr/portage in RAM instead of HDD which speeds up the process considerably. However, tmpfs is using volatile memory so when does tmpfs write to disk? When I tried to emerge Gnome on tmpfs, I received the "no space left on device" so I increased the tmpfs space. I am worried that if I place all of /var/usr/portage in Ram using tmpfs, it won't write to disk and loose everything if my vm crashes or power is shut off. I have looked at zram and zswap but what would be the better choice for my situation?
Back to top
View user's profile Send private message
SlashBeast
Retired Dev
Retired Dev


Joined: 23 May 2006
Posts: 2922

PostPosted: Sun Dec 06, 2020 9:30 pm    Post subject: Reply with quote

Using tmpfs for portage tmpdir have a drawback of using ram, also, tmpfs can be swapped out.

Keep in mind that some packages will require at minimum 2 GB of ram per one parallel make job, Chromium for example will need more than 2 GB per parallel job, so if you have 16 GB of ram, and build chromium with make -j8, unless you have swap, you will run into OOM Killer.

There's usually hardly a reason to use tmpfs for portage tmpdir unless you have plenty of ram, and even then, it's good idea to exclude some packages, like chromium, from using it, via /etc/portage/package.env.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sun Dec 06, 2020 9:39 pm    Post subject: Reply with quote

JonathanVQP,

tmpfs does not write to disk.
the content of tmpfs can be moved to swap but thats slow and should be avoided.

tmpfs is implemented using all the same code as any other filesystem, except the disk bit is missing.
From that, it follows that putting /var/tmp/portage into tmpfs actually saves very little time because if you have the RAM to make it work, the kernel virtual memory system is doing it for you anyway.
You save the time for the writes that will never be read. That's only fraction of a second, ever on a big package.

Nothing will be lost, at least no more than normal, if you lose the content of /var/tmp/portage.
Its only used for temporary build time products that will be discarded when the build completes anyway.
The last step in any build is to merge the completed build to the root filesystem.
The root filesystem is not on tmpfs, so the things you want to keep are committed at the end of every package.
_________________
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
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5118
Location: Bavaria

PostPosted: Sun Dec 06, 2020 10:27 pm    Post subject: Reply with quote

JonathanVQP,

it also depends what you are doing additionally to your emerge. Browsing the internet costs much RAM. I have an Intel I7 with 16 GB RAM and a SSD and using KDE (plasma).

I have in my fstab:
Code:
tmpfs           /var/tmp/portage        tmpfs   rw,nodev,nosuid,size=12G,uid=portage,gid=portage,mode=775,noatime       0 0

and in my make.conf:
Code:
MAKEOPTS="-j8
[...]
USE="$USE jumbo-build"

This is the highest I can go. When emerging QTWebEngine (a monster), I see in my (kde) system monitor a peek use of 15,2 GB WITHOUT swapping - WHEN doing nothing else ...
If you have a system monitor with gnome also, watch it some times.

I recommend using the tmpfs, even with a SSD - if you have problems i would suggest to use a lower MAKEOPTS (especially if you compile over night and you are not waiting for the finish of the emerge). For big emerges - when running in the night - I use MAKEOPTS=4 ... just to be sure ... ;-)
Back to top
View user's profile Send private message
JonathanVQP
n00b
n00b


Joined: 30 Nov 2020
Posts: 58

PostPosted: Sun Dec 06, 2020 11:24 pm    Post subject: Reply with quote

pietinger: I fully aware how long it takes to emerge QTWebengine since it took 18hours for me. Since you use tmpfs, does it write to disk when it gets full? That is my main concern. Since I have 32 gigs of RAM, RAM is not really a concern. My main concern is making the emerge process faster and if I can use RAM to make it faster and then have it write to disk when it done. When I got the "device is full" error, it appears that it does not write to disk when full.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sun Dec 06, 2020 11:48 pm    Post subject: Reply with quote

JonathanVQP,

tmpfs can be swapped but if that happens tmpfs should not be used for that package.
Set the build location for PORTAGE_TMPDIR on a per package basis.

Individual builds cannot be continued by emerge once they have been stopped for any reason.
The interrupted package will start from the beginning again.
_________________
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
AlexJGreen
Tux's lil' helper
Tux's lil' helper


Joined: 19 Sep 2018
Posts: 149

PostPosted: Sun Dec 06, 2020 11:49 pm    Post subject: Reply with quote

_

Last edited by AlexJGreen on Mon Dec 28, 2020 3:26 am; edited 2 times in total
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5118
Location: Bavaria

PostPosted: Sun Dec 06, 2020 11:57 pm    Post subject: Reply with quote

JonathanVQP wrote:
pietinger: I fully aware how long it takes to emerge QTWebengine since it took 18hours for me.[...]

What ?? Which CPU do you have ? For QTWebEngine AND 32 GB you MUST use "jumbo-build" ... ;-)

JonathanVQP wrote:
Since you use tmpfs, does it write to disk when it gets full?

No. (Happened only one time with libreoffice)

JonathanVQP wrote:
My main concern is making the emerge process faster [...]

1. I recommend to use only makeopts="-jx" and not setting makeopts="-j. -l."
2. Dont use an old recommendation to set -j= Nr.of cores + 1. Best is -j= Nr. of cores
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22673

PostPosted: Sun Dec 06, 2020 11:58 pm    Post subject: Reply with quote

JonathanVQP wrote:
Since you use tmpfs, does it write to disk when it gets full?
According to the kernel documentation:
Code:
tmpfs puts everything into the kernel internal caches and grows and
shrinks to accommodate the files it contains and is able to swap
unneeded pages out to swap space. It has maximum size limits which can
be adjusted on the fly via 'mount -o remount ...'
So yes, it can write to your swap area if needed.
JonathanVQP wrote:
My main concern is making the emerge process faster and if I can use RAM to make it faster and then have it write to disk when it done.
emerge will always write the finished product to disk, if the build finishes. This applies without regard to how you store the intermediate results.
JonathanVQP wrote:
When I got the "device is full" error, it appears that it does not write to disk when full.
A tmpfs can become full, just as a persistent filesystem can. "No space left on device" with a tmpfs means that the tmpfs is now storing the maximum amount of data it was configured to allow. It cannot store more without exceeding the limits set by the administrator, so it returns ENOSPC. Depending on available RAM and the administrator's choice of limits, the tmpfs may have spilled some contents to swap before this point, or not. Additionally, there may be substantial free RAM remaining in the system when this happens, if the tmpfs limit was set low enough.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5118
Location: Bavaria

PostPosted: Mon Dec 07, 2020 12:03 am    Post subject: Reply with quote

Hu wrote:
[...], if the tmpfs limit was set low enough.

Yes, Hu, it was "size=10G" before and I had to set it to "size=12G"
@JonathanVQP: Dont worry - tmpfs will NOT allocate this if NOT needed (its only a maximum setting).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo 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