User:0xdc/Drafts/Portage Sync RCU

Portage can change the storage method is uses to hold a portage repository/overlay.

Why
Historically, portage updated the portage tree in-place. This meant the files user (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.

Enable RCU
To enable RCU behaviour, add the following to your repos.conf entry for any rsync repository:

Adjust the  appropriately. It must not be the same as the  directory and must be a directory solely used for the purposes of RCU.

Sync
Once set up. sync your rsync tree. This will migrate any existing checkout and set up the RCU symlink.

Symlink
Once complete, symlink the original  to the  symlink in the  ; e.g.