Return to the archive index

Dual Boot Microdrive and Laptop Drive

From: Doug Sutherland <>
Date: Sun, 11 Mar 2001 21:35:27 -0800

Wearfolks,

I have been using the 1GB microdrive for several months and I and I am very 
impressed with it. I did some experiments with small linux distributions, 
and the results are good. If you can live without x-windows and development 
tools on the microdrive, it's possible to create a 100 MB distribution 
using slackware, leaving 900 MB for applications and data. I  just tried 
doing a minimal x-windows configuration, and it uses only 280 MB total. 
This is a full x-windows setup but doesn't include KDE or Gnome (they are 
huge and slow!), just the basic libraries, binaries, and fonts etc for X. 
It includes full support for networking, and has emacs, lynx, netscape, 
ghostscript, gv, xv, and xpdf installed. It also has audio and mp3 tools 
including recorders, converters, rippers, encoders and players. Following 
are some detailed notes on my experience with the 1GB IBM microdrive.

Physical Drive Interfacing

There are three different ways to attach the microdrive to my single board 
computer, which is an Advantech PCM-5822. I have tried several experiments
and settled on the CompactFlash socket for permanent installation. I have
figured out how to dual boot either the microdrive or laptop drive 
(details are below), so the microdrive will be the primary drive and will 
always be installed, while the laptop drive is removable.

A) CompactFlash Socket - The PCM-5822 has a CompactFlash socket, but it's 
   a type I socket that is not deep (high) enough to fit the microdrive. 
   The good news is that its just a mounting problem, not electrical. The 
   microdrive can be easily made to fit by cutting the top rails off the 
   socket. It then slides in and works fine. When the drive is in this 
   socket it appears as a secondary IDE master drive, which linux assigns 
   to device /dev/hdc. Since its on the IDE bus its a bootable drive.

B) PCMCIA Adapter - The microdrive kit I bought came with a 68-pin adapter 
   for PCMCIA slot. The drive works fine in a PCMCIA slot on a PC/104 card 
   plugged into the PCM-5822, but afaik it can't be booted from there since 
   PCMCIA is not avaiable at boot time. This is likely to change soon since 
   PCMCIA support is moving into the linux kernel. On my system I don't 
   want to have the PCMCIA PC/104 card installed most of the time anyways 
   so its a non-issue for me. But the PCMCIA adapter is very useful for 
   initial install of linux packages. If you buy a microdrive I suggest 
   that you get the PCMCIA adapter for it, it will come in handy. When the 
   drive is inserted into the PCMCIA slot the linux system automatically 
   recognizes it as an IDE drive and assigns it to /dev/hdc. The nice thing 
   is that you can boot with a laptop drive, insert the microdrive into the
   PCMCIA slot for partitioning and formatting, then load linux packages
   onto the microdrive.

C) IDE Adapter - There are several CompactFlash-to-IDE adapters available. 
   Most of them are for 40-pin IDE which is not the right size for my CPU 
   board, but I expect that it would not be hard to retrofit a 44-pin header 
   to these adapters. Ampro has the proper adapter that fits the microdrive 
   and has the 44-pin IDE header. When attached this way, the microdrive 
   appears on the primary IDE channel. The adapter has a jumper to configure 
   it as either primary or slave drive. Linux will assign it to device 
   /dev/hda (primary) or /dev/hdb (slave) depending on jumper settings. I 
   have the Ampro adapter, but I have not succeeded with booting from it. 
   The install works fine but the boot process fails on partition check
   with a kernel panic. I suspect that this can be corrected by tweaking 
   the lilo settings, but mine works in the CompactFlash have no need for 
   a CompactFlsh-to-IDE adapter.

CPU BIOS Settings

On my system, the microdrive can be autodetected by the BIOS at boot time, 
and can also be manually configured in the BIOS. The BIOS on the PCM-5822 
has an 'auto detected hard drive' feature that probes the IDE bus and sets 
up the BIOS with the drive type, mode, and geometry. All of these methods 
work fine with the microdrive, but I discovered that linux can probe the 
BIOS for IDE drives even if the BIOS has not been pre-configured for the 
hard drives. From what I have read this is preferrable for linux. It's 
recommended that the BIOS be set to "auto" for all of the hard drive 
settings and left that way. There is no need to configure the BIOS for the 
proper geometry (cylinders, heads, and tracks) or type and mode, the linux 
kernel will be able to probe the BIOS for this info at boot time.

Linux Installation Process

I have tried Redhat and Slackware on the microdrive. Both work well but 
Redhat is a fatter and more complex distribution. It's becoming harder 
all the time to make small installs with Redhat. Therefore I recommend 
Slackware for the microdrive. Here are a few tips on how to install both 
on the microdrive.

A) Partitioning and Formatting - The microdrive is shipped with DOS/Windos 
   FAT partiton table and file system. The easiest way to remove this 
   virus (er file system) is to boot from a laptop drive with linux 
   installed, then insert the microdrive into the PCMCIA slot using the 
   PCMCIA adapter. Linux will recognize it as an IDE drive automatically. 
   On my system it appears as /dev/hdc on the secondary IDE channel. To 
   partition the drive just run fdisk /dev/hdc. Delete the old partition 
   and create new ones. When you run fdisk, check to see what is listed 
   for cylinder, heads, and sectors (it appears at the top of the fdisk 
   menu). For the 1GB microdrive it should be 64 heads, 63 sectors, 522 
   cylinders. If these values are wrong you'll need to go into the 
   advanced fdisk menu and set them manually. If your drive gets messed 
   up and has an old boot loader in the MBR (master boot record), you 
   can fix this by making a bootable DOS floppy disk loaded with the DOS
   program FDISK.EXE on it. Boot from the floppy and A:\FDISK.EXE /MBR
   to clear out the master boot record. On my system I chose to use a 
   48 MB swap partition and use the remainder as the root partition. 
   After partitioning, you can create the ext2 file system by mounting 
   the microdrive and formatting like this:

       mkdir /mnt/microdrive
       mount /dev/hdc2 /mnt/microdrive
       mke2fs /dev/hdc2

Installing Linux Packages

If you are loading Redhat you can probably just insert the microdrive in 
the CompactFlash socket and do a network install. Slackware doesn't have 
this feature so you need to load the packages onto the drive prior to 
installation.

A) Redhat install - Create a network boot floppy using the rawrite utility 
   (on widows) or DD utility (on linux). You need the boot.net image. 
   Detailed instructions are on the Redhat web site. Boot from the floppy 
   and you can install redhat via ftp, http, or nfs. If you have a LAN you 
   can copy the contents of the Redhat CD-ROM into an ftp or http directory
   and use the ftp or http install method or mount it as an NFS drive. 

B) Slackware install - For slackware you need to load the packages you want 
   onto the microdrive prior to running the install program. If you copy 
   the entire contents of the slakware directory (this is a subdirectory 
   with only the install packages) from a CD-ROM or the FTP site onto the 
   microdrive, that's all you need. The entire slakware directory is only 
   200 MB or so and easily fits on the microdrive. After installation you
   can delete this from the microdrive. What I do is load the slakware 
   directory onto a laptop hard drive, then mount the microdrive in the 
   PCMCIA slot using the command mount /dev/hdc2 /mnt/microdrive and copy 
   the files over. You'll need two floppy disks for the slackware install, 
   they are created the same way as for Redhat using the rawrite or DD 
   utilities. For the boot disk use the bare.i image, and for the root
   disk use the color.gz image. Move the microdrive into the CompactFlash 
   socket, boot from floppy and run the setup program.  

LILO Configuration

When you do the linux installation, be sure to create the emergency boot 
disk or LILO boot disk on Slackware. This way if LILO fails on first 
reboot you don't have to start over, you can tweak the LILO configuration. 
A simple LILO configuration will look like this:

boot = /dev/hdc
vga = normal
image = /vmlinuz
  root = /dev/hdc2
  label = linux
  read-only

Note that the boot parameter can be set to the drive as above or the root
partition /dev/hdc2. The latter installs LILO in the master boot record of 
the partition. Either should work but if one doesn't try the other. After 
making any changes to /etc/lilo.conf you need to run /sbin/lilo to load 
LILO onto the drive. If you are having trouble with booting, try adding 
the keyword linear to the lilo config. This will use a simpler method of
determining the drive geometry.

boot = /dev/hdc
vga = normal
linear
image = /vmlinuz
  root = /dev/hdc2
  label = linux
  read-only

If the linear keyword doesn't work, remove the line from lilo.conf and try 
specifying the drive geometry as follows. This will skip the IDE probing 
and brute force LILO to use the specified disk geometry.

boot = /dev/hdc
sectors = 63
heads = 64
cylinders = 522
vga = normal

image = /vmlinuz
  root = /dev/hdc2
  append = "hd=522,64,63"
  label = linux
  read-only

Dual Boot LILO Configuration

Once you have linux up and running on the microdrive, you may want to set 
up a dual boot so you can choose to boot from either the microdrive or 
laptop drive. Then you can do things like compilation and config on the 
laptop drive and copy only the binaries onto the microdrive (this saves
hundreds of MBs on the microdrive). On my system I have the laptop drive 
jumpered to be a slave. I always boot from the microdrive, but at the 
LILO prompt I can select to boot from either drive. The laptop drive needs 
to be jumpered as slave because its on the primary IDE channel. If its set 
to master it will always boot the laptop drive. I prefer it the other way 
around because if I default boot from the microdrive, with the laptop 
drive attached, I can create a mount between them and copy files in either
direction. Following is my final lilo.conf for dual boot from either the 
microdrive or laptop drive (this is the LILO config for the microdrive).

boot = /dev/hdc
disk = /dev/hdc
sectors = 63
heads = 64
cylinders = 522
map = /boot/map
install = /boot/boot.b
ramdisk = 0
prompt
timeout = 100 
vga = normal
default = microdrive

image = /vmlinuz
  root = /dev/hdc2
  append = "hd=522,64,63"
  label = microdrive
  read-only

image = /vmlinuz
  root = /dev/hdb2
  append = "hd=730,255,63"
  label = laptopdrive
  read-only

Mounting between Drives

I have my system set up with a complete slackware distribution on a 6 GB 
laptop drive, and a 280 MB binary only distribution on the microdrive. 
This works well with the dual boot config. If I want to add new software 
or change kernel etc on the microdrive I boot the laptop drive, compile 
and test there, and load only the necessary libraries and executables 
onto the microdrive after testing. The drives can be mounted in a manual 
way as follows:

On the microdrive
mkdir /mnt/laptopdrive
mount /dev/hdb2 /mnt/laptopdrive

On the laptop drive
mkdir /mnt/microdrive
mount /dev/hdc2 /mnt/microdrive

To make this process automatic, so the other drive is always available, 
I added entries to /etc/fstab on both drives:

On the microdrive 
/dev/hdc1  swap              swap        defaults        0   0
/dev/hdc2  /                 ext2        defaults        1   1
/dev/hdb2  /mnt/laptopdrive  ext2        defaults        0   0

On the laptop drive
/dev/hdb1  swap              swap        defaults         0   0
/dev/hdb2  /                 ext2        defaults         1   1
/dev/hdc2  /mnt/microdrive   ext2        defaults         0   0

This dual boot setup and auto mounting across drives makes it easy to keep 
the distro small on the microdrive but still have immediate access to a 
full distro with all of the dev tools, and lots of space for mp3 files and
making backups. During normal usage only the microdrive is attached. If 
the laptop drive is attached the system will by default boot from the 
microdrive but will automount the laptop drives allowing me to copy files 
between them. If I want to boot from the laptop drive, I simply enter 
"laptopdrive" at the lilo prompt. And whenever the laptop drive boots it 
automounts the microdrive.

Note on PCMCIA CD-ROM Drives

While I am on the topic of drives, I might as well document my config for 
the Archos MiniCD PCMCIA CD-ROM drive. This drive works well on the 
PCM-5822 with PC/104 PCMCIA card installed. When the CD-ROM PCMCIA card 
is inserted, linux automatically recognizes it as an ATAPI IDE drive and 
assigns it to /dev/hde. It can be manually mounted like this:

mkdir /cdrom
mount -t iso9660 /dev/hde /cdrom

To make a permanent proper configuration:
rm /dev/cdrom
ln -s /dev/hde /dev/cdrom 

Then add the following line to /etc/fstab
/dev/cdrom /cdrom   iso9660   noauto,user,ro  0 0

Now you can just do mount /cdrom
The 'user' keywork allows mounting by users not just root

Happy Wearing! But wear it thin and light. Your body will thank you :)

  -- Doug

--
Subscription/unsubscription/info requests: send e-mail with subject of
"subscribe", "unsubscribe", or "info" to 
Wear-Hard Mailing List Archive (searchable): http://wearables.blu.org
please, Please, *PLEASE* don't subscribe through a forward/false domain

+Previous Message in Thread | Next Message in Thread

From Wear-Hard Mailing list Archive (WH)
Maintained by R. Paul McCarty

Archive created with babymail