Fitting a big hard disk drive to Linux

A personal Experience.
By Martin Houston.

The 400MB IDE drive that I though was 'more space than I would ever need' when I invested in it a couple of years ago was creaking at the seams!

Although one of the design features of a release like the Slackware 2.0 that I use is the ability to keep most of the Linux file system on CD doing so gives a considerable performance penalty. Also running off CD means that it unless a system is taken down so that only the bare minimum of processes are running it is not possible to unmount the CD so that another may be substituted in its place. The reason for this is Linux does not let a filesystem be dismounted if there are any programs loaded from it active in memory. All in all nice how running from CD is if you are just dipping your toe into the Linux ocean sooner or later you are going to want the luxury of the software that you use loading from the hard disk every day.

I have for several months now been tracking the price of big hard disks and an 850MB EIDE drive from Allgem for only 175 finally persuaded me to take the plunge. I also had to buy an EIDE local bus multi IO card for a further 39. This is the beauty of a generic, expandable PC system. In reasonably small and pain less increments you can update your machine's specification to make many mini-computers envious!

The first thing that I did was get the latest 1.2 Linux kernel patches off the net. EIDE is quite a recent addition to Linux so you will need to be running a modern kernel. I established that the 1.2 kernel ran reliably with my existing system.

Changing disk controllers is a bit of a fraught time. Just in case I managed to trash my existing hard disk I then backed everything that could not be restored from the slackware CD on to tape.

To do this I picked a file just slightly younger than my Linux installation date and then used this as a -newer test to find:

	find / -newer some_file -print >/tmp/allfiles.
Then edit /tmp/allfiles to remove anything that you really don't want to back up - object and core files for example. Beware also about leaving directory names in the list - a directory will mean that everything under it will be backed up. This can save time. For instance I knew that I wanted everything in my home directory.

When the list has been trimmed to your liking then use it to generate a compressed tar archive of the things you really want to keep with:

	tar cvzf /dos/all.tgz `cat /tmp/alfiles` 
As the archive resided on my DOS partition it was then an easy job to back it up to my Colorado Jumbo tape drive that I have drivers for DOS but do not 100% trust the Linux support for yet - (for one thing I can only get it to work for the 1.0.9 kernel).

As it turned out the precaution of backing up all my data was not needed but Sod's Law says if you attempt anything risky without a backup then that is the time that disaster will strike!

I opened up my trusty computer and removed the existing disk controller. I then leaving my original hard disk safely disconnected for now tried to set up the new EIDE hard disk as the primary single drive. The instructions with the EIDE card warned that older system BIOSes would not be able to cope with EIDE and would not see the drive at its full size. My computer being a couple of years old was one of these. This meant that I could not boot from the 850 MB drive - it would have to be relegated to the second IDE channel. This was no real problem I reinstated my original 400MB drive as the primary device and put the new disk on the secondary channel. It is important to make a distinction between the extra IDE channel that EIDE gives you and the master/slave pairing of drives to get two drives on one channel. The two IDE channels are independent - the second channel uses hardware interrupt 15 (although with Linux it can be made to share the same interrupt as the original disk controller for a small performance penalty. The documentation that came with my EIDE card made no such recommendation so unless you really MUST have INT15 for something else the normal installation is wisest. Both drives should be left as if they were the only drive on the system - i.e no fiddling with the master/slave jumpers on the drive is needed. The BIOS and DOS is unaware of the second IDE interface so a special device driver supplied with the EIDE card is needed to find the disk and allow DOS to access it.

I used the supplied utilities to make a 200MB partition for DOS use on the big disk. The utilities supplied with the EIDE card correctly identified the Western Digital Caviar 850MB drive and stated that it was capable of Mode 1 IDE transfers - old style IDE being mode 0. Under DOS copying from one drive to the other seemed very fast - but it should do - the two drives are sitting on independent IO channels! According to DOS benchmarks the second EIDE drive turned out to be slightly slower than my existing drive (PC Tools System Information). Original disk PC Tools disk index 45.7, new disk 34.3. The new EIDE disk had much faster track to track access time but was let down badly by BIOS seek time and transfer rate. Presumably this was due to the need for a special device driver. When I next revamp my machine I will put all the DOS space I need on the original disk and save the 850MB drive exclusively for Linux. With no drivers in place DOS won't be able to trash my important Linux data.

I then booted up my Linux 1.2 kernel. The boot diagnostics said that the new hard disk had been seen but I needed to run MAKEDEV.ide1 script that can be found in the drivers/block directory of your kernel source tree. This creates the /dev/hdc* and /dev/hdd* device files to access the two possible drives on the secondary IDE interface. As there was only 1 hard disk on this interface it was accessed with the /dev/hdc name. Using

	fdisk /dev/hdc
showed that the disk already had a 200MB DOS partition that I had put on with the EIDE tools. I then added a Linux swap and Linux file system partition to the disk. The reason for the two partitions? As I now had the luxury of some disk space on a different controller it made sense to use some of it as virtual memory. Linux can be configured to use multiple swap partitions. I modified /etc/fstab to make the swap partition on the faster EIDE drive appear first.
/dev/hdc2        swap        swap        defaults
/dev/hda3        swap        swap        defaults
The original swap partition on the root disk I am retaining for the moment but would be easy to remove and re-allocate for some other purpose.

The data partition of the new drive was destined to become the /usr file system - my rationale being that this is where most of the 'software bloat' that fills up a linux hard disk comes from. I made the file system and then mounted it on /mnt. Before depending completely on the new disk I ran a few rudimentary benchmarks on it and found, sadly, that it was only about 20% faster than my original IDE drive (also a Western Digital Caviar). Upon investigation of the EIDE driver in the kernel I found that it had been compiled with a very conservative set of timing options. If you are feeling adventurous then you can experiment making kernels with various EIDE 'go faster' options but this is getting rather into the realms of hacking. I tried a few options but ended up with several non functioning kernels and no huge speed boost. I suppose if you have the time to do it and co-operation from the manufacturer of the EIDE card you are using then it may be possible to tune the driver to get considerably better performance

However most Linux users will be happy with the modest speed improvement and huge capacity improvement that EIDE can bring to an existing system. The biggest thing to beware of is that unless your machines BIOS is EIDE aware you will only be able to augment with a big drive rather than replace an existing smaller boot disk. Yes, before anyone writes to tell me I know that you can do tricks like telling DOS one drive geometry and telling linux a different true story. However it gets messy with the BIOS only able to reach so far into the disk for booting purposes. It means that all your DOS area and all your root file system must be within the BIOS addressability limit or you will run the risk one day of making a linux kernel that has blocks which cannot be accessed by the bootstrap!

Don't be afraid of EIDE. It's no real drama or big deal and it gives the luxury of acres of disk space for very little cash. I more than trebbled the disk storage space of my system for around 200 pounds.

Next on the Linux box's Christmas list is hopefully tripling the CPU power by replacing the current 486sx with a DX4 Overdrive. You will have to wait for the next issue of "Linux@UK" for that.