In this article, we built up a uClibc system. In this article, we will transfer the filesystem to a 100 meg zip disk. What this means is that if you have an old parallel port zip drive laying around, you can bring up a development system running Linux without touching your hard drive. There are also disaster recovery possibilities for this as well, as you can imagine. Really, you could probably use the original uClibc root filesystem, however, we are going to recreate the filesystem from the booted uClibc system that we updated Lilo and installed NASM on.
The only way we know of to boot off of a zip drive is to use a boot floppy. We will use loadlin for this. Refer to this article for more info on creating a loadlin boot diskette. We modify linux.bat so that it mounts /dev/sda as the root filesystem. More on that later, but the commands to do this are:
u-1@srv-1 linux-2.4.20 $ mcopy a:linux.bat ./ u-1@srv-1 linux-2.4.20 $ vi linux.bat u-1@srv-1 linux-2.4.20 $ cat linux.bat loadlin vmlinuz root=/dev/sda ro vga=3 u-1@srv-1 linux-2.4.20 $ mcopy linux.bat a: Long file name "linux.bat" already exists. a)utorename A)utorename-all r)ename R)ename-all o)verwrite O)verwrite-all s)kip S)kip-all q)uit (aArRoOsSq): o |
This is assuming you have mtools. This is a FAT filesystem, so you could also mount it.
We need to add SCSI disk support and the IOMEGA PPA driver. Here is a copy of our .config file we used to compile our 2.4.20 kernel. Copy this to the loadlin floppy:
u-1@srv-1 linux-2.4.20 $ mcopy arch/i386/boot/bzImage a:/vmlinuz Long file name "vmlinuz" already exists. a)utorename A)utorename-all r)ename R)ename-all o)verwrite O)verwrite-all s)kip S)kip-all q)uit (aArRoOsSq): o |
OK. We have a boot floppy that will load a root filesystem on /dev/sda, which is a zip drive. Remember that you have to run linux.bat after booting the floppy in order to boot. You could just rename linux.bat to autoexec.bat if you wanted the boot to happen automatically.
The next step is to back up the existing uClibc filesystem:
[root@uclibc /]# tar -cvpzf /all.tar.gz --exclude=proc --exclude=all.tar.gz . |
You’ll want to exclude all.tar.gz so you don’t back it up again… it is on the same filesystem you are backing up. Proc shouldn’t backed up either.
Our workstation (u-1) has ppa as a module, so we need to load it. We can use dmesg to find out the device name and make sure the module loaded OK:
root@srv-1 u-1 # insmod ppa Using /lib/modules/2.4.19-gentoo-r10/kernel/drivers/scsi/ppa.o root@srv-1 u-1 # dmesg . . . ppa: Version 2.07 (for Linux 2.4.x) ppa: Found device at ID 6, Attempting to use EPP 16 bit ppa: Communication established with ID 6 using EPP 16 bit scsi1 : Iomega VPI0 (ppa) interface Vendor: IOMEGA Model: ZIP 100 Rev: D.13 Type: Direct-Access ANSI SCSI revision: 02 Attached scsi removable disk sdb at scsi1, channel 0, id 6, lun 0 sdb : READ CAPACITY failed. sdb : status = 1, message = 00, host = 0, driver = 08 Current sd00:00: sense key Not Ready Additional sense indicates Medium not present sdb : block size assumed to be 512 bytes, disk size 1GB. sdb: Write Protect is off /dev/scsi/host1/bus0/target6/lun0: I/O error: dev 08:10, sector 0 I/O error: dev 08:10, sector 0 unable to read partition table |
If there was a zip disk in the drive, you would see the partition information. Usually this is partition 4 (sdb4). Dunno why. We don’t care about the partitions, though, we will format the entire device and restore our filesystem:
root@srv-1 u-1 # mkfs.ext2 /dev/sdb mke2fs 1.32 (09-Nov-2002) /dev/sdb is entire device, not just one partition! Proceed anyway? (y,n) y Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 24576 inodes, 98304 blocks 4915 blocks (5.00%) reserved for the super user First data block=1 12 block groups 8192 blocks per group, 8192 fragments per group 2048 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Writing inode tables: done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 30 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. root@srv-1 u-1 # mount -t ext2 /dev/sdb /mnt root@srv-1 mnt # cd /mnt root@srv-1 mnt # tar -xvzpf /share/signalq/natarticles/mvds/all.tar.gz root@srv-1 mnt # mkdir proc root@srv-1 mnt # cd / root@srv-1 / # umount /mnt |
We can now boot our uClibc system completely off of a zip drive. Just boot off of the linload diskette created above, and attach the parallel port zip drive with the zip disk we created in it.
One interesting thing about this is that the entire system can be duplicated from one zip disk to another:
root@srv-1 u-1 # cat /dev/sdb > giagd.img root@srv-1 u-1 # cat giagd.img > /dev/sdb |
For kicks, we booted an old 486 with 16 Megs of memory. The motherboard is balanced on the zip drive, which is balanced on the floppy drive. Don’t be doing this at home, kids, OK? We only did it because we really don’t care too much if disaster strikes this hardware. Yes, that is a VESA LB IDE/IO board that the zip drive is attached to. You can’t make it out really well, but when we ran top there was 3.6 megs used. We don’t have a driver compiled in for the NIC on this machine. If we did, we would probably use more memory. Still, this is a pretty lean system. Wanna see? Here you go:
Remember. This system has gcc on it, and can compile stuff. This is a whole development system running on incredibly outdated hardware. Some might call this system trash. Well, garbage is as garbage does, and this setup is running a 2.4.20 kernel and gcc 3.2.2. 🙂