User:0xdc/Drafts/Portage Sync RCU
This is only applicable for rsync repositories
Historically, portage updated the portage tree in-place. This meant the files user /usr/portage (as it was then) were directly modified by rsync and used in its difference calculations. This is fast but if the synchronisation failed for any reason, the portage tree may be left in a non-working state.
With the advent of the GPG-signed portage tree, there is an additional check that increases the chances of a failed sync.
More recently, portage has decided to take a copy of the existing repository and quarantine the new updates. If the update passes verification, they are copied into the working location.
Read, Copy, Update
Portage has an alternative storage method called RCU (read, copy, update). Here, the working portage tree is resolved via a symlink; future and past trees can sit next to the working tree, and the portage tree is updated by changing the symlink atomically.
This can be desirable in I/O constrained environments or when the portage tree is shared with a number of consumers. However, care must be taken when using the portage tree when using bind-mounts or in chroot/systemd-nspawn.
To enable RCU behaviour, add the following to your repos.conf entry for any rsync repository:
sync-rcu = yes sync-rcu-store-dir = /var/lib/portage/rcu
sync-rcu-store-dir appropriately. It must not be the same as the
location directory and must be a directory solely used for the purposes of RCU.
Once set up. sync your rsync tree. This will migrate any existing checkout and set up the RCU symlink.
emaint sync -r gentoo
Once complete, symlink the original
location to the latest symlink in the
ln -s /var/lib/portage/rcu/latest /var/db/repos/gentoo