Page suivante Page précédente Table des matières

15. Appendix B - Dealing with Limited Resources or Tuning the System

15.1 Related HOWTOs

  1. LBX-HOWTO
  2. Small-Memory-HOWTO

15.2 Introduction

As mentioned in the introduction laptops sometimes have less resources if you compare them to desktops. To deal with limited space, memory, CPU speed and battery power, I have written this chapter.

15.3 Small Space

Introduction

There are different types of techniques to gain more disk space, such as sharing of space, freeing unused or redundant space, filesystem tuning and compression. Note: some of these techniques use memory instead of space. As you will see, there are many small steps necessary to free some space.

Techniques

  1. Stripping: Though many distributions come with stripped binaries today it is useful to check this. For details see man strip. To find every unstripped file you can use the file command or more convenient the tool findstrip. Attention: don't strip libraries, sometimes the wrong symbols are removed due to a bad programming technique.
  2. Perforation: zum(1)reads a file list on stdin and attempts to perforate these files. Perforation means, that series of null bytes are replaced by lseek, thus giving the file system a chance of not allocating real disk space for those bytes. Example: find . -type f | xargs zum
  3. Remove Odd Files and Duplicates: Check your system for core files, emacs recovery files <#FILE#> vi recovery files <FILE>.swp, RPM recovery files <FILE>.rpmorig and patch recovery files. Find duplicates, you may try finddup. Choose a system to name your backup, temporary and test files, e.g. with a signature at the end.
  4. Clean Temporary Files: , e.g. /tmp, there is even a tool tmpwatch.
  5. Shorten the Log Files: usually the files in /var/log.
  6. Remove Files: Remove files which are not "necessary" under all circumstances such as man pages, documentation /usr/doc and sources e.g. /usr/src .
  7. Filesystem: Choose a filesystem which treats disk space economically e.g. rsfs. Tune your filesystem e.g. tune2fs. Choose an appropriate partition and block size.
  8. Reduce Kernel Size: Either by using only the necessary kernel features and/or making a compressed kernel image bzImage.
  9. Compression: I didn't check this but AFAIK you may compress your filesystem with gzip and decompress it on the fly. Alternatively you may choose to compress only certain files. You can even execute compressed files with zexec
  10. Compressed Filesystems:

    - For e2fs filesystems there is a compression version available e2compr.

    - DMSDOS which enables your machine to access Windows95 compressed drives (drivespace, doublestacker). If you don't need DOS/Windows95 compatibility, i.e. if you want to compress Linux-only data, this is really discouraged by the author of the program.

  11. Partition Sharing: You may share swap-space (see Swap-Space-HOWTO) or data partitions between different OS (see mount). For mounting MS-DOS Windows95 compressed drives (doublespace, drivespace) you may use dmsdos http://metalab.unc.edu/pub/Linux/system/filesystems/dosfs/.
  12. Libraries: Take another (older) library, for instance libc5 , this library seems to be smaller than libc6 aka glibc2 .
  13. Kernel: If your needs are fitted with an older kernel version, you can save some space.
  14. GUI: Avoid as much Graphical User Interface (GUI) as possible.
  15. Tiny Distributions: There are some distributions available which fit from one 3.5" floppy to 10MB disk space and fit for small memories, too. See appendix A and below.
  16. External Storage Devices (Hard Disks, ZIP Drives, NFS, SAMBA): Since many notebooks may be limited in their expandability, using the parallel port is an attractive option. There are external harddisks and ZIP Drives available. Usually they are also connectable via PCMCIA. Another way is using the resources of another machine through NFS or SAMBA etc.

15.4 Harddisk Speed

Use the tool hdparm to set up better harddisk performance. Though I have seen laptop disk enabled with striping, I can't see a reason to do so, because IMHO aka RAID0 striping needs at least to different disks to increase performance.

15.5 Small Memory

Related HOWTOs

  1. Small-Memory-mini-HOWTO by Todd Burgess <tburgess@uoguelph.ca > http://eddie.cis.uoguelph.ca/~tburgess
  2. Modules-mini-HOWTO
  3. Kerneld-mini-HOWTO

Techniques

Check the memory usage with free and top.

Mergemem Project . Many programs contain memory areas of the same content that remain undetected by the operating system. Typically, these areas contain data that have been generated on startup and remain unchanged for longer periods. With mergemem such areas are detected and shared. The sharing is performed on the operating system level and is invisible to the user level programs. mergemem is particularily useful if you run many instances of interpreters and emulators (like Java or Prolog) that keep their code in private data areas. But also other programs can take advantage albeit to a lesser degree.

You may also reduce the kernel size as much as possible by removing any feature which is not necessary for your needs and by modularizing the kernel as much as possible.

Also you may shutdown every service or daemon which is not needed, e.g. lpd, mountd, nfsd and close some virtual consoles. Please see Small-Memory-mini-HOWTO for details.

And of coarse use swap space, when possible.

If possible you use the resources of another machine, for instance with X, VNC or even telnet. For more information on Virtual Network Computing (VNC), see http://http://www.uk.research.att.com/vnc/ .

15.6 Low CPU Speed

You may want to overdrive the CPU speed but this can damage your hardware and I don't have experience with it. For some examples look at Adorable Toshiba Libretto - Overclocking http://www.cerfnet.com/~adorable/libretto.html.

15.7 Power Saving Techniques

  1. If you don't need infrared support, disable it in the BIOS or shutdown the IrDA device driver. There are also some IrDA features of the kernel which are useful for saving power.
  2. PCMCIA services consume much power, so shut them down if you don't need them.
  3. I'm not sure to which extend the backlight consumes power. WARNING: AFAIK this device can only bear a limited number of uptime circles. So avoid using screensavers AFAIK this device can only bear a limited number of uptime circles. So avoid using screensavers too much.
  4. For some examples to build batteries with increased uptime up to 8 hours look at Adorable Toshiba Libretto http://www.cerfnet.com/~adorable/libretto.html.
  5. For information about APM look at the APM chapter above.
  6. A hacked rclock . Booker C. Bense has hacked the rclock program to include a simple battery power meter on the clock face.
  7. xbatstat. A battery level status checker for Linux and X.
  8. hdparm hdparm is a Linux IDE disk utility that lets you set spin-down timeouts and other disk parameters. It works also for some SCSI features.
  9. Mobile Update Daemon This is a drop-in replacement for the standard update daemon, mobile-update minimizes disk spin ups and reduces disk uptime. It flushes buffers only when other disk activity is present. To ensure a consistent file system call sync manually. Otherwise files may be lost on power failure. mobile-update does not use APM. So it works also on older systems.
  10. Toshiba Linux Utilities This is a set of Linux utilities for controlling the fan, supervisor passwords, and hot key functions of Toshiba Pentium notebooks. There is a KDE package Klibreta, too.
  11. At Kenneth E. Harker's page there is a recommendation for LCDproc LCDProc . "LCDproc is a small piece of software that will enable your Linux box to display live system information on a 20x4 line backlit LCD display. This program shows, among other things, battery status on notebooks." I tried this package and found that it connects only to the external Matrix-Orbital 20x4 LCD display http://www.matrix-orbital.com/, which is a LCD display connected to a serial port. I can't see any use for a laptop yet.
  12. Diald: Dial Daemon . The Diald daemon provides on demand Internet connectivity using the SLIP or PPP protocols. Diald can automatically dial in to a remote host when needed or bring down dial-up connections that are inactive.
  13. KDE http://www.kde.org provides KAPM, Kbatmon and Kcmlaptop. Written by Paul Campbell kcmlaptop is a set of KDE control panels that implements laptop computer support functions, it includes a dockable battery status monitor for laptops - in short a little icon in the KDE status bar that shows how much battery time you have left. It also will warn you when power is getting low and allows you to configure power saving options. Similar packages you may find at the GNOME project http://www.gnome.org/ . See the software maps at both sites.
  14. Please see Battery Powered Linux Mini-HOWTO by Hanno Mueller, hanno@lava.de http://www.lava.de/~hanno/ for more information.

15.8 Kernel

Related HOWTOs

Many kernel features are related to laptops. For instance APM, IrDA, PCMCIA and some options for certain laptops, e.g. IBM ThinkPads. In some distributions they not configured. And the kernel is usually bigger than necessary. So it's seems a good idea to customize the kernel. Though this task might seem difficult for the beginner it is highly recommended. Since this involves dangerous operations you need to be careful. But, if you can install a better kernel successfully, you've earned your intermediate Linux sysadmin merit badge. - Since this topic is already covered in other documents I want handle this here.

15.9 Tiny Applications and Distributions

A small collection yet, but I'm looking for more information.

  1. BOA - HTTP server.
  2. Pygmy - HTTP server.
  3. MGR - a graphical windows system, which uses much less resources than X.
  4. LBX - Low Bandwidth X.
  5. blackbox - X11 window manager 204K.
  6. linux-lite - distribution based on a 1.x.x kernel for systems with only 2MB memory and 10MB harddisk. URL see above.
  7. smallLinux - http://smalllinux.netpedia.net/ . Three disk micro-distribution of Linux and utilities. Based on kernel 1.2.11. Root disk is ext2 format and has fdisk and mkfs.ext2 so that a harddisk install can be done. Useful to boot up on old machines with less than 4MB of RAM.
  8. cLIeNUX - client-use-oriented Linux distribution.
  9. minix - not a Linux but a UNIX useful for very small systems, such as 286 CPU and 640K RAM http://www.cs.vu.nl/~ast/minix.html . There is even X support named mini-x by David I. Bell ftp://ftp.linux.org.uk/pub/linux/alan/ .
  10. screen - tiny but powerful console manager.
  11. ash - tiny shell.
  12. tinyirc - a small IRC client.


Page suivante Page précédente Table des matières