On Tuesday, 5 December 2017 10:46:43 GMT Wols Lists wrote:
> On 05/12/17 10:09, Peter Humphrey wrote:
> >> I assume using a ramdisk would help with this? I wouldn't want to do a
> >> 
> >> > SSD as I assume it would excessively wear by doing compiles.
> > 
> > I use tmpfs, like this:
> > 
> > $ grep tmpfs /etc/fstab
> > tmpfs   /var/tmp/portage  tmpfs  
> > noatime,uid=portage,gid=portage,mode=0775  0 0 tmpfs   /tmp            
> >          tmpfs   noatime,nosuid,nodev,noexec,mode=1777   0 0
> > 
> > If a tmpfs fills up, the excess gets swapped out, but with 32GB RAM here
> > I haven't yet seen any swap used at all - not even in an emerge -e
> > world.
> Same here. Note that tmpfs defaults to half ram, so that would give you
> a 16GB /var/tmp/portage.

That's the starting size, yes. The kernel will expand it or shrink it with 
changes in the demands on the system.

> With 16GB ram here, that would probably cause things like emerging
> libreoffice or firefox or gcc to abort.

Not unless you run out of swap space - remember that tmpfs gets swapped like 
anything else in memory. Or unless one compile job requires a single 
temporary file bigger than your tmpfs file system, which hardly seems 
likely.

> My fstab has these lines ... note the SIZE option ...

Yes, I know about the size option. I haven't needed to use it on this box.

> # glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
> # POSIX shared memory (shm_open, shm_unlink).
> # (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
> #  use almost no memory if not populated with files)
> shm                     /dev/shm        tmpfs
> nodev,nosuid,noexec     0 0

You shouldn't need that shm entry any more.

> portage                 /var/tmp/portage        tmpfs
> size=30G,mode=0777      0 0
> tmp                     /tmp            tmpfs
> size=10G,mode=0777      0 0
> 
> My swap partitions are twice max ram, so I currently have two 32GB
> partitions giving me 80GB total ram and swap.

So you shouldn't find big compiler jobs aborting on out-of-memory.

> (My new system when I get it working maxes out at 64GB ram so I'll have
> 256GB swap and (currently) 16GB ram)

I've halved my original 4GB swap to 2GB since it never seems to be used. I'm 
not brave enough to do away with it altogether though.

-- 
Regards,
Peter.


Reply via email to