By Kevin Purdy, Lifehacker – March 30, 2010 at 12:00PM
When Windows goes wrong, it can go really wrong. Worse: Often it’s extremely difficult to save your system from Windows itself. Here’s how to use a simple USB drive to free space, remove viruses, rescue passwords, and more from crunked Windows setups.
Photo by *manci*.
What You Can Fix with this Method
If you or your in-need friends or relatives can’t boot into your Windows desktop, or you can’t actually do anything once you’re into it, booting up a live Ubuntu system from a USB thumb drive, or off a burned CD, can save your system, recover files, and pull off other miracles. Here’s the short list of things we’ll cover here:
- Clean a virus with a Linux-based anti-virus app.
- Recover files and save them onto that same thumb drive, to a web storage spot like Dropbox, or to another USB drive.
- Change your login password if you’ve forgotten it, or someone’s changed it on you.
- Analyze your hard drive to figure out what’s filled it, and resize partitions if you’re dual booting and need to free up more space.
What you’ll need
-
Empty USB drive: Sometimes called a “thumb” drive, a “flash” drive, or a USB “stick.” It’s a tiny little piece of plastic that usually holds at least 1 GB, and that’s the minimum size you’ll need. If you’re looking to recover files, you’ll need to use a separate USB drive, blank CDs or DVDs, or an online backup service. The drive you intend to install Ubuntu on should be empty, because it will get cleared out when we make it boot-able. Photo by robertnelson.
Alternate: CD-R Using a USB drive gives you faster performance when booting a system like Ubuntu without installing it. If you don’t have a large enough drive to spare, or you’d like to save your USB drive space for backing up your much-needed files, you can still grab a recordable CD and create a “Live CD” to boot from. If that’s the case, skip the section about making a USB stick and head right to the “Boot Up and Get Started” section.
-
A working Windows computer with a decent net connection Because you’ll need to download a 700 MB file to install onto your USB stick, and a 4.3 MB application to make it work. That application, though, doesn’t have to be installed, so you can easily clean up after yourself if you’re using a friend’s computer.
Alternate: Mac options: You can create an Ubuntu USB stick from a Mac, but it requires both tricky, theoretically harmful Terminal commands and administrator access. If that’s not your thing, you can simply burn a live CD from a Mac.
Make Your Live CD or USB Stick
Turn on your working Windows computer, make sure it’s connected to the internet, and open up a browser. Head to UNetbootin’s home page. Click on the Windows icon at the top to download the latest version of UNetbootin—here’s a direct link for those following this guide on their monitor.
Once you’ve downloaded the file (unetbootin-windows-latest.exe
), find it and double-click it. Windows will likely confirm that you want to do that, and you should say it’s “OK.” You’ll see this when UNetbootin opens:
What UNetbootin was made to do was automate the process of downloading an Ubuntu CD image, convert it for your USB thumb drive, find that drive, and install that image on there, without you having to do much of anything. It does this job well, and doesn’t make you worry about accidentally wiping out some other drive. Still, when you’re about to run UNetbootin, you should make sure no other USB drives are plugged in, except the one you want to turn into a system rescue stick. That said, make sure your USB stick is plugged in, and soldier on.
Click on the drop-down menu in the “Distribution” category at the top, which should also have a filled-in point to the left to indicate it’s selected. Scroll down in that menu and click on “Ubuntu.” To the right of that menu, there’s another where you can choose the version of Ubuntu you want to download. At the time of this post, 9.10 Desktop is the latest stable version of Ubuntu that’s released, just above “Daily Build” options for 10.04. In any case, you should select the “Desktop” version that’s highest in number, without choosing a “Daily Build” that will likely have missing features or unfamiliar aspects. With that distribution and version selected, UNetbootin will get to work downloading, right after we’ve confirmed the USB drive and hit OK.
Alternate option: BitTorrent: If you’re savvy in the ways of torrent downloading, you can likely get a faster download, and relieve Ubuntu’s servers, by grabbing a desktop ISO file over an official torrent, then setting UNetbootin to use that ISO file by selecting the radio button next to “Disk Image,” hitting the “…”/browse button to the right of that option, and pointing at the ISO file when it’s finished downloading.
Before you click OK and let UNetbootin set up your USB drive, triple-check that it knows which drive to transform. You’ll see which drive it wants to format to the right of “Drive:” at the bottom of UNetbootin’s window. Hit your Start menu, click Computer in the right-hand menu, and ensure that the letter your computer has given your temporary USB drive is the same letter that UNetbootin wants to use. If the two are matched up, you can head back to UNetbootin and click OK.
Alternate: Usbuntu Live Creator: Usbuntu is a similarly easy to grasp USB creator, made particularly for Ubuntu USB creation, and lets you create USB disks with persistent storage—meaning you can keep files on your system that stick around the next time you boot up, so you can use a very large USB drive as an actual backup location.
Nine times out of 10, UNetbootin won’t need any help or spit any errors. If it does, it’s likely because a download connection isn’t available, the file that did download became corrupted, or your USB drive has a quirky boot/format problem. I’ve covered at least one common fix for USB stick booting issues under the “Fix booting problems” header in a previous Linux-on-USB feature. If your error falls outside of that, try searching out the specific text in the error message on Google.
Once it’s done, UNetbootin will ask you to restart your system. You don’t really need to do that—you want to save your non-booting or crippled computer, not this one.
Boot Up and Set Up Ubuntu
Assuming all went well with UNetbootin’s USB formatting, you can pull out the USB stick (or CD-R) from the working computer, load it into the busted computer, and fire it up. If you’re lucky, the system was set up to automatically look for bootable USB devices and load them up, and you’ll see a screen that asks you, in old-school, lo-res computer graphics, if you want to boot “Default” or otherwise. Go ahead and hit Enter, and you’ll start booting into the Ubuntu desktop.
Nothing happening? Does your system just roll right into its busted Windows desktop? You’ll likely need to head into your BIOS settings and ensure that USB booting is enabled, and/or “ranked” above the hard drive as a boot option. When your computer boots up, there will likely be text on the screen stating that hitting F2, the Delete key, or another button will let you enter “system setup,” BIOS, or something similar. Hit that key when you first boot up, dig around in the menus, and change your setup so that your computer searches out USB drives before heading to the hard drive.
Your system should boot into an Ubuntu desktop, where you’ll see one or two icons, two toolbars, and not much else. The first thing you want to do is give Ubuntu an internet connection, so we can grab programs and files we need for our fixes. If you’re using a physical ethernet cable, or even most cellular 3G modems, ensure they are plugged into your laptop or desktop, and you should be good to go. If you’re using a wireless network, click on the tower/broadcast-looking icon in the upper-right corner.
Choose your Wi-Fi network, enter your password, if there is one, and you should see your system connect. If you’ve got a hidden network that doesn’t broadcast its name, there’s an option for accessing that, too, below your neighbor’s Wi-Fi names.
One last thing you must do before venturing forth is tell Ubuntu that it’s okay to download applications that aren’t entirely “free” in the software/copyright sense. Annoying, yes, but that’s how a free-as-in-speech desktop works. Click on the System menu in the upper-left corner, mouse down to the Administration section, and then mouse over and down to the “Software Sources” option.
When it opens up, you’ll see that all the options in the first tab, Software Sources, aren’t checked. Go ahead and check them, then hit the Close button. You’ll be prompted to Reload your sources, so go ahead and hit the button to do so. Ubuntu now has access to a lot more software, including some applications we’ll want access to.
Now you’re ready to get started backing up, scanning, freeing up space, and resizing your Windows installation.
Make Your Fixes
Retrieve and back up files: We’ve hit on the idea of Ubuntu as a Windows file saver before, in a guide to fixing your relatives’ terrible computer, and the practice remains the same. With Ubuntu loaded as a “live” system, you should see your Windows partition listed under the “Places” menu—perhaps as “120 GB system,” but it’s still there. Click on it, and Ubuntu will load up access to that drive, and you should see a window with the usual Windows files—Program Files, Windows, Users, etc. Plug in a USB drive, or load in a blank CD or DVD, and it’s a simple drag-and-drop matter to get your files onto those backup mediums. Be sure to hit the “Burn to Disc” button when you’re done backing up to physical discs.
Want to use an online service like Dropbox? You can do that, but make sure you’ve got a broadband connection—uploading on most residential accounts can be a long wait, especially with big batches of files. You can upload files to Dropbox’s web interface using the Firefox browser built into Ubuntu, but without Flash installed, you can only do one file at a time. To get around that, you can click-and-hold to select multiple files on your Windows system with the mouse, or hold the Control key to click and select folders and files. When you’ve got them all picked out, right-click on any one of the selected files and select “Compress.” Click the file type selector to the right in the dialog box that pops up, and change the compression from a .tar.gz file to .zip, and save it to the Desktop. Now you can select the “Basic Uploader” in Dropbox, or most other online sites, and upload those files as one big, slightly smaller package, to be unpacked back into Windows later.
Scan and fix viruses: Ubuntu doesn’t have a built-in tool for scanning Windows drives for viruses—and why would it, really?—but they are available for installing. Since we’re running a live session of Ubuntu, “installing” just means downloading and saving to temporary space on our USB drive, leaving your Windows drive untouched, and preventing viruses from interfering with the scan-and-fix process.
Head to your System menu, mouse down to Administration, and select the Synaptic Package Manager. Hit the Search button on the far right, type in clamtk
, and then check the box to the left of the result that comes up. This is the Linux version of Clam AntiVirus, or ClamAV, that’s a popular, free virus scanner, and clamtk
puts a graphical face on ClamAV, rather than making you learn how to use it from the command line. Even if Clam can’t fix your particular Windows virus from Ubuntu, it will at least identify it, and give you the means to Google that specific bug and see if there’s a fix.
Hit the Apply button after confirming that you want to install clamtk
and all its “dependencies.” Close down Synaptic when it’s done installing, then head to your Applications menu in the upper-right corner of your Ubuntu desktop. Mouse down to the System Tools menu, where Clam should appear as an option. When it first starts, it will ask you how you want to apply signature updates—ignore the complexity of all that text, hit “Single User,” then hit Quit to move on.
When Clam loads, you’ll see options for scanning a File or Directory. Check the box to the left of the “Recursive” option, so that Clam will dig into all the sub-folders of your Windows drive. Now hit the Directory button. In the file chooser that pops up, look for your Windows system in the left-hand sidebar and click it. If you see your familiar Windows folders in the right-hand pane, you’ve got the right one. Hit “Open,” and, honestly, expect your system to hang for a bit.
Your system will hang because, basically, an operating system running off a thumb drive is using all its might to scan your entire Windows hard drive space and figure out what needs to be scanned. The freeze-out and lag should only last a few minutes on a modern system—if you see error messages, or nothing’s happened for 20 minutes, you might have to give it another go, or try a different anti-virus app—the gHacks blog has a few recommendations, including Avira. Otherwise, you can make yourself a sandwich, and probably crack a beer/soda, as Clam runs through your Windows files and checks for viruses. As mentioned above, it might not always be able to fix or properly quarantine your files, but you’ll at least know exactly which virus you’re dealing with, and can Google steps on fixing it manually—right from Ubuntu, actually.
Change or wipe a Windows password: Just like you installed Clam to scan for viruses, you can install a little open-source utility, chntpw
(as in Change NT Password) to clear out a Windows password you can’t remember, or change a password you feel is insecure. After searching and installing chntpw
from Synaptic, open up the Places menu from your left-hand menus. Head into Windows, and navigate to Windows\System32\config
—where the SAM file is kept. Hold down your Shift key and right-click somewhere inside that config folder, then select “Open Terminal Here.” From that terminal, you can type in this command to change the main administrator’s password:
sudo chntpw SAM
If you’re looking to change Samantha’s password instead, type something like:
sudo chntpw -u Samantha SAM
You’ll see some options you can type in, from 1-4, but you’ll generally want to stick with “clearing” the password, then changing it when you head back into Windows. It’s been reported to work with XP and Vista, and I tested it out on Windows 7 and had success clearing a standard user’s password.
Shrink or create new partitions: Gina’s already covered the ins and outs of GParted, which you can get to in your live Ubuntu system by hitting up the System menu, the Administration option, and then clicking “Partition Editor.” Adam’s also shown his GParted skills, using a similar live CD, in his guide to dual-booting Windows 7 with XP or Vista. Don’t commit anything you’re not sure of, but know that you can pull off most anything you need from GParted.
Visualize your hard drive and clean it out: Under the Accessories menu, beneath Applications, you’ll find Disk Usage Analyzer, an awesome program that you can use to see where all the space on your Windows drive is being taken up. I needed this tool recently when Windows 7 had become so stuffed (with a failed DVD rip) that it was almost inoperable. To use it on a Windows installation, click the “directory” button in the middle row, and in the file browser that pops up, click on your Windows drive/partition in the left-hand column and hit “Open.” Give it a few minutes, and you’ll get both a spiral chart and nested lists of what’s taking up space. Right-clicking any folder or files gives you the opportunity to open them up in a file browser, or delete them directly. As you might guess, you should be careful with Windows and Program Files stuff, but the rest is up to you.
All done? Simply shut down your system from the “ubuntu” user menu in the upper-right corner. Nothing was actually touched on your system, unless you specifically deleted or changed files, and when you reboot, you’ll have a chance to get reacquainted with your hopefully fixed system. Remember to remove your USB drive from its port before rebooting.
Those are our tips on what can be done with a live Ubuntu stick. Got your own? We’d love to hear them in the comments.