Whew.    Posted:

I work on a test automation framework at my day job. It's Django-powered, and there's a lot of neat stuff going on with it. I love building it!

Anyway, yesterday during a meeting, I got an email from a co-worker who seemed to be in a bit of a panic. He wrote that he accidentally deleted the wrong thing, and, being Django on the backend, a nice cascading delete went with it (why he ignored the confirmation page is beyond me). He asked if we had any database backups that we could restore, also curious as to how long it would take.

Well, lucky for him (and me!), I decided very early on while working on the project that I would implement a custom database driver that never actually deletes stuff (mostly for auditing purposes). Instead, it simply marks any record the user asks to delete as inactive, thus hiding it from the UI. Along with this, nightly database backups were put in place.

I'll be quite honest--I had a moment of fear as I considered how long it had been since I really checked that either of these two things were still working as designed. I implemented the database driver before I learned to appreciate unit testing, and I haven't made it to that piece as I've been backfilling my unit test suite (yet). As for the nightly database backups, I had never actually needed to restore one, so for probably the last year I didn't really bother checking a) that they were still being produced or b) that they were valid backups.

Thankfully, both pieces were still working perfectly. All I had to do was undelete a few things from the database, as I haven't made a UI for this. After doing that, I realized that one set of relationships was not handled by the custom driver. To fix this, I just restored the most recent nightly backup to a separate database and extracted just those relationships I was interested in. And it worked!

This is the first time I've really been bitten by a situation like this personally. I'm very pleased that I had the foresight to implement the precautionary measures early on in my project. I've also learned that I should probably keep up with those measures a bit better. I definitely plan to make some changes to help mitigate the potential for bad stuff to happen in the future. But it looks like I have a good foundation to build upon now.

TL;DR: unseen magic and valid database backups FTW.


SaltConf 2014    Posted:

Being one to try to automate all teh things, I'm always curious to find and experiment with new tools that appear which are supposed to help me be lazy. SaltStack is one such tool.

I first stumbled upon references to SaltStack sometime before the summer of 2012. At the time, I only put enough effort into SaltStack to be aware of what it does and a little bit of its history. I remember telling a few of my friends about it, and adding it to my TODO list. At some point, I even installed it on a couple of my computers.

The problem was that I never made time to actually learn how to use it. I kept telling myself that I'd experiment with it, but something else always got in the way--kids, work, gaming... Also, I had briefly used tools like chef and puppet (or tried to), and I had a bad taste in my mouth about configuration management utilities. I'm sure part of my hesitation had to do with those tools.

Anyway, fast forward to the beginning of January 2014. Salt is still installed on my main computer, but I've never even launched or configured it. I decided to uninstall salt and come back to it another time. Just a few short days after uninstalling salt, my supervisor at work sent me an email, asking if I'd be interested in attending SaltConf. I was more than happy to jump on the opportunity to finally learn about this tool that I had been curious and hesitant to use (and get paid to do it!).

The Training

I was able to sign up for an introductory course for SaltStack, which took place on Tuesday, January 28th. This was an all-day ordeal, but it was very intriguing to me. Normally, I'm one of the quiet ones in a classroom setting. I rarely ask questions or comment on this or that. This was not the case with the training course. I was all over everything our instructors had to say. I was hooked.

A lot of topics were quickly reviewed during the training. What normally takes 3 days was compressed into a single-day course. It was rather brutal in that sense--tons of material to digest. I think they did a fantastic job of explaining the core concepts and giving a fair number of examples during the training.

The Conference

SaltConf really began on Wednesday, and there were some absolutely fantastic sessions. I was particularly impressed with a demo of VMware's vCloud Application Director, which can orchestrate the creation of entire clusters of inter-related servers.

Other sessions that were quite interesting to me mostly related to virtualization using Docker, straight LXC, and libvirt. I'm very excited to become proficient with salt when dealing with virtualized environments.

The Certification

SaltStack officially introduced its first certification, known as SSCE (SaltStack Certified Engineer). The certification fee was included in the registration for the conference. Despite only having a matter of hours worth of rudimentary experience with SaltStack, I decided I might as well take a stab at the exam. I fully expected to fail, but I had absolutely nothing to lose other than an hour taking the exam.

Well, I took the exam Wednesday night, after the full day of training and another full day of seeing real-world uses for salt. I did spend an hour or two reading docs, installing, and configuring salt on my home network too. Eighty questions and 56 minutes later, I learned my score.

I got 68 our of the 80 questions correct--85%! Not bad for a newbie. I hear the pass/fail threshold is 80%, but I've yet to receive my SSCE number or anything like that. Hopefully by Monday I'll receive that information.

Moving Forward

It actually occurred to me that I've basically built my own version of the platform-independent remote execution portion of SaltStack (for work). Many of the same concepts exist in both salt and my own implementation. I will say that I am partial to the my design, but I'll most likely be phasing it out to move toward salt in the long term.

After attending all three days of SaltStack deliciousness, I'm absolutely convinced that salt will be a part of my personal and professional toolkit for a long time to come. It's an extremely powerful and modular framework.

In the little bit of experimentation that I've done with salt on my home network, I've already found a few bug that appear to be low-hanging fruit. I plan on working closely with the community to verify that they are indeed bugs, and I most definitely plan on contributing back everything I can. This is such an exciting project!!

If you haven't used it yet, you must research it and give it a try. It is a game-changer.


Startech: Scammer Scammed    Posted:

My wife and I took the kids out to visit family out in California for Thanksgiving break this past year. It was a fantastic visit. We all had a great time. I even got a fun story out of the first evening there! I made sure to write down the details in my phone shortly after this occurred, and I've decided to post them here for others to enjoy.

My wife's grandfather received a phone call from a "Startech" company (213-330-0187, according to the phone's caller ID). The caller yammered on about having detected a bunch of viruses on grandpa's computer, and he claimed that he was calling to help us get rid of them. Being the resident tech guy, grandpa handed the phone off to me to deal with the situation.

The Indian guy on the other end again explained that he found out that our computer has several viruses and was going to walk us through how to get rid of them. He asked if my computer was turned on, to which I responded that no, the computer wasn't currently on. He asked if I could go turn it on and sit in front of it. I told him I would. While the computer was "booting," he asked how old the computer is. I told him it was maybe three years old. Eventually, I told him the computer was ready.

At this point, he asked me if I saw a key on my keyboard with the letters C, T, R, and L. Obviously, I did. Then he asked if I could see a key near that with a flag on it. When I said that I could see it, he asked me to find the R key. Once discovered, he instructed me to push the flag key and the R key.

I told him that I pushed the keys, but nothing happened on my computer. He patiently asked me to try again. When I again stated that nothing happened, he asked me to describe which keys I was pushing. I told him I held down the flag key and the R key at the same time, and he claimed that it was not possible for nothing to happen when I push those keys.

I believe that's when he instructed me to hold the flag key down with one finger then hold down the R key with another. Again nothing. He asked me to try a few more times, because maybe my computer was just slow. For each attempt, I claimed that nothing had happened, and he muttered something about this not being possible. Mind you, I wasn't even looking at a computer during any if this.

Eventually, he gave up trying to get that dialog to pop up. He said there was another option. He asked which Web browser I use, if it's called Mozilla Firefox, Google Chrome, or Microsoft Internet Explorer. I said. "Uhm, I think it's called Midori..." He was a bit confused, asking me to repeat the name. I did repeat it, and I even spelled it out for him. Apparently it wasn't important, because he just shrugged it off and continued with his script.

He asked me to type into the address bar the following address: www.appyy.com. I told him that I typed it in and it just said "Page Not Found." He was a bit skeptical at first, asking me to verify what I had typed into the address bar. He asked me to try again, again claiming that it is not possible for the page to not load.

That's when I asked him if I had to be connected to the Internet to follow this step, because I couldn't be on the phone and on the Internet at the same time. He let out a sort of exasperated sigh, then asked if there was any other number he could use to call me while I was on the Internet. I told him I only have the one number, and he diligently asked if a had any friends or family who could come over so I could use their phone. I said everyone I know is out of town for the holidays.

I believe he then went on a little rant about them calling everyone in my state about their viruses. No doubt in my mind :)

Then, trying to be helpful, I asked if maybe he could email me the instructions do I could walk through them after we hung up. He said he would just say them over the phone for me to write down. I told him I was okay with that, and then he started listing off the steps: "the first thing you'll need to do is hang up, then...." That's when I hung up on him. He called back, but we just laughed with each other instead of answering.


InstArch    Posted:

My blog has obviously been quite inactive the past year. I've started a bunch of new projects and worked on some really interesting stuff in that time. I'm going to try to gradually describe the things I've been playing with here.

One project I started in the summer of 2013 is a personal Arch-based LiveCD. My goal in building this LiveCD was purely personal: I wanted to have a LiveCD with my preferred programs and settings just in case I hosed my main system somehow. I want to have minimal downtime, particularly when I need to keep producing for work. That was the idea behind this project. I called it InstArch, as in "instant Arch".

The build scripts for this project are hosted on bitbucket, while the ISOs I build are hosted on sourceforge. InstArch was recently added to Softpedia, and it has received a bit of interest because of that. Again, the idea behind this project was entirely personal--I'm not trying to make a new distribution or community because I'm dissatisfied with Arch or anything like that. There is some erroneous information about InstArch on Softpedia, but I haven't yet written them to ask them to fix it. Soon enough :)

If you're interested in playing with my live CD, feel free to download it and offer suggestions on the issue tracker. I may or may not implement any suggestions :) I've already had one person email me asking about the default username and password for InstArch. If you also find yourself needing this information:

  • username: inst
  • password: arch

You shouldn't need this information unless you try to use sudo or try to switch desktop sessions.

Here's a video of my live CD in action.

Also note that I haven't built/published a new live CD for several months.

Another part of the InstArch project, which I started looong before the actual LiveCD, was to create my own personal Arch repository. It tracks a bunch of packages that I build from the AUR and other personal Arch packages. Anyone is free to use this repo, and it's one that's built into my live CD.

If you wish to use this repository, add my key:

pacman-key -r 051680AC
pacman-key --lsign-key 051680AC

Then add this to your /etc/pacman.conf:

SigLevel = PackageRequired
Server = http://instarch.codekoala.com/$arch/


Check Your Receipts    Posted:

This morning I stopped for gas at a gas station that is associated with a grocery store. Buy more groceries, save a few cents off each gallon pumped at their station. That sort of deal. I found a gas voucher in my coat from a grocery shopping trip that should have allowed 25 cents off each gallon, so I figured I might as well use it before it expired.

When I scanned the little barcode on the voucher, I noticed that the display only registered a 20-cent-per-gallon discount. I also noticed that it would let me pump only ~7.5 gallons instead of the 20 that the voucher was good for. Luckily, there was an attendant in the tiny shack for the gas station that early. I approached him and asked what was going on--why I wasn't getting my full discount.

Obviously, he didn't believe my claims and had to see things for himself. He scanned the voucher and saw exactly what I described. Confused, he scuttled off to his shack to investigate. He couldn't figure out the exact cause, but ultimately he decided that someone else also had the same code or something from their own shopping trip. He was kind enough to actually give me the cash value of the 25-cents-per-gallon discount right then and there, so that's cool.

Moral of the story: if you use such gas vouchers, be sure to check the displayed discount with what you see on the voucher. If you notice a discrepancy, maybe you'll be lucky enough to get the cash value like I did! What makes it even more exciting is that I rarely use the full "up to 20 gallons" part of the voucher before the expiration. Bonus!


Test-Driven Development With Python    Posted:

Earlier this year, I was approached by the editor of Software Developer's Journal to write a Python-related article. I was quite flattered by the opportunity, but, being extremely busy at the time with work and family life, I was hesitant to agree. However, after much discussion with my wife and other important people in my life, I decided to go for it.

I had a lot of freedom to choose a topic to write about in the article, along with a relatively short timeline. I think I had two weeks to write the article after finally agreeing to do so, and I was supposed to write some 7-10 pages about my chosen topic.

Having recently been converted to the wonders of test-driven development (TDD), I decided that should be my topic. Several of my friends were also interested in getting into TDD, and they were looking for a good, simple way to get their feet wet. I figured the article would be as good a time as any to write up something to help my friends along.

I set out with a pretty grand plan for the article, but as the article progressed, it became obvious that my plan was a bit too grandios for a regular magazine article. I scaled back my plans a bit and continued working on the article. I had to scale back again, and I think one more time before I finally had something that was simple enough to not write a book about.

Well, that didn't exactly turn out as planned either. I ended up writing nearly 40 pages of LibreOffice single-spaced, 12pt Times New Roman worth of TDD stuff. Granted, a fair portion of the article's length is comprised of code snippets and command output.

Anyway, I have permission to repost the article here, and I wanted to do so because I feel that the magazine formatting kinda butchered the formatting I had in mind for my article (and understandably so). To help keep the formatting more pristine, I've turned it into a PDF for anyone who's interested in reading it.

So, without much further ado, here's the article! Feel free to download or print the PDF as well.


I'm Using Nikola Now    Posted:

For anyone who still might be visiting my site with any regularity, you might have noticed some changes around here. For the past several years, I've been blogging on a Django-based system that I wrote a very long time ago. I wrote it because, at the time, there weren't many Django-based blogging platforms, and certainly none of the few were quite as robust as I thought I wanted.

I set out to build my own blogging platform, and I think it worked out fairly well. As with all things, however, it became obsolete as the ecosystem around it flourished. I simply didn't have the time to continue maintaining it as I should have. That's also part of the reason for my lack of activity here these past couple of years.

Anyway, in an effort to keep this blog alive, I've switched to a much more simple blogging system known as nikola. It's not your run of the mill Wordpress clone. No, it's much more simple than that, but it doesn't sacrifice much of what I had with django-articles. I still get to write my posts using a format that I enjoy (restructuredtext). I get to write my posts in an editor that I enjoy (vim). I get to keep my posts in a "database" that I enjoy (git). I get to deploy using an interface that I enjoy (the command line). And I don't have to try to keep up with what is happening in the blogging ecosystem--there are plenty of other people handling that with nikola for me!

So, you can expect more posts in the coming year. Call it a new year's resolution.


Django Projects    Posted:

Over the past 6 years, I've built a lot of things with Django. It has treated me very well, and I have very much enjoyed seeing it progress. I got into Django when I helped the company I was working for transition away from a homegrown PHP framework toward something more reliable and flexible. It was very exciting to learn more about Django at a time when the ecosystem was very young.

When I started with Django, there weren't a lot of pluggable apps to fill the void for things like blogs, event calendars, and other useful utilities for the kinds of sites I was building. That has changed quite a bit since then. The ecosystem has evolved and progressed like mad, and it's wonderful. We have so many choices for simple things to very complex things. It's amazing!

Unfortunately, during this whole time period, my development efforts have shifted from creating my own open source projects to share with the world toward more proprietary solutions for my employers. If it's not obvious to you from my blog activity in recent years, I've become very busy with family life and work. I have very little time to give my open source projects the attention they deserve.

For at least 4 years, I've been telling myself that I'd have/make time to revamp all of my projects. To make them usable with what Django is today instead of what it was when I built the projects. Yeah, this time has never showed up. Take a look at the last time I wrote a blog article!

I have decided to disown pretty much all of my open source Django projects. I've basically done this with one or two of the more popular projects already--let someone else take the reigns while I lurk in the background and occasionally comment on an issue here or there. I truly appreciate those who have taken the initiative here. But there are still plenty of projects that people may find useful that need some attention. I'm putting it up to the community to take these projects over if you find them useful so they can get the love and attention they need.

Here is a list of Django projects that anyone is free to assume responsibility for. Most of them are silly and mostly useless now. Some are unpleasant to look at and could use an entire rewrite.

The fact that I'm giving up these projects does not mean I'm giving up on Django. On the contrary, I'm still using it quite heavily. I'm just doing it in such a way that I can't necessarily post my work for everyone to use. I honestly don't expect much of this disowning effort, since the projects are mostly stale and incompatible with recent versions of Django. But please let me know if you do want to take over one of my projects and care for it.


Another I-Heart-Linux Story    Posted:

Just had another experience that represents much of what I love about Linux and free software, and I thought I would share.

I just got my first bluray burner. I have it in a USB3-capable enclosure to use with my USB2-capable laptop. I knew burn speeds would be much lower than the drive is rated to handle primarily because of this arrangement.

A good portion of yesterday included me trying to burn my first bluray in Linux. Unfortunately, the nature of bluray standards and Linux still don't jive very well. My usual burning applications didn't have any trouble at all detecting the burner or the media, but none of them seemed to want to actually burn anything. K3b made a coaster out of one disc; Brasero did nothing. I didn't try using the command line burning tricks that I found on the interwebs.

I decided to give ImgBurn a shot. I installed it with WINE, and it ran beautifully. However, I failed to realize that I left K3b's coaster in the drive and couldn't get a disc to burn. In my own defense, the coaster was still recognized by the computer as a blank BD-R. It was at this point that I just rebooted into Windows just to verify that the drive itself worked for burning.

Windows obviously burned the first disc fine (after I realized the coaster was still in the drive and replaced it with a fresh disc). The media I have are only rated for 4x burn speeds, while the drive itself is rated for 14x burning. Windows only managed to achieve ~2x for the duration of the burn (using ImgBurn again). Also, Windows seemed to struggle trying to keep the buffers full. Every 70 seconds or so, ImgBurn would stop burning to allow the buffers to fill up again and for the hard drive to settle down a bit. But it did end up working--the disc worked in my bluray player that's hooked up to the TV!!! Success!

I decided to give ImgBurn in WINE another shot. I popped a fresh BD-R into the drive, specified the files I wanted to burn, and initiated the burn process. Right off the bat, ImgBurn under WINE was burning at 2.4x. I watched the process for 10 minutes or so before heading upstairs to let it finish. Not once was the main buffer depleted. The drive buffer (4MB) was up and down every so often, but it was never empty from the time the burn began until the time when I left my computer.

I realize that some of you out there will just see the moral of this story being something like, "Linux doesn't support burning bluray discs very well, and Windows worked on the first try." If you find yourself in this boat, you're probably not part of the intended audience of this tale. This is probably because you have some bias against any operating system that isn't the one you're currently using. No, this story is intended for people who like to tinker and don't think it's a waste of time to go through exercises like this.

Anyway, the real reason I wrote this story was to illustrate one of my favorite things about Linux: it's fast! Burning a bluray disc using an application that was written for Windows, running with a (free, open source, community-driven) Windows compatibility layer in Linux is still faster than the same program running natively on Windows. Sure, it might not always be the case, but in my ~12 years of hands-on experience with Linux, I find that it usually is the case.


So I've burned another 5 blurays under Linux with ImgBurn. Here's the interesting part of my most recent burn log:

I 00:51:40 Operation Started!
I 00:51:40 Source File: -==/\/[BUILD IMAGE]\/\==-
I 00:51:40 Source File Sectors: 11,978,272 (MODE1/2048)
I 00:51:40 Source File Size: 24,531,501,056 bytes
I 00:51:40 Source File Volume Identifier: Stargate - Disc 6
I 00:51:40 Source File Volume Set Identifier: 4222067200B6C611
I 00:51:40 Source File Application Identifier: IMGBURN V2.5.7.0 - THE ULTIMATE IMAGE BURNER!
I 00:51:40 Source File Implementation Identifier: ImgBurn
I 00:51:40 Source File File System(s): ISO9660, UDF (1.02)
I 00:51:40 Destination Device: [3:0:0] HL-DT-ST BD-RE  WH14NS40 1.00
I 00:51:40 Destination Media Type: BD-R (Disc ID: PHILIP-R04-000)
I 00:51:40 Destination Media Supported Write Speeds: 4x, 6x, 8x
I 00:51:40 Destination Media Sectors: 12,219,392
I 00:51:40 Write Mode: BD
I 00:51:40 Write Type: DAO
I 00:51:40 Write Speed: MAX
I 00:51:41 Hardware Defect Management Active: No
I 00:51:41 BD-R Verify Not Required: Yes
I 00:51:41 Link Size: Auto
I 00:51:41 Lock Volume: Yes
I 00:51:41 Test Mode: No
I 00:51:41 OPC: No
I 00:51:41 BURN-Proof: Enabled
I 00:51:41 Write Speed Successfully Set! - Effective: 35,968 KB/s (8x)
I 00:52:00 Filling Buffer... (80 MB)
I 00:52:02 Writing LeadIn...
I 00:52:03 Writing Session 1 of 1... (1 Track, LBA: 0 - 11978271)
I 00:52:03 Writing Track 1 of 1... (MODE1/2048, LBA: 0 - 11978271)
I 01:18:33 Synchronising Cache...
I 01:18:34 Closing Track...
I 01:18:35 Finalising Disc...
I 01:18:50 Exporting Graph Data...
I 01:18:50 Graph Data File: C:\users\wheaties\Application Data\ImgBurn\Graph Data Files\HL-DT-ST_BD-RE_WH14NS40_1.00_WEDNESDAY-JANUARY-02-2013_12-51_AM_PHILIP-R04-000_MAX.ibg
I 01:18:50 Export Successfully Completed!
I 01:18:50 Operation Successfully Completed! - Duration: 00:27:09
I 01:18:50 Average Write Rate: 15,067 KB/s (3.4x) - Maximum Write Rate: 18,615 KB/s (4.1x)

As you can see, the last line suggests things are working quite nicely in Linux:

I 01:18:50 Average Write Rate: 15,067 KB/s (3.4x) - Maximum Write Rate: 18,615 KB/s (4.1x)

I would like to note also that two of the discs I've burned so far have had some problems being read on the computer afterwards. These discs do, however, work quite nicely in the bluray player for my TV. Might just be circumstance.


Installing Arch Linux On EeePC 701 4G    Posted:

I know, I know, a lot of you are asking, "Why on earth would you want to do anything with a machine that's 5 years old?!" The hardware is crap now, and it was crap when the EeePC came out. Well, my friends, that's one of the great things about Linux! It will put new life into old hardware. Granted, the EeePC 701 4G came with Linux on it and all that, but I'm talking about putting something modern on it. Regardless, this guide will hopefully be useful for others who are trying to get Linux installed using LVM that uses something like an SD card as part of the primary volume group.

I've had Arch Linux installed on my EeePC for quite a while, but I only recently began to appreciate the benefits of LVM. The key requirement for this installation was to use LVM partitioning instead of traditional partitioning. I wanted the built-in 4GB SSD and the 8GB SD card to appear as one hard drive to the operating system so I would have that much more space to actually use.

Another key requirement for this installation was that I wanted to do it using a PXE server instead of the usual USB/external CD drive method. I've used PXE servers in the past, but I never really did much with them. I wanted to use this as an excuse to learn a bit more about them.


If you're following along at home, I'm assuming that you have (access to) the following:

  • An EeePC 701 4G
  • An SD card that will be a permanent fixture in your EeePC
  • A router running DD-WRT that serves as the DHCP server for your network (I am running v24-sp2). Alternatively, just use a USB/CD to install.

PXE Setup

If you want to save some time and just use a USB/CD to install Arch, go ahead and skip to the Arch Installation section.

For those who are unfamiliar with PXE servers, PXE stands for "Preboot eXecution Environment." It allows you to boot your computer over the network using images stored on a different machine. Since I didn't want to plug in my USB key or external DVD drive, this was a perfect option.

I used my main laptop as the PXE server. All I really did was install atftp from the AUR, copy ipxe.pxe from the Arch Linux Netboot page (from the "Using an iPXE image" section), and put it in /var/tftpboot. After that, it was a matter of running atftpd:

rc.d start atftpd

The next step required tweaking the dnsmasq configuration on my router. Here's what I did:

  • Login to router

  • Go to the Services tab

  • Find the DNSMasq section (mine is already enabled for other purposes, so I assume you will want to make sure yours is enabled)

  • In the "Additional DNSMasq Options" box, make sure you have something like:

    dhcp-boot=ipxe.pxe,[your PXE server's name],[your PXE server's IP]
  • Apply the changes. I rebooted my router just to be sure.

That's all there really is to the PXE side of things.

EeePC Setup

You'll want to make sure that booting from the network is enabled in your BIOS. I'll post a list of my BIOS settings later.

Then you should be able to boot your EeePC from the network. If your EeePC isn't configured to boot from the network first, you can simply hit Escape while the BIOS POST screen is still showing and select it from the menu that appears.

If all goes according to plan, your EeePC should receive an IP address and download the boot images from your PXE server. Once you select the appropriate Arch Install option from the menu, it should go out and download the ISO and boot it up. It's pretty neat to see in action. Maybe one day I'll try to tweak this to use an ISO image that's available on the local network instead of downloading it from the Internet every time.

Arch Installation

Installing Arch Linux should be fairly simple if you follow the installation guide (which is also available during installation these days at /root/install.txt). The key thing to remember, if you want to use the built-in SSD and a permanent SD card as one hard drive, is to use LVM partitioning.

LVM Partitioning

The Arch Linux LVM guide will likely be an invaluable resource if you're new to LVM. Here I will simply give a short list of commands that I think I used to get my EeePC setup (I did this several days ago, so I might miss something along the way...sorry)

It's important to note that, while it's supposedly possible, I've never had any luck keeping my boot partition in an LVM setup. As such, I first partition my SSD and SD cards using fdisk. There are plenty of resources for fdisk and cfdisk out there, so I'll skip over the specifics of how to use each one and just give you an idea of what needs to be done.

  • Wipe all partitions from both /dev/sda (the SSD) and /dev/sdb (the SD card)
  • Create a 50-100MB primary partition at the beginning of /dev/sda. Mark it as bootable. Set the partition type to 83 (Linux).
  • Create another primary partition on /dev/sda that consumes the remaining disk space. Set the partition type to 8e (Linux LVM).
  • Create a primary partition on /dev/sdb that consumes all space on the SD card. Set the partition type to 8e (Linux LVM).

Now that we have some "Linux LVM" partitions to deal with, we can begin using LVM. Each partition we wish to use (both /dev/sda2 and /dev/sdb1) needs to be configured as an LVM "physical volume":

pvcreate /dev/sda2
pvcreate /dev/sdb1

Next, we create an LVM volume group that uses both of our physical volumes:

vgcreate vg0 /dev/sda2
vgextend vg0 /dev/sdb1

Lastly, create the LVM logical volumes. It's up to you how you setup your partitions, but I chose to create a swap partition (since my EeePC only has 512MB RAM) and a root partition. To create a swap partition, you simply do something like this:

lvcreate -C y -l 1G vg0 -n swap

And here's what the arguments mean:

  • -C y: make the partition contiguous
  • -l 1G: number of logical extents to allocate for the new logical drive
  • vg0: the name of the volume group we created earlier
  • -n swap: the name of the new logical volume

I created my root partition to fill the remaining space in the volume group as follows:

lvcreate -l +100%FREE vg0 -n root

Then it's just a matter of formatting your partitions. I'm not up-to-date on the debate regarding which FS is ideal for solid state media, so I just chose ext2:

mkfs.ext2 /dev/sda1
mkfs.ext2 /dev/mapper/vg0-root
mkswap /dev/mapper/vg0-swap

It's probably worth noting that you now have several ways to reference your newly-created LVM volumes. Here are my favorites:

  • /dev/[volume group name]/[volume name]
  • /dev/mapper/[volume group name]-[volume name]

Install Arch

I really don't want to duplicate the Arch Linux installation guide, so I'll just leave you to follow along there. Go ahead and mount your new partitions, pacstrap everything you want, and arch-chroot your heart away. But you might want to come back before you exit the chroot, otherwise your EeePC might not boot and you'll have to waste some time trying to figure out why.

Help The EeePC Boot With LVM

Before you reboot, you'll probably want to modify your /etc/mkinitcpio.conf to let your EeePC understand your LVM setup. The two key lines are MODULES and HOOKS. Here's what I have:

MODULES="usb-storage scsi-mod sd-mod libata usbcore uhci-hcd ehci-hcd"
HOOKS="base udev autodetect pata scsi sata lvm2 filesystems usbinput fsck"

The key here is to ensure that lvm2 appears before filesystems in your HOOKS list. Also, you want to load some modules to allow the SD card to be detected before the LVM hook attempts to find your partitions. I'm not sure if you need all of those modules, but they worked on the first try for me. To make the changes useful, rebuild your boot images:

mkinitcpio -p linux

To go along with detecting your SD card at boot, you want to give it enough time to settle before LVM tries to use it. In my case, 3 seconds is sufficient, so I added this to my /boot/syslinux/syslinux.cfg:

lvmwait=/dev/vg0/root rootdelay=3

You should be able to add that to the APPEND lines in your syslinux.cfg or the kernel line in your GRUB configuration file. Or whatever it is with GRUB these days.

Also, while you're editing your bootloader configuration, be sure to change the root partition to /dev/vg0/root (or whatever you chose when you did your LVM partitioning). The default syslinux.cfg includes root=/dev/sda3, so I just changed that to root=/dev/vg0/root. Most bootloaders allow you to modify the boot line before you actually boot into Linux if you forgot this step.

Tweak Arch

I'll leave you to install and configure the packages that you find useful. I plan on using my EeePC as a jump box into my home network, so it doesn't need a GUI of any sort. Just OpenSSH and some other goodies.

You might also be interested in my previous article about bonding eth0 and wlan0 now that you have Arch on your EeePC though!