Nontrivial Hard Drive Partitioning for Linux
When looking to build an PC to replace my old 1.3 GHz AMD Athalon XP, I created a list of requirements (really just desires) and a price limit of $600. A few of those requirements were applied to storage including:
- The machine must support at least RAID1
- There must be plenty of storage space for multimedia with room for expansion.
I spent endless hours on the web researching hardware, looking for that perfect balance between features and cost. I finally settled on a motherboard that supports 4 SATA 3.0GB/s connectors (supports four higher performance drives), 2 PATA (4 older drives, ideal for reusing my existing DVD and CD drives), and built in RAID support.
Only after I started trying to assemble my machine did I learn that one of my requirements was misguided. Linux does not need special hardware for RAID support. If I had known this when choosing a motherboard, I could have saved tens of dollars, or at leased used that additional money to buy a better part elsewhere in the machine. Interestingly, the software based RAID is a better solution for my needs, as it is not restricted to the hard drive level. Instead, RAID arrays can be constructed with hard drive partitions, allowing for more flexible configurations even when there are fewer hard drives to work with. I bet RAID arrays could be built with media other than hard drives, such as flash drives.
After discovering software based RAID and the mdadm command, I configured my two 250GB hard drives (surprisingly affordable from http://newegg.com) to have identically sized (to the block) partitions as follows:
/dev/hda1 ext3 140MB - /boot
/dev/hda5 swap 3GB - with option pri=1
/dev/hda6 jfs 40GB - / (root directory)
/dev/hda7 jfs 200GB - /home in RAID1 array /dev/md0
/dev/hdb1 ext3 140MB - Not Used
/dev/hdb5 swap 3GB - with option pri=1
/dev/hdb6 jfs 40GB - Not Used
/dev/hdb7 jfs 200GB - /home in RAID1 array /dev/md0
I was keeping /dev/hda6 open in case I wanted to play with a different linux distribution or a whole other operating system (e.g. http://JNode.org).
I am not sure what happened to the 2,3 and 4 partitions when I created these, as this was a fresh install. I know that one of them (I think it is the 4 partition) is used to create the extended partition for which the later numbered partitions are contained. Maybe the Gparted partition editor that comes with Ubuntu is smart enough to reserve the smaller numbers for the maximum number of partitions outside the extended partition.
I made sure that the /etc/fstab had the priority option set to 1 for both swap partitions, giving the swap space a performance boost due to twice the IO bandwidth of two hard drives. Since the swap partitions have the swap load distributed equally, this is similar to a RAID0 configuration. Keep in mind the performance gain exists only because the swap space is split between multiple hard drives that can perform input and output operations in parallel. If multiple swap spaces were configured on the same hard drive or on multiple hard drives attached to the same old-style IDE (PATA) connector, this would not have a positive effect.
Then, I used the mdadm command line tool to build a RAID1 array (/dev/md0) for the home directory. Since RAID1 mirrors the same data between hard drives, this added degree of assurance that I will not loose my important data in the event of a hard drive crash.
After a few months, I decided to order a digital TV tuner (the hdhomerun) for my PC hoping to use it like a TIVO on steroids. After recording one TV show, I realized my seemingly large 200GB of storage space really wasn't that large. HTDV records at roughly 2MB per second. At this rate, I could record at most 28 hours of video before exhausting the space in my home directory. Considering this machine is also my personal computer for doing software development, image editing and just about everything else I do outside of work, I was afraid that the system could start to feel a bit crowded. I bought a half terabyte of hard drive space to get away from that constraint, and yet I was faced with it again.
Most of the data I will be storing on my hard drive will not be sensitive in nature. Software can be downloaded or reinstalled, and TV shows will have reruns. Yes, obtaining all that information will be time consuming and painful, but loosing custom code I've spent countless hours on, documentation, family photos and the like would be unrecoverable and a shame. Certainly, redundancy beyond a single machine is important, and for the most valuable data I do use removable media, but I haven't gotten to the point of a disaster recovery plan for my personal files yet. Keeping this in mind, I reconfigured my hard drive partitioning to reduce my home directory to a 40GB RAID1 array, allowing me to combine most of my hard drive space into a single RAID0 partition for large file storage. This is what I am presently working with:
/dev/hda1 ext3 140MB - /boot
/dev/hda5 swap 3GB - with option pri=1
/dev/hda6 jfs 40GB - / (root directory)
/dev/hda7 jfs 40GB - /home in RAID1 array /dev/md0
/dev/hda8 jfs 160GB - /storage in RAID0 array /dev/md1
/dev/hdb1 ext3 140MB - Not Used
/dev/hdb5 swap 3GB - with option pri=1
/dev/hdb6 jfs 40GB - /home in RAID1 array /dev/md0
/dev/hdb7 jfs 200GB - /storage in RAID0 array /dev/md1
The RAID1 array requires that the partitions match in size exactly since one partition mirrors the other exactly, otherwise excess space in the larger partition is simply never used. The RAID0 array combines the two partitions into one larger partition. With RAID0, the partitions would ideally be the same size, allowing the workload to be evenly distributed across both drives (read performance), but this is not a firm requirement. I would be surprised if I tax my system to the point where I notice a performance difference. After all, this machine is not a high performance network server. I have unfortunately lost the flexibility of the unused 40GB partition, as it is now used in conjunction with part of the larger /dev/hda7 partition for the home drive. What this does do, however, is give me the redundant storage I want for my sensitive data while allowing a large 360GB partition for less valuable data. Using the df command now gives me something that looks like the following.
matlikj@hydra:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda6 40923460 14805828 26117632 37% /
varrun 1037780 112 1037668 1% /var/run
varlock 1037780 0 1037780 0% /var/lock
udev 1037780 116 1037664 1% /dev
devshm 1037780 0 1037780 0% /dev/shm
lrm 1037780 34696 1003084 4% /lib/modules/2.6.22-14-generic/volatile
/dev/sda1 194442 40590 143813 23% /boot
/dev/sdb1 194442 5664 178739 4% /media/sdb1
/dev/md0 40923460 15309264 25614196 38% /home
/dev/md1 358920168 47940 358872228 1% /storage
Getting to this point not at all easy, at least not with the automatic assembly feature of mdadm. After several hours of creating, destroying and reformatting the RAID arrays, I eventually gave up on the automatic assembly feature. I'm sure I'm missing something about how the auto assemble feature works, but I finally decided to take the easy way out and maintain the mdadm.conf file. I just have one more file that needs to be carefully maintained when a software update comes through. Since this post has gotten quite long, I will write the details on how the partitions were created later.
Laptops for the Children
While browsing the news summaries a while back on Slashdot, which I do often, I ran across an entry for the "One Laptop Per Child" project. As with any large effort, particularly those falling into the humanitarian category, there are always conflicting vocal opinions on how the effort is conducted. Regardless of the political aspects, I find the idea intriguing and applicable to more than just developing countries.
The Possibilities
Here in the United States, one of the richest countries in the world, there are still poor communities. Some communities are so poor that their schools can't afford textbooks or even paper and ink to print their own educational materials. The idea of providing laptops instead of "the basics" to the poorer communities may fly in the face of common sense, but could this common sense be wrong? At the root of this problem is money. Consumables (paper, ink for printing and copying, writing utensils, etc.), textbooks and workbooks all cost money.
The very nature of consumables requires a relatively constant cash flow just to continue the activities that require them. Paper is purchased, used, and disposed of. Eventually the paper runs out and needs to be replenished. If a school were to run off of laptops, it would be possible to eliminate much of these traditional costs. Of course, not all consumable expenses can or even should be eliminated. Penmanship is still of critical importance, and eliminating this kind of training would be irresponsible. However, tests, quizzes and other multiple choice homework assignments could be distributed, collected and graded digitally without putting penmanship at risk.
In my elementary and middle school years, I recall having around 2 or 3 textbooks that I kept in my desk along with roughly the same number of workbooks. While I haven't participated in the selection of such materials, I would think it reasonable to assume textbooks run around $75 or more each and workbooks around $20 each. The catalog on the Addison Wesley and Benjamen Cummings web site are far pricier than these estimates, though I suspect volume sales may reduce the price some. If these assumptions are roughly accurate, the cost of the text books alone could enough to purchase the OLPC laptop or its competitors.
Of course, the value of the laptop isn't in the machine itself; it is just the medium for which the same (or similar) content is made available to the student. In the most extreme cases, all this content could be created and maintained by the teachers. This is particularly feasible for math and language; however, this would be more difficult for science and the social studies, as these subjects continue to evolve. Here, public libraries as well as content available on the internet could fill the need. One example is Wikipedia, the online encyclopedia that I find to be a useful resource on a regular basis. There are also online communities of educators intended to facilitate the sharing of classroom material. Some content could still be purchased from traditional publishers in the electronic form. I don't know if such a business model exists at present, but if there is demand, supply will certainly follow. This has the advantage of obtaining the same content without the cost of physical printing, plus the content can more readily be updated by the provider. Errata can be easily applied directly to the body of the material, and the history and science curriculum will no longer suffer from outdated print that schools cannot afford to replace.
Aside from reference materials, the laptop opens up a new world of possibilities. Multimedia (sound and video) can be used to supplement the written content with broad possibility. What would be a static image in a textbook could be replaced with an animation or movie clip. Audio dictation combined with reading exercises (think karaoke) could help students learning to read or even new languages. Instead of news letters, audio and video recordings of the teacher can be sent home to parents who themselves are illiterate. Even educational games can be used to make learning fun and interesting while away from the classroom. Just imagine a teacher telling his or her students, "Your homework for tomorrow is to play this video game for 30 minutes," particularly if the game is fun!
The laptop is a computer, and computers were created to compute (i.e. process data). All interactive applications of the laptop (quizzes, homework, games) have the ability to collect data from the user. This too can be a useful feature for the teacher. The most obvious advantage is that the quizzes and homework can practically grade themselves. The less time a teacher spends grading each answer from each student in the classroom, the more time available to work on the lesson plan, creating new content, and have a life away from school (happy employees are more productive employees). This would also give students more immediate feedback, correcting misunderstandings before they are committed to long-term memory. On a "grander" scale, the potential exists for quantitative analysis of student performance for both the teacher and the software to use. Games and homework could automatically adapt to target each student's weaknesses, and performance reports can be generated for the teacher to identify trends indicating areas needing work, including regression.
One additional benefit that I am particularly sensitive to is for children with poor eyesight. In elementary school (2nd or 3rd grade, I can't remember), my optometrist informed my mother I couldn't see the big E on the eye chart. Fortunately, my parents could afford the ridged contact lenses he recommended, and the degradation of my vision slowed significantly, as he had hoped. During the time my eyes were progressively getting worse, I was unable to live up to my potential at school. As an educational tool for me, the chalkboard was nearly worthless. Many children may not receive corrective lenses of any kind because they cannot afford them. A laptop could potentially prevent such vision problems from interfering with such a student's education. A virtual chalkboard, or even a live feed of an actual chalk board, could be used to broadcast the teacher's lecture material to each student's laptop. Those with nearsighted vision can look at the screen while those with farsighted vision can watch the teacher up front. Of course, this doesn't address farsighted student's ability to use the laptop.
Concerns
The question of durability comes to mind. A textbook can generally be usable for years before it reaches its end of life. Economic feasibility depends on the laptops being usable as long if not longer than a printed textbook with minimal maintenance costs. This has been a particular design goal for the OLPC laptop, and as such, has been engineered to survive some fairly extreme conditions. With no moving parts, a water resistant housing, and environmental testing for both high temperature and high altitude, I wouldn't be surprised if it is more resilient than the scientific calculator I've used for the past 10 plus years, and that my 4 year old son now thinks is his own personal computer. Take a look at the OLPC features for a summary on the laptop's construction.
Classrooms, book bags and buses tend not to be "secure" places for objects of value, and many consider laptops as highly valuable. One might think that the laptop would be a sweet target for a crime of opportunity, and it might. However, the kind of laptop proposed here is not a general purpose laptop. Nor is it a powerful, flashy or particularly expensive laptop. The intent is to make the machine simple and specialized for use in an educational environment. Once the machines become familiar to the general public, I suspect that interest in these machines from a profiteering point of view will wane. Perhaps a "marketing effort", for lack of a better term, could be launched before deployment calling the machines something other than laptops... like educational device. If usage becomes prevalent, they may even be viewed in the same light as text books. This certainly won't stop theft from occurring, that is a way of life. However, it may eventually keep these machines from disappearing at an unacceptable rate.
I've read about concerns with laptops in the classroom due to the distraction factor. Computer games, instant messaging, browsing the web for Youtube videos, Myspace and other trendy social networking sites can become a problem if they are accessible during class time. Again, a machine specialized for an educational environment might help, such as a simple browser that does not support plugins (flash, Java, video players, etc). More importantly, a student's activities should be readily viewable by the teacher either over the student's shoulder or from the teacher's desk. In a traditional classroom, a teacher could easily identify a student discarding the classroom activity in favor of, say a comic book. Digitally, this would not be so obvious unless the teacher could poll each student's machine for the application and content they are actively using.
Along with the booming popularity of technology comes a new list of popular physical ailments. The increase in text messaging via cell phones led to an increase in thumb injuries now known as blackberry thumb. Laptops tend to place the user into an unnatural posture, leading to its own ailments. Both teachers and students would need to be trained how best to use the laptop to avoid such injuries. Are these new injuries enough to write off the laptop as a good idea? I would argue not. The act of writing more often than not places people into an unnatural posture. Both my wife and I suffer hand and wrist pain any time we put pen to paper for an extended period of time, partly due to the "death grip" we place on the pen despite conscious effort not to. I also find that reading for extended periods of time, particularly when the reading material is left flat on a table, strains my neck and upper back. In short, the potential for injury is a fact of life and is nothing unique to laptop usage. Recognizing injuries and how to prevent them is important in all scenarios.
Another significant concern is the ability of teachers to accept and adapt to using a laptop in the classroom. Even if all obstacles are overcome (financial, technical, content, distribution, maintenance, etc.) and the theoretical benefits are achieved (reduced operating cost, accurate and current content, greater ability to cater to individual student's needs, increased interest of students both in and out of the classroom, and so on), any effort to use laptops in the classroom will fall flat on its face without the teachers committing themselves to the approach.
Conclusion
As you can see, my belief is the use of this kind of device in school has great potential, regardless of the community's wealth. Inexpensive hardware will limit the capability of such a machine; however, it will lower the barrier of entry for lower income communities and may prove beneficial over general purpose laptops because of the restrictions. I am considering purchasing one or two of these OLPC machines for my own kids during the OLPC Give 1 Get 1 campaign for use at home.
(1)