Auto dual boot (windows – linux)
25 January 2012
by Razvan Dobre
0 comments
Hello
Long time no write, again. Shame on me. Anyway…
Recently I had the opportunity to work for INCAS, which is a research institute for aerospace vehicles. They bought a cluster, a Super Micro chassis to be more specific, and needed a sysadmin to put it alltogether: install the operating systems, configure the networking, storage and all the necessary things. After 2 versions, I finally understood what they needed: they have codes written by themselves in Fortran using Linux development tools and they also have commercial Windows applications. So basically they needed both the operating systems on the nodes. After I tried to use virtualization tools to configure an easy mode to switch between them, I reached a scalability issue: KVM supports only 2 cores (tested on RHEL5) and ESXi 5 is also limited to 8 cpus and the network latency is quite high.
So the conclusion was: dual boot. So far so good but there are 20 blade servers to dual boot. The Super Micro chassis has indeed a great tool for remote management but it’s not funny to wait for every server to POST and then select witch OS to boot.
After I searched the web, I found that grub supports FAT32 file system witch means that the /boot partition can be written on a vfat partition. This was exactly what I needed because the FAT32 file system can be written from both operating systems.
To implement this all you have to do is this (for clean install):
- create a partition for /boot and write an ext3/4 file system to it (the Scientific Linux 6.1 Installer won’t let you install /boot on a vfat file system)
- create the rest of the partitions: / and swap
- install the Linux operating system
After the server is up and running do the following:
- copy the /boot to a temporary folder: mkdir /root/boot-tmp; cp -ar /boot /root/boot-tmp
- umount /boot
- mkfs.vfat /dev/sda3 (the /boot partition)
- update the partition type (c is for FAT32): fdisk /dev/sda -> t 3 -> c
- update /etc/fstab (if you are using UUID then the blkid will tell you the new UUID, else just replace it with the /dev/sda3) and don’t forget to update the file system from ext3/4 to vfat
- mount /boot ; cp -ar /root/boot-tmp /boot
- reboot the system and cross your fingers
Almost done. To automate the switch between Windows and Linux you need to install Cygwin on Windows to be able to run a SSH server on Windows and to have a grub.conf configuration file on the management node: if you need Linux the update the default entry in grub.conf to point to the Linux OS, if you want Windows the do the same for Windows. After the grub.conf is correct (usually the root partition is specified by its UUID, which is different from server to server, just replace that with the actual partition name), you just simply scp it to the server and then reboot. It should boot to the operating system where the default entry in grub.conf points to. This was done using grub 1 but should be the quite the same on grub 2.
Good luck.
