|
Magoo's Wise Words | ||
| Posted: 24 Mar 07
P | How to boot OpenBSD 4.0 from USB Flash memoryFlash drives are big enough these days that you can fit an entire operating system on them. This makes for some interesting possiblities. AdvantagesThere are several advantages to running your OS on a flash drive. One - it uses much less energy. Hard drives have large platters that spin constantly, sucking down power. Two - USB flash drives are silent. Modern hard drives usually don't make much noise, but older ones squeal like a jet on the runway. Three - USB drives can be read in a random fashion. Your system might actually run faster on a flash drive if it spends most of its time getting small bits of data from different parts of the drive. Four - and here is the big one, is portibility. You can move your flash drive to a different computer, reboot, and be right back where you left off. DisadvantagesThere are also some disadvantages. The biggest one is speed. The USB interface doesn't outperform IDE, SATA, or SCSI for sustained transfers. So, if you are moving lots of data to and from the disk, it won't perform as well as a hard drive. The second disadvantage is wear. Flash drives wear every time you read or write to them. They have a limited lifetime, rated in a specific number or reads and writes. After that, they degrade quickly. The good news is that the number or reads and writes it can survive is high, and the right kind of flash drive used in the right way can last through years of reliable use. Background Based on these factors, booting your system off USB is good in a small firewall or router. It is not very good in a desktop or application server. Most modern computers support booting from a USB flash drive. The problem is that they can only read the FAT filesystem (based on my experience anyway - your BIOS may be more sofisticated than mine.) Also, older computers don't support booting from USB without a BIOS upgrade, or don't support it at all. The good news is that all computers I've come across in the last decade do support booting from a CD. If you want to use the OpenBSD filesystem, FFS, or your computer doesn't support booting from USB, you can build a CD for the computer to boot from. The computer boots the kernel from the CD, then mounts the root filesystem from the flash drive. I found instructions for building exactly this sort of CD on this site. The steps are written for OpenBSD 3.5, so they are outdated. My instructions here are updated for OpenBSD 4.0. About flash storage Flash memory wears out a little each time it is erased. Modern flash memory can survive 10,000 writes or more, which is plenty for normal usage. Unfortunatly, when you run programs off of it, it hits the same spots on the drive repeatly, which means that even 10,000 might not be enough. Fortunaly, a technique called wear-leveling can spread the wear around and extend the life of your flash drive significantly (it should last several years.) Wear leveling can be done at the OS level using a special type of file system, but OpenBSD doesn't boot from any of those filesystems. Fortunatly, many types of flash, such as CompactFlash and most USB flash drives have an on-board controller that takes care of wear leveling. You can use any type of flash media, but my guide is written for USB flash and I don't recommend flash storage without an on-board controller to perform wear leveling. USB flash typically has such a controller, while SmartMedia does not. I also recommend Single Level Cell flash (SLC) over Multi Level Cell flash. MLC and its decendants are cheaper but SLC is faster and can withstand about ten times as many writes. You should be able to find a good SLC USB Flash stick with a little googling, but I've had great luck with my Kingston DataTravler. You need about a 1 GB flash drive for OpenBSD 4.0. You can get away with 512 MB for OpenBSD 3.8, but the commands will be slightly different. I've found its best to get a drive that is bigger to avoid strange problems later on, so I'm using a 2 GB drive. (Note: This instructions could easily be adapted to make an OpenBSD LiveCD, if that interests you.) I'm assuming a basic knowledge of the Unix/Linux shell. If you are completly new to Unix, you might want to start with the basics. It will save you some frustration.
Next =>[Magoo's OpenBSD on USB Flash - Page 2, The steps] | Updated:
P |