Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Howto: portage in /var
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
wdreinhart
Guru
Guru


Joined: 11 Jun 2003
Posts: 569
Location: 4QFJ12345678

PostPosted: Tue Oct 19, 2004 7:26 pm    Post subject: Howto: portage in /var Reply with quote

This is a quick rundown on how to put portage into /var. I did this because it makes more sense to me to have ebuilds, distfiles and packages seperated from each other and stored in /var instead of /usr. It also seems to comply with the Linux filesystem heirarchy standard better.

Disclaimer: Mess with portage at your own risk! I take no responsibility for broken systems, lost portage overlays, hate mail from angry developers, etc

Step Zero: Prerequisites
If you have less than 1GB free space on /var, don't try this. If /var is not on the root partition, I wouldn't recommend trying to put portage there, even if you have sufficient free space.

Step One: Move Portage
First, you'll need a directory for the new portage tree to be moved to.
Code:
#mkdir /var/portage
#mkdir /var/portage/tmp
#mv /usr/portage /var/portage/tree

Then, you can split distfiles and packages from the portage tree proper.
Code:
#cd /var/portage
# mv tree/distfiles ./distfiles
#mv tree/packages ./packages

If you have a portage overlay, move it into /var/portage as well.
Code:
# mv /usr/local/overlays/foo ./overlay_foo


Step Two: update /etc files
Since portage is in a non-standard place, you will need to set some variables in /etc/make.conf
Code:
PORTDIR=/var/portage/tree
DISTDIR=/var/portage/distfiles
PKGDIR=/var/portage/packages
PORTAGE_TMPDIR=/var/portage/tmp
PORTDIR_OVERLAY="/var/portage/overlay_foo"
You'll also need to fix /etc/make.profile. It should be a symlink to /var/portage/tree/profiles/default-linux/(ARCH)/(VERSION)/
In my case, I needed to do this:
Code:
ln -s /var/portage/tree/profiles/default-linux/x86/2004.2/ /etc/make.profile

Step Three: Testing and cleanup
Code:
# emerge sync
#emerge -upv world
#emerge SOMEPACKAGE

If you can rsync, check world dependancies, and merge some trivial package, congratualtions. You have successfully moved portage! Now it's time to clean up some leftover tempfiles.
Code:
#rm -r /var/tmp/portage

If you have an overlay, you can remove it's old home as well.
Code:
#rm -r /usr/local/overlay

That's it!
Back to top
View user's profile Send private message
LifesizeKenDoll
n00b
n00b


Joined: 17 Jun 2004
Posts: 27

PostPosted: Wed Oct 20, 2004 5:40 pm    Post subject: Reply with quote

Good guide, I am very appreciative.
I believe Gentoo should push for standardization as much as it possibly can.
Go Filesystem Hierarchy Standard.
Back to top
View user's profile Send private message
Chaosite
Guru
Guru


Joined: 13 Dec 2003
Posts: 540
Location: Right over here.

PostPosted: Thu Oct 21, 2004 5:29 pm    Post subject: Re: Howto: portage in /var Reply with quote

wdreinhart wrote:
Step Zero: Prerequisites
If you have less than 1GB free space on /var, don't try this. If /var is not on the root partition, I wouldn't recommend trying to put portage there, even if you have sufficient free space.


... Why is this? Why must /var be on the root fs?

I have a special partition just for /usr/portage, and it works fine. I might even move it to /var (It won't make a lot of difference, but just to get things where they are supposed to be...), which will be even easier since all I have to do is create a new mount point and change /etc/fstab...

EDIT: And the profile symlink bit, of course...
Back to top
View user's profile Send private message
wdreinhart
Guru
Guru


Joined: 11 Jun 2003
Posts: 569
Location: 4QFJ12345678

PostPosted: Thu Oct 21, 2004 9:05 pm    Post subject: Re: Howto: portage in /var Reply with quote

Chaosite wrote:

... Why is this? Why must /var be on the root fs?

I have a special partition just for /usr/portage, and it works fine. I might even move it to /var (It won't make a lot of difference, but just to get things where they are supposed to be...), which will be even easier since all I have to do is create a new mount point and change /etc/fstab...

EDIT: And the profile symlink bit, of course...


The 1GB recommendation is because distfiles tend to take up a *lot* of space. If you already have a portage partition, you don't need to worry about that. It's not really necessary to have portage on the root partition, but if it's not, and you break mount or /etc/fstab (or something like that) you won't be able to use portage to fix the problem.
Back to top
View user's profile Send private message
agrippa_cash
Tux's lil' helper
Tux's lil' helper


Joined: 08 May 2003
Posts: 143
Location: Los Angeles

PostPosted: Sat Oct 23, 2004 8:15 pm    Post subject: Reply with quote

I'm intrigued by this suggestion, and it does make more sense and could make for better disk usage since
Code:
/var contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files.
. I think the frequent writing has the potential to fragment files etc. so they want it on another partition. With an fstab error you just have to bootdisk into it and edit fstab. I'd never considered 'mount' getting corrupted so that may be a good point (though I'm not sure how the disks mount on startup anyway). I actually do have var on a separate partition so I'll leave well enough along until the devs say 'Yeah we screwed up when we put portage in /usr'. Any devs care to comment?
_________________
Athlon xp 1700+;VIA-KT266;512mb RAM;Radeon 9600
-running with udev, hal, dbus, pmount & modular-xorg
Back to top
View user's profile Send private message
spamspam
Apprentice
Apprentice


Joined: 05 Dec 2003
Posts: 153

PostPosted: Sun Oct 24, 2004 7:17 pm    Post subject: Portage won't fix broken mount Reply with quote

wdreinhart wrote:

It's not really necessary to have portage on the root partition, but if it's not, and you break mount or /etc/fstab (or something like that) you won't be able to use portage to fix the problem.


If you break mount, it won't be able to re-mount root RW, so any changes won't be writeable, so portage won't be able to fix mount. Your best bet in this situation would probably be to boot from an install CD, mount your filesystems, chroot to your usual root, and hack away.

If mount is broken, more is likely to be broken anyways, so you'd better hope you have /home (and /var/lib/postgresql, etc) on a seperate drive or recently backed up.

Overall though, this tutorial is exactly what I was searching for. I recently replaced my /home drive with one that's bigger & faster than my root drive and was looking for how to move portage there.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum