Archive for the 'Miscellany' Category

Note: I've reorganized this site to use tags; the category archive remains to support old links. Only posts prior to April, 2006 are categorized. Tag Archive »

HOWTO Recover Files from a Non-Bootable Windows PC using Ubuntu Live

Update: fixed typos in steps 3 & 8.

My preaching the joys of Mac to all my coworkers has claimed another victim; John, who I share my office with, purchase a shiny new 20″ iMac G5 two days ago. John asked me for a way to get some files off his old Windows PC without booting Windows, because his Windows install is very flaky, and doesn’t like to boot anymore. I developed the following procedure using a Ubuntu Live CD.

This wasn’t as easy as I’d expected. Ubuntu Live is great, but it’s not designed for system recovery. I had 2 yr old copy of Knoppix in the office, but I couldn’t get everything working, so I tried a brand new Ubuntu Live CD. With a little work I got things going.

The Premise: Boot a Windows PC using a Ubuntu Live CD. Mount the Windows drive and share it using Windows File Sharing (aka Samba). I chose to share with Samba because just about everything can be a client. Windows, Mac OS X, and most Unixen/Linuxen can retrieve files from Samba shares.

The Requirements: Ubuntu Live CD, network connection between the unbootable machine and the machine that will recover the files, and a live internet connection (proxied is ok). The internet connection is required because the Live CD is missing a key piece of software, which we can get with a net connection. Other LiveCDs may not have this restriction (a recent Knoppix, perhaps, but that’s another HOWTO). Note that if your recovery system is a Mac, you don’t even need a router/switch to connect the machines… the Mac’s ethernet port is auto-sensing, and will reverse directions if connected to a PC’s ethernet card with a standard RJ-45 cable. Sweet.

The Steps:

  1. Boot from a Ubuntu Live CD. This method was tested with Ubuntu 5.10 “Breezy Badger”. It should work with Ubuntu 5.4, “Hoary Hedgehog” as well, although I have not (yet) tested this.

  2. Open a Terminal window. From the menus at the top of the screen, choose Applications | Accessories | Terminal.

    Terminal Window Screenshot

  3. Now we need to create a mount point for the Windows drive. We’ll use the traditional location of /mnt.

    cd /mnt
    sudo mkdir windrive
  4. Run the Ubuntu Disks Manager. From the system menu bar, choose System | Administration | Disks. In the Disks Manager, find the Hard Disk icon that represents your Windows drive. It is usually /dev/hda. You may see other Hard Disks that you don’t recognize, these are virtual devices created by the LiveCD.

    Disks Manager Disk List Screenshot

  5. On the partitions tab, locate your Windows partition. For many systems, there will be only one partition to choose. The Partition Type should be (something like) NTFS, FAT, or FAT32. In the Access Path text box, enter /mnt/windrive. Make a note of the “Device” value. In the example below (and on many machines), its /dev/hda1. Click Enable.

    Disks Manager Partition List Screenshot

  6. Return to the terminal window. Type mount and press enter. In the output generated, look for the device name from the last step, and note the value after the word “type”. Pay special attention to spelling, case, etc. In the example below, our device /dev/hda1 has a type of ntfs.

    Checking Partition Type Screenshot

  7. Although the windows drive is now mounted, we can’t use it yet to share, because it’s only accessible to the root user, due to the default mount behavior for Windows drives. We need to remount the drive ourselves and override this. First, return to the Disks Manager, and Click Disable. Close Disks Manager.

  8. In the terminal window again, mount the drive manually. Be sure to substitute your device name if it’s not /dev/hda1, and to substitue your filesystem type, if it’s not ntfs. The ls command should show you the contents of your Windows drive.

    sudo mount -t ntfs /dev/hda1 /mnt/windrive -o "umask=022"
    ls windrive
  9. So far, so good- we can read the contents of the Windows drive as the default user (named, oddly enough, ubuntu). Now we have to enable Windows File Sharing, aka Samba. The bad news is, the LiveCD doesn’t include the smbd, the Samba Daemon. The good news is, you can install it automatically, and in memory (since we’re running from CD). If you access the web via a proxy server, step 10 is for you. If not, skip ahead to step 11.

  10. (Proxy users only) We need to tell Ubuntu’s package system how to use your proxy to access the Internets. From the system menu bar, choose System | Administration | Synaptic Package Manager. From Synaptic’s menu bar, choose Settings | Preferences. On the Network tab, enter your proxy settings. Click OK, and quit Synaptic.

    Synaptic Network Preferences Screenshot

  11. From the system menu bar, choose System | Administration | Shared Folders. The Shared Folders app will start, and warn you that no sharing services are installed. Check the box for Samba, and click Apply. An installation progress dialog will appear; when the installation is complete, you will see the message “Changes Applied”. Close the dialog.

    Sharing Services Dialog Screenshot

    Installation Dialog - Changes Applied Screenshot

  12. In the Sharing window, choose Add. In the Share Folder dialog that appears, change the path to /mnt/windrive. Set the name to Windrive, and check the “Allow browsing folder” box. Click ok.

    Share Folder Dialog Screenshot

  13. We’ve told the system to share the Windows drive via Windows File Sharing, but Samba will prompt for a user name and password that don’t exist. Let’s fix that. Return to the terminal window, and run a couple of commands. After the first command, you’ll be asked for a new SMB password. This is the password you’ll use from another computer to access the share. Use something you’ll remember, this is just a temporary hack. I used ‘test’.

    sudo smbpasswd -a ubuntu
    sudo sh -c "echo 'ubuntu=\"ubuntu\"' > /etc/samba/smbusers"

    Samba credentials commands Screenshot

  14. We’re ready to test. The easiest way to connect to your machine is using the IP address. You can check your IP with the ifconfig command. Look for a line that begins “inet addr”.

    ifconfig Screenshot

  15. Test it! From Windows, you can use Start | Run… and enter “\\windrive” (change the IP, of course). When prompted for credentials, user name is “ubuntu”, password is “test” (or whatever you used in step 13).

    Windows Run Dialog Screenshot


You can now access the files on the Windows drive of the PC running Ubunutu Live. I’ll try to get a Mac OS X screen shot up later.


I almost never link and run, but this was just too good. Software geeks, enjoy your moment while you can. The Day of Reckoning is at hand.

P.S. If you have been living under a rock don’t know who Blake Ross is, here you go.

Update: The post seems to have been removed. Shame.

I Like Pie

Even though this is completely the wrong time of year for this, I’m posting this recipie for pie crust, because it makes the best crust in the known universe, and because I just found the yellowing copy of the recipe that’s been lost to me for several years. So, for posterity:

Basic Pie Crust

Makes 3 single 8-9 inch crusts (use two single crusts for a double crust pie, such as Apple Pie)

  • 3 cups all-purpose flour
  • 1 teaspoon granulated sugar
  • 1/2 teaspoon salt
  • 2 1/2 sticks unsalted butter
  • 1/4 to 1/2 cup ice water

Place all ingredients in a large bowl. Cut the cold butter into small pieces, tabespoon-size or less. Using a hand-held pastry blender with bowed metal blades, cut the butter into the flour mixture or rub the butter into it by hand. Mix until it resembles coarse meal.

Add the ice water, two tablespoons at a time, until the pie dough just holds together. You probably won’t need all the water. Remember, the pie dough should not be wet and sticky. If it appears crumbly, add a little more water.

If using a food processor: Put all the ingredients, except the water, into the bowl of the machine and process until a coarse meal forms. Add the water, a little at a time, until a ball forms.

Now, gather the pie dough into a ball and place on a large piece of plastic wrap. Fold one edge of the wrap over the dough and flatten it out with the heel of your hand. Wrap the pie dough with the plastic wrap and refrigerate it for about 45 minutes to an hour.

After the pastry has chilled, divide it into three equal-size pieces. For a double-crust pie, let two of the pieces of dough sit at room temperature a few minutes before rolling each out. Flour the work surface and rolling pin as needed to keep the dough from sticking. Roll out the pie dough. Wrap and chill any unused dough.

Look Up

So yes, I’m back from vacation– have been for a week and a half, I just haven’t gotten back into the swing of posting yet. Dugh recently called me on it as part a post about astronomy software. This turns out to be an excellent coincidence, because I was away in Maine.

My father is from Maine, and I’ve been going there on vacation since I was a child. Maine is where my interest in astronomy was born. The skies on Mt. Desert Island are just incredible on a clear night- indescribable. Without the glare from polution and city lights, the sky is very dark- except for the countless stars. The Milky Way is so bright and packed with stars that you could mistake it for a cloud at first, until your eyes adjust and start resolving it into myriad distant stars. Every time I go back, all it takes is the first clear night to instantly rekindle my passion for the night sky. My brother-in-law, Bob, was with us for the first time (this was a big family vacation, 10 of us in all), and couldn’t believe the sky- he’d never seen anything like it.

While I was there, I visted Island Astronomy for the first time. It’s a small astronomy shop located in a family lighthouse. Visit the site, and you may recognize the picture- it’s very highly photographed. The shop’s owner, Peter Lord, is a great guy. I really enjoyed talking to him. Of course, I didn’t escape unscathed. Although I got an 10″ Dobsonian a last year for my birthday, I never have a scope in Maine because the Dob is too large to travel with. I solved this problem by buying an Orion 90mm Maksutov-Cassegrain from Peter. It’s a small scope, but perfect for travel. I got some great views of Jupiter with it after the fireworks on July 4. Island Astronomy also has viewing sessions and workshops for novices- If you visit Bar Harbor (or anywhere else on MDI), be sure to take a trip to Bernard on the quite side of the Island and check out Island Astronomy.

In my comments on Dugh’s post, I mentioned that the best way to learn the constellations, named stars, etc., is a good book and a clear night. Even in areas without the spectacular views of Maine, you can learn about the sky just by looking. This time of year, the Big Dipper (part of Ursa Major) is high in the northern sky and easily identified. With a little knowledge, this familliar sky sight is your signpost to the North Star (Polaris), the Little Dipper, Arcturus (brightest of the Summer stars), Spica (another bright star), as well as the circumpolar constallations such as Draco, Casseiopia, and Cepheus. Also easy to find are the three stars of the Summer Triangle – Vega, Deneb, and Altair, as well as their constellations Lyra, Cygnus, and Aquilla.

For a great guide to learning these and more, check out H.A. Rey’s classic The Stars: A New Way to See Them. If the author’s name seems familliar, it is – he’s the author of the Curious George books. And yes, he illustrated The Stars. For something with a bit more info, I’d never give up my copy of National Audubon Society Field Guide to the Night Sky – it’s a great, highly portable guide.

However you like to enjoy the night sky, make sure you do so from time to time. Just go out, and look up.

Foggy Harbor

Still on Vacation. For now, enjoy a picture.

Foggy Harbor

Shot with my Kodak DX3900, in native b&w mode.