1

I have a tiny computer with not so much RAM (1-2GiB) and very little disk space in which I installed Gentoo. I also have space on a shared NFS.

In order to be able to compile any package, even the biggest ones, I created a swap file on the NFS, just in case (it is almost never used) and a directory used as the temporary compilation directory. It was working well, but I found that unpacking the packages (tar x) on the NFS temporary directory was taking ages, even for quite small packages.

So, I decided to increase the swap file to quite a huge size (20GiB) and created a tmpfs of 16GiB to use as temporary compilation directory (/var/tmp/portage/dist):

mount -t nfs nfs-server:/var/tmp/dist/$(hostname)/misc /var/tmp/misc
fallocate -l 20g /var/tmp/misc/swapfile
chmod 600 /var/tmp/misc/swapfile
mkswap /var/tmp/misc/swapfile
swapon /var/tmp/misc/swapfile
mount -t tmpfs -o size=16g tmpfs /var/tmp/portage/dist
chmod 1777 /var/tmp/portage/dist

For small packages, everything is done locally in RAM and is therefore very quick.

For medium size packages, it is fully filling the RAM and using a part of the swap file. Performance decreases, of course, but not that much.

But for biggest packages, the RAM is completely used, the usage of the swap file is increasing, and at a given moment, the system seems to freeze (I can't say that it freezes for sure, because my only access is through SSH, and I loose this connection, the system does not respond to any network request anymore, even a ping). I think that compilation is then stopping, because I also have another NFS mount for a ccache directory which is not touched anymore by the tiny computer.

My questions are:

  • What do you think is causing that freezing?
  • Are there parameters I should set to prevent it (like noatime, for my tmpfs)?
  • Did I choose the right solution or is there any other better way to achieve this?
3
  • I thought you cannot or shouldn't do it. Even if nowadays you can, this comment may still be true: "The slightest blip in the network could cause system-critical processes to crash if parts of them get paged out." Jun 16, 2020 at 8:39
  • As I said, the swap is almost never used, except when compiling big packages, so I think I can take the risk. But of course, if there is a better solution, I'd be glad to use it… Jun 16, 2020 at 9:05
  • 1
    Even a locally connected USB stick is likely to be better than nfs I'd have thought.
    – Mokubai
    Jun 16, 2020 at 9:17

0

You must log in to answer this question.

Browse other questions tagged .