Search:  
Gentoo Wiki

TIP_Relocating_the_default_portage_directory

This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other

Contents

Introduction

The problem that this article addresses is the necessity of moving your default portage directory, /usr/portage in this instance, to a different location.

Why would you do this? Well, if you are new to Linux, or new to Gentoo, you may have underestimated the amount of space that you would need for a full Gentoo installation. Alternatively, you may wish to move your portage directory to a removable disk, such as a USB token, for replication between different offline machines.

Whatever the reason, this article will tell you how to do it!

Process

The process for relocating the default portage directory is quite straightforward.

  1. Determine where you would like to move the directory.
    • This directs us to two cases.
      1. Create a partition just for portage.
      2. Set up a directory in an already existing directory structure.
  2. Move the portage directory to the new location.
  3. Add an appropriate entry in /etc/fstab to mount the new location on boot.

Determining The New Location

To determine the new location, we must find a place on our system that has enough space to contain the entire portage tree that we would like to store.

As mentioned, this allows two possibilities; creating a separate partition and using an existing directory structure.

If a new partition is created, we will assume it to be located at /dev/hda2 and if it exists in the current directory structure, we will assume it to be located at /var/portage.

Moving Portage

This is a straightforward process and would be completed with a simple 'mv /usr/portage <target>' wherer the target is either a directory under the mounted /dev/hda2, i.e. /mnt/portage, or is /var/portage as per the description above.

Updating /etc/fstab

If a new partition was created, then add the following entry to /etc/fstab:


/dev/hda2 /usr/portage <filesystem,probably ext2 or ext3> defaults 0 0

Otherwise, if you are moving /usr/portage to a new directory, say /var/portage, you would add the following to /etc/fstab:


/var/portage /usr/portage <The filesystem of /var> auto,rw,'''bind''' 0 0

End Note

I apologize for the terseness of this entry, I'll update it when I get time.


Last modified: Wed, 26 Dec 2007 15:32:00 +0000 Hits: 7,688