HOWTO extend the life of Gentoo laptop
Gentoo August 5th, 2007
*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. Both of the two tasks are I/O extensive, and the latter is also computation-extensive. The following tips aim to offload the burden to the desktop workhorses and eliminate the unnecessary I/O operation as much as possible.
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: /etc/cron.daily/emerge.cron
emerge –sync > /dev/null 2>&1
Export the portage to the public: /etc/samba/smb.conf
comment = public portage
path = /usr/portage
public = no
writable = yes
browseable = yes
valid users = share admin
Auto mount the portage in tiger: /etc/fstab
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
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
and put the update-eix into cron.daily
For layman users: /etc/layman/layman.cfg
Offload the build to desktop workhorse
TO BE CONTINUED…







..somebody needs to be writing for the GWN!
On my older desktops I use XFS file system. The performance is comparable to reiserfs and I find it to be much more reliable. And the live defrag is cool also.
Yes, XFS is also a great file system. But here are some complaints about the corrupt file system with power outage and it is suggested to have UPS standby for the system.
XFS doesn’t become corrupt after a power outage. Un-sync’ed files may be truncated or filled with null bytes, but that’s understandable and better than the silent corruption I’ve seen when using reiserfs.
I hadn’t seen the temerge tip before — why would you use that?? It breaks multiple emerges running in parallel, and it’s not that hard to just have /var/tmp/portage permanantly tmpfs-mounted.
Have you tried the hash tea in reiserfs?
Thank your very much. I wasn’t aware of using a tempfs, good tip. I’m not sure how much compiling I’ll be doing away from a power source though ;). Have you thought to add these ideas to the Power Management Wiki?
http://gentoo-wiki.com/HOWTO_Power_Management
ephemient:
It would cost more than 600M capacity to emerge some huge packages like kdelibs. If /var/tmp/portage is permanently mounted, we could not capitalize the memory.
Menelkir:
Thanks for your comment. I would take a look how to fine tune the performance of reiserfs, and keep this updated.
Dirk.R.Gently:
Most of the tips are inspired/shameless copied from the Gentoo Wiki, if you think it valuable, do whatever you want, honored if you could mention the source.
My machine has permanent 2GB tmpfs mounts on /tmp and /var/tmp, and that’s never caused any problems with emerges (though big things like monolithic X would push a lot of stuff to swap).
I still don’t like how temerge breaks if it’s run in parallel with itself or emerge. It should probably create a tmpfs somewhere else, refcounted, and set PORTAGE_TMPDIR.
[...] *cough*, I may not qualify this discussion considering my bad [...]
Cool site, love the info.