Archive for October, 2008


The Power of LISP

October 8, 2008

LISP is sometimes said to be the most powerful language because of its extensibility. However, untrammeled power is not an advantage in a HLL. HLL’s do a number of things, some of which are restrictions (type systems, discouragment of goto). LISP cannot claim to be the highest level language without balancing power –making it easy to write good code — against restriction –making it difficult to write bad code.



October 8, 2008

1A. re-installing LILO from a booted (eg from a boot floppy) linux. LILO keeps its config file in /etc/lilo.conf Simply run lilo -b /dev/hd?? where /dev/hd is the local partition. Unlike GRUB, LILO needs to be re-installed every time something is changed.

1B. re-installing GRUB from a booted (eg from a boot floppy) linux. GRUB keeps its config file in /etc/menu.lst or /boot/grub/menu.lst Simply run grub-install -/dev/hd?? where /dev/hd is the local partition. Unlike LILO, GRUB does not need to be re-installed every time something is changed.

1C. re-installing LILO from an un-booted linux. LILO keeps its config file in /etc/lilo.conf Boot another linux with LILO (including a live CD) Mount the partition (this is where it is handy to have everything on one partition).


cd to the root of the mounted partition.

chroot $PWD. Then run lilo -b /dev/hd?? where /dev/hd is the local partition. Unlike GRUB, LILO needs to be re-installed every time something is changed.

1D. re-installing GRUB from a un-booted linux. GRUB keeps its config file in /etc/menu.lst or /boot/grub/menu.lst Boot another linux with GRUB (including a live CD) Mount the partition (this is where it is handy to have everything on one partition).


cd to the root of the mounted partition.

chroot $PWD.

Then run grub-install -/dev/hd?? where /dev/hd is the local partition.

Unlike LILO, GRUB does not need to be re-installed every time something is changed.

2. Moving a linux partition. Use cfdisk (preferably for a live CD) to create a target partition if necessary. If you have done so, reboot. Use dd to copy , eg dd if=/dev/hda6 of=/dev/hda11. Mount the target partition under some third linux (or a live CD). Go into it and


amend the fstab so that root is the new partition.

amend any partitions that may have been re-numbered. If your swap and data partitions have low numbers, as I have recommended, this won’t be necessary.

amend the lilo.conf or menu.lst, and re-install GRUB or LILO as above.

amend the master boot loader. This is very easy with SmartBoot, just hit ctrl-I and it will recognise the new partition. If you have split your linux across multiple partitions, as I don’t recommend, this will be more difficult.

3. Resizing. Partitions can be resized, up to a point, with parted. However, it is rather shaky, and you often need to fsck the partition afterwards to make it bootable (parted). fdisk , sfdisk and cfdisk cannot resize. Parted can, but unreliably. There are also special-purpose resizers ext2resize, reiserfsresize.

The size of an extended partition is determined by its contents, they can be shrunk by deleting logical partitions off the end.



October 8, 2008

1. To run multiple OS’s you need a boot loader capable of offering a choice of which OS

to load from a menu, eg LILO or GRUB. (Smart boot is not compatible with some versions of Mandriva, Centos, and other RH derivatives. see to add SBM to grub. Overwriting smart boot with another boot loader (eg GRUB) does not work! SBM leaves traces behind, which Rh objects to. The boot block must be zeroed out)

2. XP grabs the whole disk for partition C by default. If you already have XP installed, you have no

choice but to resize C; downwards. But resizers need to be used with caution.

3. Linuxes by default recognise other OS’s and install a multi-boot capable boot loader as part

of their installation process. It is customary to install XP first in a multi-boot layout, because it overwrites the existing boot loader with one that only loads linux, making the other OS’s temporarily unavailable. However, it is not too difficult to re-install a multi-boot loader.

4. If possible, partition the disk before loading any OS’s.

5. Partitioning from withing a running OS (chiefly linux) is possible but dangerous. The box should be rebooted immediately after partitioning, so that the partion table can be re-read.

6. It is preferable to partition using a Rescue of Live CD of linux. Live CD’s are better than traditional rescue CD’s , in that they include facilities like full manual pages, and a desktop calculator, handy for converting between bytes, blocks and cylinders!

7. The main linux facilities for partitioning are fdisk, sfdisk, cfdisk and partd. I prefer cfdisk for most purposes and parted for anything it doesn’t cover. Both of these are found on the Ubuntu live CD.

8. Many linuxes have installers which offer to partition the disk with fancy graphical interfaces. I have found these to be quite dubious and best avoided. Create ready-made partitions and tell the installer where to put / (root). (I prefer to install a linux all into one partition).

9. Installers will automatically detect swap partitions. Swap partitions can be created during the initial partitioning process with mkswap — it only takes a few seconds.

10. Partitioners will label a partition with a byte. This is *not* the same thing as formatting a partition, which requires mkfs. The partition type is just a label. Linux partitions have a generic label which covers various formats — ext2, ext3 and reiser. The actual formatting can be left till the install process. I usually let the installer use whichever format it defaults to. ext2 is probably the most standard. NTFS and FAT partitions should be formatted by Windows or its installer disk, although linux commands like cfisk can label them as Windows partitions, thus giving Windows a hint.

11. During the install process, linux gives you a choice between installing a boot loader to the partition ,or for the whole disk (to the MBR). If you install XP followed by a bunch of linuxes, installing boot loaders to the MBR you might up with a boot loader capable of booting all your OS’s. However, it is safer to install each boot loader searately to a partition, and a master boot loader to the MBR. (This is more likely to work, since the master boot loader only has “chain” to the local one, which is bound to be able to load its “own” linux). I use the SmartBoot loader as a master loader, which can be reconfigurd from within itself, and can recognises newly added OS’s. It cannot load linux directly, only chain, so there must be a boot loader in each partition.

A warning about GRUB: grub reads it’s configuration file “live” from a file on the linux file system (unlike LILO, which copies the information in the file into the boot record). That means that if you are using GRUB as your master loader, and that particular linux (typically the last one installed) gets corrupted — you won’t be able to boot anything! Hence my preference for an independent master boot loader.

12. During the install process, a Linux will ususally give you the opportunity of creating a boot floppy. This should definily be done, as these are extremely useful if things go wrong.



October 8, 2008

1. A disk can be divided into four primary partitions or three primary partitions and an extended partition. The extended

partition acts as a container for 16 or so “logical partitions”. Primary/extended partitions are hda1-hda4. Logical partitions are hda5–> (even if not all primary partitions are used). Note that the extended partitions does not have to be last, leading to out-of-order numbering, eg hda1(Prim). hda2(Prim). hda3(Ext)={hda5(Log) hda6(Log)}, hda4(Prim)

2. DOS and pre-XP versions of windows must go on first physical partition.

3. XP can go on logical partitions.

3. XP can use either the NTFS or the FAT file system. NTFS is better on the whole

4. A partition containing shared data in FAT format is a good idea. (Most linuxes have trouble with NTFS). Shared data can reside directly on the XP partition if it is FAT.

5. Some people suggest that windows logical partitions should be placed last (high-numbered) due to a tendency to “wander off”. Alternatively windows logical partitions should not be mixed with linux ones

6. Linuxes are traditionally installed into multiple partitions /boot / /home /usr, etc. This will almost certainly require logical partitions. All linuxes are perfectly happy with logical partitions.

7. Linuxes do not have to be split across multiple partitions — they can be reduced to a single / (root) partition and a swap partition. (having multiple partitions for multiple unixes quickly becomes confusing). The motivation for a traditional multi-partition layout is partly security and stability. If one partition fills up, for instance, other are usuable. This approach should be seriously considered for servers, but is not really necessary for desktop systems. If you have multiple linuxes, or even just a live CD, you can repair a 100% full file system on one linux using another. Putting everything onto one partition is also space-efficient.

8. All swap partitions are exactly the same, and the same swap partition can be used by multiple unixes. Therefore the minimum number of partitions that can be used to install N unixes is N+1. Therefore 16 logical partitions can be used to install 15 linuxes. Therefore a total of 18 OS’s can be installed on a disk, assuming a limit of 16 on logical partitions (not sure about this limit, but I run out of space at this point anyway!). (Swap partitions on disk are used by live disks too!)

9. It is a good idea to give swap partions a low number (eg hda5) so that other linuxes can be re-arranged without changing the “swap” lines in fstab.

10. FreeBSD goes on a primary partition and divides it up by its own technique (like having a second swap partition). It must come *after* the extended partition.

“This can give you the wrong device assignment and cause the loss of data. My advice is to always put your FreeBSD slice after any Linux extended partitions, and do not change any logical partitions in your Linux extended partitions after installing FreeBSD!”

11. FreeBSD cannot read logical parttiions, therefore shared data should be on a primary partition if BSD is to be used.

12. For maximum flexibility, and disk space allowing, pad out the scheme with unused logical partitions. These can be used to allow the used partitions to stretch and shrink without renumbering. The number of a logical partition is not fixed at creation. If you delete hda6, the old hda7 becomes the new hda6. Renumbering can be compensated for (see section III) but it best avoided. Partitions can be shrunk to something very tiny as an alternative to deleting them (and thus forcing re-numbering).