If you are using a laptop on battery power or are using a Compact Flash (CF) card as your disk then you want to minimise the number of writes to the device. A lot of Linux operating system disk writes will be to per-session files in the various directories under /var such as /var/log /var/run /var/spool ...
If you don't care about keeping log files between reboots then you can use the tmpfs filesystem type to treat a portion of your RAM as a filesystem (provided by /dev/shm) that grows dynamically as it is used.
Here is how to mount your temporary file and log file locations on a tmpfs filesystem.
This is the /etc/fstab from my Artigo A2000 running Debian Squeeze on a 4GB Compact Flash ext2 root filesystem
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/sda1 / ext2 noatime,errors=remount-ro 0 1
tmpfs /tmp tmpfs defaults,noatime 0 0
tmpfs /var/log tmpfs defaults,noatime 0 0
tmpfs /var/tmp tmpfs defaults,noatime 0 0
tmpfs /var/run tmpfs defaults,noatime 0 0
tmpfs /var/spool tmpfs defaults,noatime 0 0
tmpfs /var/lock tmpfs defaults,noatime 0 0
tmpfs /var/cache tmpfs defaults,noatime 0 0
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/sda1 / ext2 noatime,errors=remount-ro 0 1
tmpfs /tmp tmpfs defaults,noatime 0 0
tmpfs /var/log tmpfs defaults,noatime 0 0
tmpfs /var/tmp tmpfs defaults,noatime 0 0
tmpfs /var/run tmpfs defaults,noatime 0 0
tmpfs /var/spool tmpfs defaults,noatime 0 0
tmpfs /var/lock tmpfs defaults,noatime 0 0
tmpfs /var/cache tmpfs defaults,noatime 0 0
Using the noatime option prevents the operating system from writing the last access time to disk. This saves a lot of writes and is recommended if you don't care about last access time on a file.
After you have edited /etc/fstab reboot your machine, log in, and use the mount command to check that your /tmp and /var subdirs are mounted on tmpfs:
/dev/sda1 on / type ext2 (rw,noatime,errors=remount-ro)
... other stuff
tmpfs on /dev/shm type tmpfs (rw,mode=0755)
tmpfs on /var/log type tmpfs (rw,noatime)
tmpfs on /var/tmp type tmpfs (rw,noatime)
tmpfs on /var/run type tmpfs (rw,noatime)
tmpfs on /var/lock type tmpfs (rw,noatime)
tmpfs on /var/cache type tmpfs (rw,noatime)
tmpfs on /var/spool type tmpfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,noatime)
... other stuff
tmpfs on /dev/shm type tmpfs (rw,mode=0755)
tmpfs on /var/log type tmpfs (rw,noatime)
tmpfs on /var/tmp type tmpfs (rw,noatime)
tmpfs on /var/run type tmpfs (rw,noatime)
tmpfs on /var/lock type tmpfs (rw,noatime)
tmpfs on /var/cache type tmpfs (rw,noatime)
tmpfs on /var/spool type tmpfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,noatime)
Updated: /var/cache is a good choice for tmpfs as all of your temporary apt downloads go here.
A good website I found about increasing CF lifespan is
One more tip I found from http://www.debian-administration.org/articles/179 is to link /etc/mtab to /proc/mounts:
rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab
ln -s /proc/mounts /etc/mtab
According to the article /etc/mtab is written often so this will save your flash drive.
Also, prevent drive scan results writing to CF:
rm -f /etc/blkid.tab*
ln -s /dev/null /etc/blkid.tab
ln -s /dev/null /etc/blkid.tab
Also, fix debconf missing from /var/cache (appears unable to create itself):
chmod u+x /etc/rc.local
#add following line into /etc/rc.local before the line "exit 0"
mkdir /var/cache/debconf
#add following line into /etc/rc.local before the line "exit 0"
mkdir /var/cache/debconf