Monday 20 April 2009

How to migrate from Windows to Linux

Introduction

When a few years ago I decided to move from Windows to Linux (I created on my machine separate partitions for Linux and booted from Lilo or Grub either into Windows or into Linux, according to job requirements.


I normally used my laptop PC during the day in a company that had a Windows based LAN and therefore I normally had to boot in Windows during the day whereas I would boot into either Windows or Linux at home. This approach has a few disadvantages as follows:


  • My work e-mails were in Microsoft Outlook and I had to boot under Windows to access them.
    I used KMail (and later Mozilla Thundirbird) for my personal e-mails and I had to boot under Linux to access them.

  • I could access Window folders from Linux and copy data, but I could not access any of the Linux folders from Windows.


I concluded that there should have been a better way to use my PC and I looked for a solution to access both Linux and Windows applications without rebooting.

I investigated some of the available products. I found that the wine or CodeWeavers Crossover supported most common Microsoft Windows applications, but some other ones would not work. VMWare looked interesting, but finally I decided to buy Win4Lin (originally developed by Netraverse to support only Windows 95, 98 or ME, even if it allowed to install and use many more recent applications such as Office 2000 or other ones developed for XP without a glitch.

Some good advantages that I found in Win4Lin are the following:


  • Win4Lin has a very small overhead and pretty good performance. I discovered, after the installation, that sometimes applications run faster under Win4Lin than in the original Windows environment. The performance is due to the fact that Win4Lin is not really an emulator; it creates an environment where Windows applications run in native mode. This is done by providing modules that allow Windows to run as a Linux process.

  • The installation of Win4Lin is pretty straightforward.


Recently I had to install Linux on a new machine and I decided to install both a new OpenSUSE 11.0 distribution and the new version of Win4LinPro that now supports Windows 2000 and XP (according to the company Vista should also be supported in future).

The objective of this report is to give you an overview of the new Win4LinPro application and of the approach that I followed to migrate my dual boot machine to a single boot system.

Installing Win4LinPro

Win4LinPro is now distributed and supported by Virtual Bridges. You can easily order it online at the Win4Lin.com site and download either an ISO version or one of the Debian or RPM packages. Virtual Bridges confirms the order with an e-mail which includes also the licence code that must be entered during the installation.

Since I had an RPM based Linux distribution (OpenSuSE 11.0), I downloaded the RPM package. I checked the instructions of the UserManual which require to pre-install also the gcc and the kernel-source packages and then I could install the RPM without any problems.

The installation procedure of the original Win4Lin was more complex because it required to download a special Netraverse-enabled kernel according to each distribution. The new installer does not require this step because it automatically compiles and installs the kernel modules needed to support Win4LinPro.

The Windows installation has also become simpler. The original product required to copy files from your Windows 95, 98 or ME CD to disk and eventually install Windows. In the new version you can use the win4console command to request a Windows session installation and to define how it should be performed (installation directory, installation media etc.) You can specify that you want to install from the XP CD and the installation is performed as if it were a normal XP installation. The win4console allows also to install multiple copies of Windows and the system allows to run two of them concurrently (this could be useful if you want to have a Windows XP and a Windows 2000 session).

After the installation is complete, if you have used the defaults, you will find a Windows icon on your desktop and you can use it to start or shut-down your Windows session terminal. Alternatively you can use the win4 shell command.

You can install new applications in Windows in the same way as you would do with a normal Windows system. I installed various applications such as Microsoft Office, Acrobat Reader, Eudora, HotMetal PRO and a new version of Internet Explorer without any problem.

I had some problems with the original installation to use a COM device for a dial up connection. The new version allows Windows to connect to almost any type of Ethernet network from regular Internet access to Active Directory authentication, and anything in between.

Using Win4LinPro

Win4LinPro creates an interesting Windows environment which is pretty well integrated with Linux.

The personal Windows environment is normally created by win4LinPro in the home directory of the user who performs the installation. When the installation is complete, you will find two image files with the .IMG suffix which are used by Windows as the C: drive (used to store Windows programs and data) and the D: drive (used to store user settings).

By default Win4LinPro automatically configures shared folders so that Windows can access Linux files and Linux can access Windows files. Your Linux home directory is accessible from the Windows HOSTHOME path. You can also use the shared documents directory from Windows by double clicking on the Windows My Documents icon and accessing the path HOSTDocuments.


The Win4LinPro environment is surely much better integrated with Linux than a native Windows installation and you will have at your disposal the power of Linux and Windows applications without any need to reboot.

Moreover Win4LinPro offers greater virus protection than a stand-alone Windows installation. You can easily save your Windows directory as a tar archive and many viruses will not have any effect as explained below:


  • Boot sector or other boot time viruses. There is no Windows boot sector and therefore they are ineffective.

  • FAT32, VFAT or NTFS related viruses. Win4Lin installs Windows files in subdirectories of the Linux filesystem and therefore these viruses are ineffective.

  • Executable files viruses. These can still attack, but will not affect the Linux system.

  • Macro viruses. These can still attack Windows macros, but you can use Linux permissions to make them write protected.


Another protection is given by the snapshot running mode which insures that data in the C: virtual drive cannot be changed

Win4Lin Limitations and Peculiarities. Following main points should be considered:


  • Win4Lin offers different networking options that you can choose during installation and modify later (if needed). The basic TCP/IP and UDP/IP networking is the most secure and provides the best use of resources. If you need more advanced networking options you can use the NAT neworking or the Bridged networking options well explained in the UserManual.

  • Win4LIN does not support direct Windows access to USB devices. However, if they are configured in Linux, they can be accessed indirectly (You can use the My Host Computer function from the start menu to access devices mounted automatically by Linux)
  • .


Removing the original Window partition

One negative point of having both an original Windows partition and the Win4Lin installation is the waste of space (for instance I had MS Office applications installed on both partitions). This setup could offer better security, in case of problems to either the Windows or Linux installation, but, at some point, I decided that I could use better the disk space and work without double booting with Linux and Windows under Win4LinPro.

To avoid loosing useful data, I performed following activities:


  • I identified the Outlook mail boxes by using the Windows Find option with "*.pst" and copied them to the Win4LinPro environment.

  • I identified the Outlook Express maild boxes by using the Windows Find option with "*.dbx" and copied them to the Win4LinPro environment.

  • I identified my Eudora mail boxes (used for my personal mail) by using the Windows Find option with "*.mbx" and copied them to the Win4LinPro environment.

  • I found the 'Favorites' folders used by Internet Explorer and I copied it and its sub-folders to the Win4LinPro environment.

  • I copied the 'My Documents' folder and all other folders that I used in my Windows environment


Making the above copies in the Win4LinPro environment is relatively easy, because Win4LinPro can access mnt directly. You can mount the original Windows partition in the Linux /mnt directory by using a command such as:


$sudo mount /dev/sdb3 /media/windows -t vfat -o umask=000


Once the partition is mounted, you can access it in the Win4LinPro Windows session in the mnt Windows folder.

Once I was satisfied that all important data existed in the Win4LinPro environment, I decided to reformat the Windows partition and copy my Linux /home directory, that was included in the main root hierarchy, to a separate partition. This activity is described in detail below.

Using the freed partition for Linux

A good description of how to move /home to a different partition can be found in a good tutorial by Daniel Robbins at IBM DeveloperWorks. The main steps are as following:


  • Create a filesystem in the new partition by using a command such as mkfs /dev/???

  • Mount the new filesystem in /mnt with a command such as mount /dev/??? /mnt/newhome

  • Drop to single user mode (init 1)

  • Change to the current home directory and enter a copy command such as cp -ax * /mnt/newhome. The ax option causes cp to copy in recursive mode by preserving all file attributes.

  • Rename the old /home to /home.old by using the command mv /home /home.old and mount the new one with mount /dev/??? /home.


When you are sure that everything works correctly, you can remove the /home.old directory.

Conclusions

I believe that the approach described above allows an optimal use of both Linux and Windows resources.


It is often difficult to use only Linux, because one normally has to work in Windows based LANs, interact with other Windows or Linux users or just because one is too lazy to learn new applications instead of those normally used in a Windows environment.


A double boot system is a inconvenient to use. The solution proposed above allows a much better usage of the computer resources and time.

P.S. The article was originally published on http://www.ezinearticles.com

No comments:

Post a Comment