Solaris & Windows: How to make them coexist?
Monday Jan 21, 2008
One thing I have realized that everyone is a little skeptical about installing both Windows and Solaris in their computers. At the same time there are may guides and a lot of help all around the internet but many of them leave things a little incomplete. Most of them only provide instructions with little explanation. My aim of writing this blog entry is to create a single point of reference for all such queries including instructions, explanations and experiences. Although I would be referring to Virtual Machines very often in this entry, but most of the things will work the same way on any other computer. Ok, lets start off.
Now if you have been reading my blog, you would know that I have tried to install Solaris on quite a few computers. Some installations have completed successfully, and some have not. You would also know that I have been been working with OpenSolaris installed in VMWare Fusion (in a Macbook Pro). Now I have been maintaining a different Virtual Machine for Windows XP and for OpenSolaris for quite some time now. Finally yesterday I decided do away with two separate Virtual Machines and create a single VM that would have dual booting options. Now why would I want to do that? I don't know. Maybe because I want to experience for myself what some of my college mates have been experiencing while installing Solaris/Linux. Now before I start off with the installation, let me share some theory first. First a disk can have two types of partition: Primary and Extended/Logical. A primary partition is in which an Operating System can be installed. One hard-disk may contain a maximum of 4 primary partitions. Also there is another concept of active partitions. Now any one of the primary partitions can be an active partition or a boot partition. Since there can be 4 primary partitions with 4 different Operating Systems installed, one of the partition that is marked active is used for the initial booting. The active partition contains the bootloader which thereafter points to the different operating systems/partitions/bootloaders that can be booted off. Now (generally) whenever we are installing an operating system it will make its partition as active so that if the computer is rebooted the computer boots off the same partition into the same operating system. Also the active partition must be chosen sensibly since not all operating systems can recognize all filesystems. eg Since Windows does not understand UFS/ZFS/EXT2/EXT3 filesystem, it would not know what exactly those partitions contain. And therefore, its bootloader would not show any option to boot into this partition. Thus it is recommended that we make such a partition as active which will contain an Operating System which will recognize each of the partitions, atleast be able to read them. Also let us know which operating system recognizes which filesystem. I am only considering the common ones here. If I consider this as a lattice, at the bottom will be Windows which recognizes NTFS and FAT, above this will be Linux which recognize EXT2, EXT3 along with NTFS, FAT etc. And on the top will be Solaris which recognizes all these plus its native filesystems UFS and ZFS. So basically Solaris can understand all these filesystems and the least it can do is perform a read operation on these filesystems.
So basically after understanding all these things we know what kind of setting we are looking for. We need to have Windows/Linux/Solaris installed on different primary partitions on the hard-disk. We want the Solaris partition to be the active partition and the Solaris GRUB should contain entries for all operating systems. Now going by the common trend I will consider an installation having Windows and Solaris on any computer (in my case I am using a standard 32 bit Virtual Machine).
Now the installation. Since we know that while installing the operating system, it marks its own partition as active and it also displays a boot menu while booting, we should first install Windows and then follow it up by Solaris. This way first Windows installs and marks its partition as active and has a single entry in its bootloader. Once Solaris is intalled, it will mark its own partition as active and also recognize the Windows filesystem and give an extra boot option in the bootloader menu so that one can also boot into Windows. Now this is what we should ideally do in order to follow a simple process. But lets do it the other way, because my purpose is to help you get out of the "pseudo-troubles" that we face when we either install Solaris first by mistake, or maybe sometimes we are at a position where we need to format and reinstall windows and as a result we end up not being able to boot into the "other os" which is installed in another partition. Now any novice Linux user will know how to cope with that. The Linux distributions aimed at the desktops eg Ubuntu gives you a simple guidance through the process. So even if the Linux users know "how to get it right" they do not understand in "what way is each step helping you achieve the settings" that are specified in the last paragraph. Now lets do it step by step:
- Set up your computer. Now if you are using a laptop/desktop I am assuming it to have a single formatted hard disk. In case you are doing this on a virtual machine, you need to set up the virtual machine. Since I want to be very neutral about this, I create a VM with the Operating System as "OTHER" which means that the Virtual Machine will install any standard 32-bit x86 Operating System. I shared 800 MB RAM, 30 GB virtual hdd and 1 CPU.
- Now insert the Solaris/OpenSolaris DVD. I used the OpenSolaris community edition build 72. Since I have more than 768 MB RAM I can use the new Caiman installer. So from the initial boot menu (GRUB) I select Solaris Express Developer Edition. Now as I continue with the simple installer, I will be asked whether I wish to use the full disk or whether I wish to Partition the disk. I will Partition it in this case. I create the first partition for Solaris with its size 15 GB and leave the rest unformatted. So now with a few more clicks my installation begins. In case you do not have 768 MB RAM use the older installer by selecting the Solaris Express option at startup. Both the installers essentially follow the same set of steps, just a few minor changes and the new installer is visually more appealing.
- So once the installation is over you can check whether Solaris is properly working. Now pop in your Windows XP Disk (I guess even Vista will work the same way) and restart your computer. Windows XP installer does warn you that it will make its partition active while installing which might prohibit you from booting into any other OS. Don't worry about that. Thats exactly what we are trying to solve. Go ahead and complete the Windows installation.
- Once the computer boots after the Windows installation, you will find Windows boot automatically without giving an option of which OS you wish to boot into. To solve this there are two ways both of which are really simple (maybe there are more, but let stick to these common ones). In case you do not like to play with the command-line then you can use any Linux LiveCD eg Ubuntu. In the other method you can use the command line of Solaris to rectify this problem.
Now both the methods I will put under two sub-points... You can choose either of the two:
- Using Ubuntu LiveCD.
Pop in any Ubuntu CD (I am showing Ubuntu 7 in this case). Boot off the CD, it might take a little time if you are using a Virtual Machine. Now when you are in the Ubuntu desktop, go to the following: System > Administration > Partition Editor.
This will start GParted. You can see both the partitions. in this as shown in the screenshot:
The Hard Disk device is located at /dev/sda with the first partition /dev/sda1 having Solaris (unknown filesystem - Why? because linux does not recognize the Solaris partition) installed and the second partition /dev/sda2 has Windows (ntfs filesystem) installed. If you observe the list of partitions, you will find that /dev/sda2 has the "boot flag" set which means that it is active. Now we have to change that. So right-click on the Solaris partition, choose "Manage Flags" and check the boot flag.
Now your GParted list will look like this:
Reboot your computer and you will see the Solaris GRUB menu.
- Now this method will actually be faster because you dont need to boot into a full blown Graphical Operating System. Use the same Solaris DVD and in the Grub Menu select Solaris Express Developer Edition/Solaris Express. When asked for further option select "Single User Shell" and then it would ask if "....you wish to have your Hard Disk read-write mounted at /a?", select Yes. and now you will be in the Shell.
Execute the following commands:
cd /a :to go to root of your hard disk
ls :will show you all the contents of your hard disk root
ls /dev/rdsk :will show you what all disks are attached to your system
You will realize that the only hard disk that is available is /dev/rdsk/c0d0p0. p0 refers to the entire hard disk, while p1-4 refers to the maximum 4 primary partitions. Now use the fdisk command on this disk:
fdisk /dev/rdsk/c0d0p0
This will show you a very simple menu along-with a list of all the partitions:
You will realize that Partition 2 (IFS: NTFS) is the active partition. So select option 2 ie Specify Active Partition. Select Partition 1 and it will issue an confirmatory message saying that Partition 1 is now the new active partition.
Issue a reboot command eject the Solaris Disk.
Now on reboot you will see the Solaris GRUB menu.
- Using Ubuntu LiveCD.
- Ok, So now our problem is partially solved. You will realize that the Grub Menu looks like this:
No option of booting into windows. Well the solution for this problem is pretty simple.
Boot into Solaris with the root priviledges. Open the file /boot/grub/menu.lst in any text editor and add the following lines at the end of the file. I am using the vi editor, but any text editor can be used:
title Windows
root (hd0,1)
chainloader +1
- Save the file, reboot and voila!! We have made our system nearly perfect!! Only one more issue will be left. If only we can access the windows partition in Solaris. Sure, you can. All you need to do is download and install two packages:
1) Install the FSWpart package
Download http://www.belenix.org/binfiles/FSWpart.tar.gz
Uncompress: gunzip -c FSWpart.tar.gz | tar xvf -
Install: pkgadd -d . FSWpart
2) Install the FSWfsmisc package
Download http://www.belenix.org/binfiles/FSWfsmisc.tar.gz
Uncompress: gunzip -c FSWfsmisc.tar.gz | tar xvf -
Install: pkgadd -d . FSWfsmisc
(Thanks to Narendra for pointing out these packages to me)
- Upon installing these two packages you will get an additional command prtpart. Simple usage of prtpart displays the partitions of the hard disk and its filesystems. Additionally you can use prtpart
-ldevs to see the Virtual Device names.
Now after having seen this, we know that the Virtual Device name of the Windows partition is /dev/dsk/c0d0p2
So we create a directory in /mnt folder and mount this partition into this directory:
mkdir /mnt/windows; mount -F ntfs /dev/dsk/c0d0p2 /mnt/windows
Alternatively you can also use /dev/rdsk/c0d0p2. We can now access all the files in the windows folder. Using similar steps we can also mount a linux partition. instead of specifying the filesystem as ntfs, we have to specify the linux filesystem. To unmount the filesystem give a command umount /mnt/windows.
So hopefully this will help all those whose computers are struggling to maintain truce between Windows and Solaris.











Thank you for this entry! Helped me out greatly.
But how can I do it from my Solaris Machine withou...
How can you do what?