So you're switching from Windows to Linux? Great. Like other users and organisations who've taken the plunge, it's likely you're making the move to take advantage of Linux's stability and reliance on open standards. Now all you have to do is prepare carefully for your move.

In this case, careful preparation means not just installing Linux on your system - either on your existing computer or a whole new machine - but also transferring your documents, bookmarks, preferences and system settings, and in some cases finding equivalent open-source applications for the Windows applications you were using before.

The Linux installation process itself varies widely between distributions, so if you don't already have some knowledge of the same, put this article aside and get familiar with that process first. Even though it's a lot easier now than it's ever been, it's hugely useful to be as familiar as you can with the setup process. That way you can best plan how to migrate your data and user settings and not be caught off guard.

Three roads to data migration

There are three basic approaches you can take in migrating your user settings and data from Windows to Linux:

  • Let Ubuntu Linux do it for you. Ubuntu is one of the most popular Linux distributions out there and, as of right now, the only major distribution that has migration tools built in as part of its setup process.

  • Use a third-party application.

  • Do it yourself.

The last option obviously requires the most expertise of the three, but it also gives you the most flexibility, since you're essentially writing (and punching) your own ticket.

Speaking of maximum flexibility, the work described here is a lot easier if you are migrating to an entirely new PC that has a Linux installation, rather than changing operating systems on an existing PC. With a new machine, you can leave everything exactly as it is on the old system more or less indefinitely. If you must run Linux on the same machine that currently runs your Windows, it's doubly imperative that you back up all your data before you migrate.

But first, back up

Whatever approach you take, the very first thing you should do before attempting a migration is make a full backup of any data that you can't replace. If you choose to migrate documents into new formats, keep the unchanged originals - if a particular document can't be converted correctly now, you'll always have the original to refer back to.

Make your backup in a format that is as platform-neutral as possible, and make it to a device that can be read by either platform. That way, if you later have to restore something on either Windows or Linux, you won't run into any unexpected hassles.

The simplest way to do this is to just copy the files as is to another disk that can be mounted in Linux. Most Linux distributions can now read the FAT32 or NTFS disk formats natively, so you could copy your files to an external hard drive formatted in Windows with either of those file systems, which will then allow you to read the data back easily in Linux. I recommend using NTFS as your target partition type if you're copying from NTFS to begin with, since FAT32 can't support individual files larger than 4GB.

One way to do this is to make a .tgz or .zip archive of the original data to be saved, which you can accomplish with most common archiving utilities. On Windows, 7-Zip has been my favourite choice for a while because it's both free and open source. If you choose to use it as well, use the .zip or .gzip/.tar file formats with the program, not its own proprietary .7z compression format. A Linux version of the program, p7zip, also exists, but since every Linux distribution out there has some way to extract .zip and .gzip archives, those formats are the way to go.

Incidentally, the more stuff you have to move from one platform to the next, the more you may want to reconsider how you store things to begin with. If you're taking the time to migrate to a whole new operating system, maybe now is a good to rethink how you structure your storage. Hard disks have become cheap enough that keeping data entirely segregated on a second drive is no longer an unprecedented concept, and it may save you a lot of work in the long run. (In my own case, I have my personal documents on a second hard drive, separate from the OS installation, and a third drive devoted entirely to my music library.)

Let Ubuntu do it

Ubuntu Linux tries to make the migration to Linux as easy as possible by allowing you to automatically migrate user files and even some system-specific user settings from an existing Windows installation.

Right now, Ubuntu seems to be the only major distribution that has such tools as part of its setup process, though perhaps that situation will change as Linux grows in popularity. If you want to switch to Linux now, and you'd like your distro to help you with your migration, Ubuntu is your current best bet.

When you begin Ubuntu's setup, it scans all the available drives in the current system and looks for any Windows installations. If it finds one, it'll display all the users in that Windows installation and allow you to choose which ones to migrate to Ubuntu, as well as what types of data to copy over. The choices are not very granular - you can't elect which specific files to copy, for example, just general categories of files - but they're useful. You can choose your Internet Explorer favourites, for example, or your currently selected wallpaper, your avatar, and the contents of your My Documents, My Music and My Pictures directories.

Another nice thing about the Ubuntu upgrader: it works regardless of the source or destination of the data. If you have Windows on one partition or disk and want to install Ubuntu somewhere other than where Windows is right now, the upgrader will copy over any Windows settings and documents it finds (and/or you can tell it which files you want to move).

This way, the upgrade is completely non-destructive - meaning the original data isn't touched in any way. Ubuntu doesn't yet support switching to Ubuntu from within Windows - ie, where you'd boot Windows normally, insert the Ubuntu CD and start the switchover process there, rather than just booting the Ubuntu CD directly and beginning the switch that way.

If you're curious, you can read about the proposed future directions for Ubuntu's migration feature on the distro's wiki. Mozilla Thunderbird, for instance, is one of the third-party programs that the Ubuntu developers want to be able to migrate settings and data from in the future. Also on the drawing board is that ability to begin the upgrade process to Ubuntu from within Windows itself.

Use a third-party application

If you're using a Linux distribution that has no integrated migration tools and you're not comfortable with the idea of trying to move things around yourself, there are third-party utilities designed to alleviate a lot of the heavy lifting. However, be forewarned that these tools tend to be written for enterprise and corporate users rather than individuals - they're really geared for helping sysadmins with mass migrations.

MoveOver 4 is a commercial application that migrates all of the most important things - documents, look-and-feel settings such as wallpaper and fonts, user preferences like browser bookmarks and cookies, and so on. This takes a lot of the tedium out of migrating many of these things manually, especially things like network drive and printer mappings.

The big drawback to MoveOver is that the range of Linux distributions it supports is rather narrow. The program only supports Novell Linux Desktop 9 and Linspire Five-O as target distributions in the 4.0 version; Version 3 only supports the Sun Java Desktop System and Fedora Core 2.

That said, there's also an open-source branch of the product, OpenMoveOver, which consists of a community edition of the Linux-side components. These pieces can be used by developers to create migration tools for other distributions, so it's entirely possible that other distributions will be MoveOver targets in the future.

Another product is Alacos' Desktop Migration Agent, which migrates documents and a broad range of settings from Windows systems. It, too, is designed mainly for corporate migrations and not end users, but it does support a decent range of Linux distributions as migration targets: Red Hat Enterprise Linux, SUSE, Novell Linux Desktop and Fedora Core.

DIY

It's entirely possible to manually transfer all the data and settings from your Windows installation to your Linux installation.

If you're adding Linux to an existing machine, how you deal with your data will vary based on the exact migration process you're using. For instance, if you're overwriting your existing Windows partition, you'll need to back up all that material somewhere else (an external drive or another partition that won't be touched during the migration); if you're preserving the Windows partition for the time being, everything can simply be copied directly from there.

A majority of Linux distributions have some guide for how to manually migrate documents and application settings into Linux. Ubuntu, for example, covers most of the major points in its own documentation, including pointers on how to move mail from Outlook and Outlook Express into Thunderbird's mail format (which can be used as is in Linux).

Most Linux distributions place the user's files - documents, email, just about anything they create with an application - in a directory, typically named /home/. The exact hierarchy of subdirectories in that directory is generally up to the user. You could, for instance, manually create subdirectories named Movies, Documents, or Databases, and save the appropriate files into those directories.

Some applications also create their own hidden directories within your /home directory to store user-specific data - Firefox, for instance, creates a directory named /.mozilla/firefox. But there's little chance that the name of any directory you'd create would collide with another such directory (and if it did, you'd be warned about it).

Moving everything over manually is not too difficult if most of the data you work with is not intimately associated with your Windows installation. For instance, if you keep all your user data on another drive or simply in another, non-application directory rather than in Windows' Documents and Settings directory, then the documents can simply be left in place and accessed as is.

If you keep your data in the Documents and Settings tree and you're copying that intact or packing it up into an archive, you can generally preserve the existing directory structure by just copying everything within Documents and Settings as is and then unpacking it into your Linux home directory.

If you want to be really cautious, create a directory within your Linux home directory and restore your files into that to minimise the chances that your restored files might collide with something created by an application or the system itself. Everything can always be moved around later on.

Moving application settings between Windows and Linux versions of an application is a different matter, and the process will vary widely from application to application. Sometimes the settings for the application are stored in a stand-alone file that you can easily move to the Linux version of the program. This is not always possible, however, so you need to approach this step with caution.

An example: Mozilla's Firefox browser, which runs on Linux and Windows (among other operating systems) keeps user bookmarks in a file named bookmarks.html. In Windows, this file is kept in the directory %AppData %MozillaFirefoxProfiles.default, where is a randomly generated string used to distinguish your Firefox user profile. In Linux, however, bookmarks.html is stored in /home//.mozilla/firefox/.default.

Other Mozilla applications follow the same basic concept: The Thunderbird mail client keeps its user preferences in the same type of directory - /home//.mozilla-thunderbird/.default on Linux, and %AppData%ThunderbirdProfiles.default in Windows.

It's possible to just copy the contents of the profile folder from one system to the other; Mozilla's website has some instructions on how to move profiles for both Firefox and Thunderbird. However, you can also copy things selectively. If you have Firefox bookmarks that you want to transport from Windows to Linux without having to re-create them manually (which can be a chore), you just need to copy the bookmarks.html file to the proper place in Linux.

The same procedure goes for copying over your Firefox settings, which are stored as the file prefs.js in the same directory. Thunderbird's settings are also stored in a prefs.js file in its own profile directory, and the address book is kept there too in a file named abook.mab. (The address book can also be exported and re-imported by Thunderbird as an LDIF-format text file.)

If you'd rather not mess with these files and just automate the process as much as possible, there is a plug-in for Firefox called FEBE, available on all platforms, that can back up and restore extensions, themes, preferences, cookies and, yes, bookmarks. Note that you might need to manually unpack the profile archive FEBE creates when you move it to Linux; there is an entry in the FEBE FAQ that explains how to do this.

Migrating email itself from an existing Windows client into Linux can be a bit of a chore, depending on which application you use. If you're using a mail app that exists in Linux already, such as Thunderbird, the process is not that difficult - it generally involves little more than copying your old Thunderbird mail directory into the new Thunderbird installation's mail directory.

If you're using Microsoft Outlook or Outlook Express, the process is a little more complicated. There is no direct way to simply import an Outlook mail repository, or .PST, into a Linux mail client. Thunderbird doesn't let you do this, and neither do Evolution or Ximian (at least not yet). Most of this is because of two things: Outlook's proprietary mailbox format, and the fact that Outlook has no native way to export email to standard Unix mailbox formats.

There are ways to work around these problems, though. In Thunderbird's case, you can install a copy of Thunderbird on the same Windows system where you have Outlook running, import Outlook's e-mail into Thunderbird, and then copy Thunderbird's mailboxes to your Linux installation.

I've actually done this by using the PortableApps version of Thunderbird on Windows, which can run Thunderbird from a removable drive without actually installing anything on the Windows machine. (Note that other applications with cross-platform editions, such as OpenOffice.org, exist in PortableApps editions as well, so this trick is not limited to Thunderbird - you just need to know where the application keeps its settings on both platforms.)

A couple of other programs do exist to help migrate users away from Outlook. One is Outport, which exports Outlook data to a variety of generic formats, but it hasn't been updated in quite some time and seems to exist mostly as a curiosity. Another, more recently updated option is readpst, also designed to export Outlook mail into the standard Unix mbox format, which can be used by Linux mail programs like Kmail.

Finally, I should point out that these examples are specific to these programs. Every other Linux program (or Linux program with a matching Windows edition) stores its settings a little differently, so the migration process will be a little different for each app.

The application situation

A fairly large component of making the switch to Linux is finding equivalent applications for your workload. If you've already been using open-source applications for most of your work, the hard part is already over: Chances are you'll be able to use the exact same applications in Linux as you were in Windows.

For instance, if you've already been using OpenOffice.org for word processing on Windows, OO.o documents will open as is in the Linux version of the program.

However, if you've been using Windows applications exclusively, then you'll need to locate equivalent programs -- apps that accomplish the same tasks or work with the same file types.

One place to start researching where to find equivalents is a regularly updated page on the Linuxsp.ru site, which breaks down applications by category, listing Windows and Linux equivalents in parallel columns. The breakdown also goes by subcategories of product -- e.g., "Email client in the MS Outlook style" is one useful subcategory. The site also has some discussion of feature equivalencies between Windows and Linux as well.

If you have files in a given format and you're not sure if the replacement program you have in mind will accommodate them properly (and you need to be sure it will), you can try this experiment before committing to anything: Get your hands on a live CD distribution of Linux that contains the equivalent program you're considering as a replacement. Make a copy of the file in question, put it on a separate drive (such as a removable USB drive), boot the live CD, and see what you can accomplish with the file.

For instance, if you're planning to replace Photoshop with Gimp, you may want to find out if the images you want to work with can be opened or edited with Gimp in the way you want. It's important that you attempt to do this in Linux itself, so that you'll know if the current Linux edition of the program can accomplish what you need; feature sets can vary slightly for a given program on different platforms.

My advice to handling documents during the migration process is that you maintain at least three copies of any given document:

1. The original file, as it was before you started the migration process. If you're preserving your original Windows partition, the original file could be kept there as part of that.

2. An offline backup of No. 1; that is, a copy on another drive or medium for safekeeping, possibly the drive you used to perform the migration.

3. The migrated copy, which you're working with now, which may have been converted into a new document format.

If you're migrating away from proprietary file types -- for instance, from the "classic" Microsoft Word format (Word 97-2003) to OpenOffice.org's OpenDoc -- it's best to take the document in question onto the new platform, save it in the new format before attempting to do any work with it, and compare it against the original to see if it has survived the conversion process.

Most Word documents translate as is without trouble, but keep an eye on documents with exceptionally complex formatting -- maths formulae in Word documents in particular have been known to cause problems for some users.

Every now and then you're likely to run into an application for which there is simply no suitable Linux or open-source replacement. In such cases, you have two options. One is to continue to run Windows itself, either as a dual-boot configuration or in a virtual machine (e.g., VMware or VirtualBox for Linux), until you can find something that'll do the job. The other is to try and run the Windows application directly in Linux using Wine.

Wine is free, open-source software that makes it possible to run the vast majority of Windows apps in Linux, but it's not always possible to predict how a given Windows application will behave. The newsgroup comp.emulators.ms-windows.wine (rather ironically named since Wine's not an emulator, strictly speaking) may have notes from others users about the very application you're trying to run.

It's also possible to migrate Windows applications settings stored in the registry over to applications running under Wine. You first need to know which registry keys contain the settings you want to migrate.

With that in hand, you can then use REGEDIT in Windows to export the relevant key data, copy the exported data to Linux, then use Wine's own regedit application to re-import the same data. (The syntax for doing this with Wine's regedit is fairly simple: wine regedit regfile.reg, where regfile.reg is the registry data exported from Windows.)

Another thing to consider is finding replacements for system-level functions -- music players, desktop search and so on -- that come bundled with Windows. A typical Linux distribution will usually offer several possible replacements for a given Windows system function.

In Ubuntu, for example, there's a native desktop-search utility available in the software repository (based on the Beagle search system), but it's also possible to install Google Desktop Search for Linux if you used that tool on Windows and want to stick with it.

Conclusions

Even though many people who migrate from Windows to Linux do so with the intention of staying, it's always important to remember how you got there. If you have backups of all your original documents and user settings -- whether on your original Windows installation or in another form somewhere -- you'll always have something to fall back on as you get settled into Linux and make it your new home, hopefully for a long time to come.

Serdar Yegulalp writes about Windows and related technologies for a number of publications, including his own Windows Insight blog.