User:Sam/Portage help/Migrating to new repository data locations

From Gentoo Wiki
Jump to:navigation Jump to:search


This page gives a set of instructions for how to migrate from the old repository/data locations to the new locations used in e.g. stage3s going forward.

See bug #662982 for background and motivation.

Old/new locations

Gentoo paths
Purpose Old path New path
Storing the tree / ebuilds /usr/portage /var/db/repos/gentoo
Distfiles (downloaded source code/files) /usr/portage/distfiles /var/cache/distfiles
Binary packages /usr/portage/packages /var/cache/binpkgs


Originally written by kurly from #gentoo.

If you use a separate partition for /usr/portage, you may want to consider how this affects your disk usage and may need /etc/fstab changes.
  1. Remove (or comment out) any PORTDIR, DISTDIR, PKGDIR entries in /etc/portage/make.conf
  2. Note the output of eselect profile show for later
  3. If /var/db/repos/ does not exist, create it:
root #ls -1 /var/db/repos
1 drwxr-xr-x 5 root root 4096 Jun 10 19:10 /var/db/repos
  1. Move /usr/portage/distfiles to /var/cache/distfiles
  2. Move /usr/portage/packages to /var/cache/binpkgs
  3. Move /usr/portage to /var/db/repos/gentoo
  4. Edit the 'location' variable in /etc/portage/repos.conf/gentoo.conf (or equivalent) to /var/db/repos/gentoo
  5. Use eselect profile set ____ with the profile noted earlier
  6. Reinstall portage: DISTDIR=/var/cache/distfiles PKGDIR=/var/cache/binpkgs emerge --oneshot portage

Additional steps:

  1. If you run a local rsync mirror, edit the path entry in /etc/rsyncd.conf to point to /var/db/repos/gentoo
  2. If you share your distfiles, remember to update whatever symlink or config file you need for that



root #mkdir /var/db/repos
root #mv /usr/portage/distfiles /var/cache
root #mv /usr/portage/packages /var/cache/binpkgs
root #mv /usr/portage /var/db/repos/gentoo
root #sed -i -e 's:/usr/portage/packages:/var/cache/binpkgs:' /etc/portage/*
root #sed -i -e 's:/usr/portage/distfiles:/var/cache/distfiles:' /etc/portage/*
root #sed -i -e 's:/usr/portage:/var/db/repos/gentoo:' /etc/portage/*
root #DISTDIR=/var/cache/distfiles PKGDIR=/var/cache/binpkgs emerge --oneshot portage