July 1, 2009

Emergency Operations With A Live Linux CD

Having a seemingly non-reproducible disk error can be a real heart-breaker. Lost work, multiple fsck.ext3 exercises, and frazzled nerves were common for those agonizing couple of days. The adventure began with my recent upgrade to Jaunty 9.04. Couple that with my dubious decision to experiment with the Compiz eye-candy package along with the upgrade and you can see where this was going.

It's kind of like being a pilot who suddenly insists on enhancing the control panel or hot-rodding the engine--while the plane is flying through a thunderstorm. Don't laugh, I know many of you are also secretly guilty of the same computationally questionable behaviors. Fortunately, we almost always seem to get out of our scrapes.

Today's article will explore getting set up to do regular day-to-day office type work operations, when immersed in one of those sticky situations. Your Windows machine may have gone belly up, your disk may be acting flaky, or you might be working remotely on old scrounged-up, cobbled-together hardware.

Just confidently whip out your live Linux CD and get 'er done.

Prep Now, Calm And Cool Later

figure1.pngMany Linux distributions will run in live CD mode. Simply put the CD in the tray and reboot. After the disk spins around for a couple of minutes, a desktop window manager will appear on the screen and you can get started. I even wrote part of this article after removing the SATA drive from my laptop. Check out Openoffice.org, Firefox, and the system monitor running on my disk-less, live Linux Asus laptop in Figure 1.

The first step in getting ready for your next inevitable emergency is to choose, download, and burn a suitable version of Linux.

Kubuntu, the KDE Ubuntu Linux variant was my choice for quite a while, because I liked all the built-in features of that desktop manager. I currently prefer Xubuntu, which is a Ubuntu Linux variant that uses the xfce desktop. xfce is nice because it starts up quickly and provides all the functionality I need, while keeping the desktop slim and easy to use. For me, KDE has grown larger and more complicated over time. Even though my Asus laptop is scary fast, I wanted to simplify my desktop experience. Xubuntu works well running from a hard disk or from a live CD.

Don't let my preference deter you from using another live CD, like Kubuntu. KDE runs well from the CD. Choose straight Ubuntu if you like the Gnome desktop. Yup, it runs in live CD mode, too. I have used the Mepis distribution and it is a solid, functional system that could suit your needs. And, we certainly shouldn't forget the grand daddy of all live CDs, Knoppix.

A relatively simple desktop, like xfce, brings another advantage when running in "emergency" mode. It looks the same whether I'm happily clicking along from a healthy disk drive or functioning from the live CD...just a little difference in speed when starting up applications.

One thing I should mention is that you may have to juggle bios settings to get your machine to run right. In the case of my Asus laptop, I had to switch the SATA driver to "compatible" and change the boot order to "first boot - CD/DVD" before I could use a live CD. In a nutshell my disk error problem turned out to be driver related. My disk controller works fine for the SATA hard disk when set to "enhanced", but then the IDE CD/DVD drive croaks. When I set the driver to be "compatible" automatically using a different driver, the CD/DVD works great, but the SATA drive coughs up disk errors left and right. You might need to play around with your settings, just so you know.

Getting your desktop up on a gimped laptop is half the battle. The other half, of course, is getting to and accessing your data.

Where's My Data?

It is always good to regularly use some type of backup scheme. Daily, weekly, and monthly are a good idea. I like to save important working files, like my article drafts on a USB stick. And, of course don't sit there and type three hours worth of text, without saving at least ever ten minutes or so.

Say that you have disk errors and your laptop won't boot. Pop in the live CD and give it a try. Chances are that "most" of your data is safe and you will be able to retrieve and use it. Some live Linux desktops will recognize the partitions on your hard-disk and assign mount points for them. If not you may have to mount them manually.

Check to see what disks are available. On a terminal screen type:

  rreilly$  sudo fdisk -l

You'll get a list of internal, external, USB, and card slot media that are attached to your machine. The following shows my internal SATA disk.

Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x97646c29

Device Boot Start End Blocks Id System
/dev/sda1 * 1 6079 48829536 83 Linux
/dev/sda2 6080 38913 263739105 5 Extended
/dev/sda5 6080 12158 48829536 83 Linux
/dev/sda6 12159 24316 97659103+ 83 Linux
/dev/sda7 24317 24802 3903763+ 82 Linux swap / Solaris
/dev/sda8 24803 38913 113346576 83 Linux

The external, USB, and card type media will generally be auto-detected, while internal drives are not and that's why fdisk is helpful.

Mounting the internal disk is pretty easy.

 rreilly$  cd /
rreilly$ sudo mount /dev/sda8 /mnt

/dev/sda8 happens to be where I keep my regular rreilly home directory and files. You might have to fish around to find your files, if you are not familiar with your file system. You can mount multiple partitions by going to the root directory and make some new temporary directories such as mnt2, mnt3, etc. Then just mount them.

     rreilly$  sudo mkdir /mnt2
rreilly$ sudo mkdir /mnt3

rreilly$ sudo mount /dev/sda2 /mnt2
rreilly$ sudo mount /dev/sda3 /mnt3

After you've mounted your drives, it might be a good time to do a quick backup. For fast emergency backup of a lot of data, it's hard to beat the modern external USB drives. A 500 GB Western Digital will run less than $US 90. A 1 TB will cost you about $US 130. With Xubuntu you can just plug the drive into the USB port and the Thunar file manager will come up and show the directories on the drive. Be aware that off-the-shelf external drives are generally formatted to work with a Windows machine, so all the files you copy there will belong to root. After drives are mounted, their names and mount points can be checked with df.

     rreilly$  df -h 

When finished working with the disks, they can be unmounted too.

    rreilly$  sudo umount /dev/sda8 

Now that we have the machine running and the disks are accessible, all that's left is to fire up your applications and get working.

Using Live Applications

When you get in a spot and you need to get work out, the first thing to do is take a deep breath and gather your thoughts.

The Xubuntu live CD has a good basic set of applications that appear under the Applications tab, after the machine is up and running. It includes the Synaptic package manager, Firefox, Abiword word processor, Gnumeric spreadsheet, various system and network tools, some media players, and a bunch of general purpose productivity programs.

You can also load additional programs, such as Openoffice.org or Kompozer, using the Synaptic package manager. Be aware that in Xubuntu, the added programs will only be there until you reboot. I know it is a small inconvenience. Remember that we are talking about temporary, emergency operations, perhaps without even having a working hard disk.

Take heart though, some live CDs will actually save your sessions and applications across reboots. I'd just leave the machine powered up during the duration of my temporary usage. I probably wouldn't load on things like the Compiz composite window system, so I could spin my desktop around a cube or a bunch of media applications. I'd probably skip big system updates, except the security ones, of course. Emergency operations are generally bare bones, get it done fast times. But, hey, it's up to you to decide your needs.

Some applications will also need network access. Xubuntu's network manager will show available wifi networks and connect automatically to a wired Ethernet connection. Left click on the network manager, on the upper right part of the task bar to get a list of wifi connections. Click one you can access and you should be good to go.

One last thing I want to mention, is that familiarity with the topics discussed, will go a long way toward calming your nerves when the chips are down. Rehearse possible scenarios with your work process, so you know what to expect when running on a live CD.

Wrap Up

Live Linux CDs give you the capability to get critical work out the door, when bad things happen to your computer. All you need is your favorite live Linux version and a working CD drive. Take a little time to explore using live CDs and I think you will see that your practice and preparation will be time well spent, when it really counts.

This e-mail address is being protected from spambots. You need JavaScript enabled to view it
is a consultant and well-known technology writer. He seeks interesting new writing and seminar projects and delivers exceptional value to his clients. Visit his Web site at http://home.earthlink.net/~robreilly.


Click Here!