Removing the Hard Disk
One of the last steps in this project is to switch the operating system from the hard disk to a compact flash card.
The CF card I'm using is a 1Gb SanDisk Ultra II. I also have a CFDisk CF-IDE adaptor so I can plug the card into a regular IDE channel.
I thought it would be a simple matter of booting into a separate Debian install (I still have one on it's own partition from my first attempt at all this) and copying the entire file system from the hard disk to the flash card. Unfortunately, I was unable to write to the Ultra II card while it was in the IDE adaptor. Actually, I was able to correctly write about 999,999 bytes out of every 1,000,000, but that just ain't good enough. This turned out to be a very tricky problem to track down. Basically I wound up having to recursively diff each file in the source and the destination to determine that there were some bytes that got mangled during the copy. Also, running
The solution was to insert the CF card into a standard USB card reader, the kind you might have to go with your digital camera. Debian automatically recognized the device and mounted it as
I followed the instructions that I described here to get the ramdisk up and running, and then borrowed a couple points from here: notably, creating a symbolic link from
That's all. Because these disk writes are (infinitesimally) unreliable and it's a real pain in the ass to switch between the hard disk and the cf-card, I'm going to go back to the hard disk for now and then try this whole process one more time when I am sure that I'm 100% finished.
The CF card I'm using is a 1Gb SanDisk Ultra II. I also have a CFDisk CF-IDE adaptor so I can plug the card into a regular IDE channel.
I thought it would be a simple matter of booting into a separate Debian install (I still have one on it's own partition from my first attempt at all this) and copying the entire file system from the hard disk to the flash card. Unfortunately, I was unable to write to the Ultra II card while it was in the IDE adaptor. Actually, I was able to correctly write about 999,999 bytes out of every 1,000,000, but that just ain't good enough. This turned out to be a very tricky problem to track down. Basically I wound up having to recursively diff each file in the source and the destination to determine that there were some bytes that got mangled during the copy. Also, running
/sbin/badblocks -t random -w /dev/hdb
indicated that certain writes would just randomly fail. [Note that the above command will destroy all existing data on your hard disk]The solution was to insert the CF card into a standard USB card reader, the kind you might have to go with your digital camera. Debian automatically recognized the device and mounted it as
/dev/sdb
. It was all much more convenient than I imagined it would be. In the end, I guess the write speed through USB was slow enough not to cause a problem. Once the filesystem was copied over, and I was ready to switch to a read-only file system, I reconnected the card to the IDE adaptor, because reading from the card works fine.I followed the instructions that I described here to get the ramdisk up and running, and then borrowed a couple points from here: notably, creating a symbolic link from
/proc/mounts
to /etc/mtab
and editing /etc/fstab
to include the "ro" option for the root filesystem.That's all. Because these disk writes are (infinitesimally) unreliable and it's a real pain in the ass to switch between the hard disk and the cf-card, I'm going to go back to the hard disk for now and then try this whole process one more time when I am sure that I'm 100% finished.
0 Comments:
Post a Comment
<< Home