Recover data with Linux

Step 1
If you have a broken Windows or Linux installation, these simple steps can help you recover it

When you're used to the world of Windows or OS X, Linux can seem a little unforgiving.

Not only does command-line access hand over the complete keys to the manor to any unwitting user with access to the administrator's account, there's rarely a safety net should things go wrong.

Despite advances in most Linux desktops (where the ubiquitous Trashcan safely buffers deleted files), you get no such protection from most system specific configuration, installation and maintenance tools.

And while it's rare for anything to go wrong without your direct input, some accidents do happen, especially if you enjoy tinkering with the latest distro release each month.

But this being Linux, there's plenty you can do to dig yourself out of a hole, which is why it's always a good idea to have a repair-worthy distribution close to hand when performing configuration and installation tasks.

One of the best developments in recent years has been the Live CD. These offer a fully functional Linux installation that runs from an optical drive. If you've got enough memory, you can even install new packages to the RAM disk just as you would when completing a standard installation.

This makes a recent release of a Live CD-based installer like Ubuntu Jaunty the perfect system recovery tool. Not only does it include every package you might require, but because it runs from the optical drive rather than the hard drive, your data isn't touched and there's no chance files will be overwritten without direct input. It's the obvious place to start when you get stuck.

1. Booting Linux

Probably the most common problem is when the Linux boot menu disappears or gets corrupted. The most likely reason for this is that a shared Windows installation has re-stamped its authority over your disk's master boot record, overwriting the Grub boot loader with its own system launching code.

In these cases, you need to boot into a different Linux environment, either off a Live CD or from any other Linux booting media you can get hold of. The distribution you choose will also need to have Grub installed.

With Ubuntu, open the Terminal from the Accessories menu and type sudo grub. This will launch the boot loader with administrator privileges. From the 'grub' command prompt, type find/boot/grub/stage1. This Grub function searches every compatible drive attached to your system for the '/boot/grub/stage1' file, which is used to launch the operating system.

Step 1

GETTING GRUBBY: The command line can seem daunting, but it's really not

When the file is detected, it'll output the drive and partition number of your lost installation using the format (hd1,0). Your output will look different, but it's the drive number followed by the partition number of the Linux partition that you're looking for.

Grub should only be installed on a single partition on a single drive, so you shouldn't find more than one version of the file. To restore the Grub bootloader to your drive, type root (hd1,0), swapping the drive and partition number with the output you found with the previous 'find' command. Then type setup (hd1), swapping 'hd1' for your drive number.

You should now find that your Linux partition and booting ability has been restored. The only potential problem is that this process could overwrite a Windows bootloader, and if Windows was installed after the original Grub installation, it won't launch from the boot menu.

2. Booting Windows

Fortunately, adding Windows to your Grub menu is easy enough, and it's straight forward to add any other OSes you want to boot from your system if you've got an example entry to work from. The key to the boot menu is a file called '/boot/grub/menu.lst', and if you open this in a text editor, you should see that the formatting is relatively easy to understand.

For instance, here's a typical entry for booting a Windows installation off the first partition of the drive:

title Microsoft Windows
root (hd0,1)
makeactive
chainloader +1

You can make this Windows boot entry the default selection by adding a line that has 'savedefault' as the only word.

Step 2

PLAIN TEXT: The formatting of 'menu.lst' is fairly straight forward and easy to understand

Adding Linux entries isn't quite so easy, as you need to get the path to both the 'initrd.img' (RAM disk) and 'vmlinuz' (kernel) files correct, according to how they sit on the Linux filesystem. The best way is to copy and paste an existing entry and change the paths accordingly.

Older versions of Grub won't support newer filesystem types. ext4, for instance, is a major upgrade to the standard Linux filesystem and it needs a specially modified version of Grub to boot into it. This could cause a problem if you installed a new Linux distro using ext4 alongside an older one with its older version of Grub.

The only option in this case is to upgrade Grub, either manually or through a distribution that ships with the modified Grub, such as Ubuntu Jaunty.

Latest in Software
A close up of The Daily podcast from Pocket Casts' web page
‘Podcasting shouldn’t be locked behind walled gardens’: Pocket Casts slams Spotify and makes its web player free to all
Voice cloning
I cloned my voice in seconds using a free AI app, and we really need to talk about speech synthesis
Google Gemini AI logo on a smartphone with Google background
I made an AI version of Bilbo Baggins using Goggle Gemini for free, and shared a pipe with him outside Bag End – here’s what you can now do with Gems
Gemini 2.0
Gemini Deep Research just got even smarter and it’s now free for everyone to try - here's why you should give it a go
Google Gemini with Search history access. Image says "Get help from AI that gets you"
Google just gave Gemini a superpower by allowing it to access your Search history - here's why I'm excited and also a little terrified
Printer
No, your printer isn't possessed: a Windows 11 23H2 bug could be making it print random characters when connected via USB
Latest in News
An image of the Samsung Galaxy S25 Ultra from a hands-on event
Samsung Galaxy S26 Ultra could resurrect an intriguing camera feature
Cristin Milioti in Black Mirror season 7
Netflix launches trailer for Black Mirror season 7, giving us a look at its first-ever sequel episode and an unexpected returning character
A graphic of the PC Gaming Show
Get ready for a bounty of PC games on June 8, as the PC Gaming show is back
A close up of The Daily podcast from Pocket Casts' web page
‘Podcasting shouldn’t be locked behind walled gardens’: Pocket Casts slams Spotify and makes its web player free to all
A smartphone on a sofa showing the WhatsApp, Telegram and Signal apps
Forget AI – WhatsApp is planning a simple messages feature that could be its most useful upgrade in years
NordicTrack Ultra 1
The new NordicTrack Ultra 1 treadmill looks like it was designed by an architect and costs $15,000