# HOWTO extend the life of Gentoo laptop

gentoo

cough, I may not qualify this discussion considering my bad record (1, 2), and I just replace the hard disk for the consequent I/O failure today. Anyway, the readers may learn some lesson from my good/bad practice and avoid the same pitfall.

Gentoo enjoys the reputation for its source-based distribution and highly-customizable package management, portage. However, we pay the price for the flexibility: synchronizing the portage, building applications from source code

## Choose the right file system

I am a big fan of JFS regarding its comparable performance with low CPU consumption. Unfortunately, JFS does not support bad block relocation. This is essential since we may still use the hard disk with some dysfunctional sectors, though not suggested. So I decide to take reiserfs as the default FS with LVM.

Pro: I could tell the difference of booting time.

Con: when emerging the package, especially boost, the whole system just lost the responsiveness due to the high I/O traffic.

It is really a tough decision. I may go back to JFS if this hard disk is dead, touch wood.

## Using tmpfs

Check this tip in Gentoo Wiki. The temerge works as a charm. It builds the application in memory instead of hard disk, the emerge time is shortened dramatically and the hard disk access is decreased.

## Share the portage over network

Another I/O extensive operation is emerge --sync. According to this HOWTO, a shared portage not only save the hard disk access, but network bandwidth of the sync servers as well. The file server used in my home network, hippo servers the multimedia files using Samba for one Dell 700m laptop, tiger, and one Dell Dimension E521 desktop gorilla. Follow this HOWTO to get Samba works, and we may adapt the changes mentioned in this HOWTO to the system:

Add the emerge --sync task to the cron job, /etc/cron.daily/emerge.cron:

#!/bin/sh
emerge --sync > /dev/null 2>&1

Export the portage to the public: /etc/samba/smb.conf:

[portage]
comment = public portage
path = /usr/portage
public = no
writable = yes
browseable = yes
valid users = share admin

Auto mount the portage in tiger: /etc/fstab

//hippo/portage /usr/portage cifs user=share,password=foo,iocharset=utf8

If the laptop is roaming, local /usr/portage would be used. The distfiles and packages are left in the local disk just in case we may need them without network: /etc/make.conf

FEATURES="sandbox ccache -distlocks autoaddcvs confcache"
PORTDIR=/usr/portage
DISTDIR=/usr/local/portage/distfiles
PKGDIR=/usr/local/portage/packages
PORTDIR\_OVERLAY="/usr/local/portage/myportage"
source /usr/local/portage/layman/make.conf

For eix users: /etc/eixrc:

PORTDIR_CACHE_METHOD='none'

and put the update-eix into cron.daily.

For layman users: /etc/layman/layman.cfg:

storage : /usr/local/portage/layman

TO BE CONTINUED…