As I promised in several threads, here are some notes on how I installed several Operating Systems on my laptap. I will give links to the tools that I obtained from various third parties. And I will include the source code for a few scripts that I wrote.
Introduction
A few months ago the disk drive on my Inspiron 8200 fried out. I decided to customize it with new peripherals. I got a 100 GB Seagate drive and a DVD burner. That 100 GB drive is mounted in a carrier. It is a big deal to mount the drive in a carrier, but remove one screw and the carrier can just be pulled out. I bought a second carrier and a second 100 GB drive. This allows me to switch my hard drive and so I can try experiments with little risk. I can remove one of my batteries and install another drive in the battery slot. I have a floppy drive to install there. My BIOS supports booting from any ATA device so I can boot from the hard disk, the CD/DVD drive or the floppy.
I decided to install as many OS's as I could on the new setup. The problem is that, except for Linux, everything demands a primary partition and there are only 4 primary partitions. If one is used as a chain of logical partitions, that leaves 3 non-linux OS's. I decided to live with that. There are some extreme solutions that would allow more non-linux OS's, but they are too extreme. I wanted NETbsd, Desktop BSD, and Solaris 8 in addition to what I did install. But those 3 OS's did not seem worth very extreme measures. So I wound up with:
Windows XP
Redhat
Fedora
SuSE
Debian
Scientific
FreeBSD
Solaris 10
Tools
I used several software tools to help me with this project.
GRUB
First, I need a really good bootloader that I understand completely. GRUB is really the only game in town. There are some very powerful bootloader products, but without access to the source code, there is a limit to how well I can understand them. GRUB is actually very easy to understand, but it has been documented poorly. Until I understood GRUB, various disasters rendered my system unbootable. In each case I was able to eventually track down exactly what happened. It really is no longer possible to render my system unbootable.
Disk Director/True Image
I needed a Partition Manager and I have used Partition Magic in the past. But PowerQuest sold the product to another company and it doesn't seem to be well supported now. I decided to try Acronis Disk Director which is less expensive. It isn't perfect, but it worked well enough. I also bought Acronis True Image. Again not perfect, but it can completely restore the system on to a brand new drive from DVD backup. You can create a bootable cd that has both products on it. This allows backups and restores from a quiescent disk. Disk Director comes with a GUI sector editor that is arguably better that dskprobe.
Disk Wizard/Seatools
Seagate has these utilities available for download from their site. These are bootable CD's that can run diagnostics and write zeros over an entire drive among various other tasks. I like to zero out a drive before I do a re-install (9 hours for 100 GB!). And it can do non-destructive tests on the drive. Other manufacturers have similiar utilities.
System Rescue CD
When I did have trouble during the project, this is the tool that got me out of the woods. It is basicly a "Live CD" with a lot of useful tools available.
Sector Inspector
This is an XP comand line based physical sector utility. It can do a lot of stuff that the GUi based sector editors cannot do. This is a Microsoft program and it is free.
I have switched from dskprobe to the Acronis Sector Editor. But dskprobe is free and it comes in the support tools package on the XP installation CD. Or you can download the Support Tools here. dskprobe comes with a doc file called dskprtrb.doc which I thought was very helpful. Also dskprobe is a stand-alone utility while the Acronis sector editor is a sub-tool of Disk Director.
Installation Notes
Here are some notes on what I did to install the os'es. I did not just gather a collection of OS's and jump straight into the mass installation. I did test installations first to gain experience with each installer. In every case, I used the "custom" options to maximize my flexibility during the install. This means that I had to understand each installer rather well. Remember that the Master Boot Record has a table for 4 partition entries.
Windows XP
I installed XP first on the first primary partition which I formatted with an NTFS filesystem. I installed the recovery console and I added an option to boot into safe mode. This means that the NT bootloader presents a menu not unlike the grub menu. I created an E: partition which used FAT32. This is my first logical partition. The second entry in the partition table is now consumed to support my string of logical partitions. This partition will contain data files and Linux will mount it as /driveE. This allows me move files between Linux and XP. At bootup time, the NT loader looks for a file called hiberfil.sys. If found, it is loaded into memory and execution resumes. This is how hibernation is implemented. Upon awakening from hibernation, it is critical that nothing has changed since hibernation began. Even docking or undocking a laptop is enough is cause problems. I will be booting via grub and I can't guarantee that another OS might not get started. Since I am sharing partitions among OS's this would be a recipe for disaster. So I have disabled hibernation.
Each of the other OS installation procedures is prepared to co-exist with a pre-existing XP instance in the first primary partition. Most of them would install a bootloader that could boot XP or themself. See the "failsafe boot" article below to see why this is not a problem.
Linux Distros
I used LVM for each Linux distro. Even / is under LVM, but Linux cannot boot from LVM, so I created a temporary /boot partition during the install. Let's take RedHat as am example...it was the first distro I installed. I copied /boot to /mastergrub/RedHat. Then I moved /mastergrub/RedHat/grub to /mastergrub/grub. /mastergrub/RedHat/grub became a symlink to /mastergrub/grub. And /boot becomes a symlink to /mastergrub/RedHat. Each distro gets its own subdirectory under /mastergrub and each of these subdirectories gets a grub symlink pointing to /mastergrub/grub. So all of the distros wind up using the same grub instance. That /boot partition is then just discarded.
I used a separate /tmp partition and swap partition putside of LVM. The swap area is 2 GB and /tmp is 1 GB. Each Linux distro uses the same partitions. So, in total, I use 3 GB for /tmp and swap rather than 15 GB. I am in the process of modifying the start up scripts to rebuild /tmp at boot time. This will mean that any OS can use the swap or /tmp area for any purpose. It also explains why /tmp in ext2 rather than ext3. There is no point in a log if I rebuild the filesystem upon each boot.
RedHat is rather old and it is out of step with the other distros. But I still encounter RedHat deployed by companies so I wanted a version on my laptop. RedHat is using LVM version 1 and the other distros use LVM version 2. I picked Fedora, and did a "vgscan --makenodes". This gave me device files for all of the other distros' logical volumes. I can mount the other distros when I need to. I will use this to develop a file level backup for the Linux distros. I have also used this to correct a problem with boot up scripts.
Every Linux partition is a logical partition. This includes the Grub partitions and the LVM partitions. I have a /userdata partition formatted as ext3 which all of the Linux distros mount. I do have a small /home (under LVM) in each distro so that each can have its own start up files, etc. But most of my stuff will go in /userdata. So each distro has its own LVM partition. But then there is swap, /tmp, /userdata, and /mastergrub (each in a separate logical partition) used by all distros in common. And there is /driveE which they mount as well.
FreeBSD
FreeBSD goes into primary partition 3. I used Acronis to pre-allocate the partition before the installation. FreeBSD carves up the partition intp pieces that it confusingly also calls partitions. In theory, Grub can boot FreeBSD directly, but I could not get that to work. So I had FreeBSD install it's own bootloader into the partition, thus leaving the MBR alone. Then I modified grub.conf to chainloader into it. I would like to get a direct Grub boot working and I plan to work on this. For now, it is good enough.
Solaris
I have one primary partition left and I installed Solaris 10 in it. Much like FreeBSD, Solaris carves the partition up. It uses "slices" so describe the pieces. Again, I preallocated the partition before doing the install. At the last minute I noticed that Sun had a new version of Solaris 10 on their site. I don't usually instantly jump to each new version, but Sun had switched from their own bootloader to using grub. So I downloaded the latest Solaris 10. Well, none of my versions of Grub can read the Solaris slices...I even downloaded the latest Grub from the Grub home page and still no go. Sun must have modified Grub. I may switch to Sun's version at some point. But for now, my Grub is chainloadering Sun's Grub.
My Final Grub Configuration
With each OS that used Grub, I took a look at its grub.conf. Many times I saw a new technique; and, if I liked it, I added it to my bag of tricks. SuSE heavily modified Grub and I could not find much info on their mods. There are warnings that SuSE's mods introduced a security problem. So I will not use the SuSE version of Grub. But even with SuSE, I found some things to use. My grub.conf:
One of the secrets of success in a complex installation like this is to completely understand exactly where everything is on disk. Acronis disk director could list some of the info, but I needed more. I wrote a tool to take the info that Acronis displayed and produce a table for my notes...
Some notes on this...
MBR, the hidden sectors, and the EBR's
The Master Boot Record (MBR) is the first sector of the disk. It has the boot code and the partition table in it. The rest of the first track is called "the hidden sectors". In my case, Grub stage 1.5 is in the hidden sectors. The structure of this first track is duplicated for each logical partition. Each logical partition has a structure like a MBR as it first sector. Then the rest of the first track is ignored. This first track immediately precedes the logical partition that it describes. Microsoft uses the term "logical drive" which almost means the same thing as "logical partition". But looking carefully at the definitions it seems to me that "logical drive" = EBR + "wasted sectors" + "logical partition". In any case, you need the MBR and the EBR's to define the partition layout of a drive. I see programs to backup the MBR but they always ignore the EBR's. I will fix that by writing a utility to backup the MBR plus the EBR's. Strickly speaking the EBR is one sector and it is followed by some wasted sectors. In my chart I have cheated a little bit and redefined the EBR to be all overhead sectors between partitions. I feel that the chart is "busy enough" and would be even harder to read with two lines between each partition.
Cylinder Alignment
Notice how the partitions are generally aligned on cylinder boundaries. The exception is /mastergrub and this is due to a bug in Acronis Disk Director. I originally had /mastergrub at .5 MB which is too big. I shrunk it, but I made the free space appear before the partition rather then after it. (This let me shuffle the free space down and add it to my XP partition.) When I produced this chart, I noted that /mastergrub was not aligned properly. This wastes a few more cylinders, but it seems to have few consequences. The only potential problems that I can think of... Some programs try to guess the disk geometry....with amazing success. They might do this by looking at the alignment of the partitions. Some programs (like Acronis itself) can locate and restore deleted partitions. This might fail if the partition was misaligned to begin with. I notice that Acronis has a "fast" and "slow" search for deleted partitions (with the "slow" option being more robust) and this might push you into the "slow" option.
This encouraged me to experiment with partitions that were truly logical but also had an entry in the fourth MBR slot as a primary partition. My idea was to switch one of several logicals into the primary slot, install an OS, destroy the primary entry, and boot from the logical partition. This did not work very well. A smart bootloader could switch a partition from logical to primary and then boot it, but I did not want to write a bootloader.
I notice that each logical partition is wasting most of a full track. I am considering misaligning all of the partitions to recover that space. There is not a lot of space to be recovered and this may not be worth the effort. Also Acronis does not have enough control to allow me to try. I believe that qtparted can do this though.
Solaris Changed Types
Solaris 10 is using BF as its partition type and the Solasis 10 installer does not recognize partition with a type of 82 anymore.
I did not want to enter the starting and ending LBA's for the EBR's. The script should be able to calculate them from the preceding and following entries. This increased the complexity of the script but in the long run it saved effort. And here is the source code...
The /mastergrub partition has the grub software and the kernels for each installed Linux distro. Grub stage 1 resides in the Master Boot Record (MBR) which is the first sector of the disk. More often than not, each OS install would rewrite the MBR to point to it's own copy of grub or other bootloader. Sometimes I would fiddle around the grub software in /mastergrub and break it. In addition to installing grub stage 1 in the MBR, stage 1 can be installed in the first sector of that partition. And then some other bootloader can chainloader into it. I wrote my own installation scripts. They are:
mbrinstall
This script simply installs grub stage 1 in the MBR.
localinstall
This script installs grub stage 1 in the local partition. (/mastergrub for now.) Then is uses dd to obtain a copy of the first sector of the local partition. This is put in a file in the /driveE filesystem. Recall that /diveE is a FAT32 filesystem used to pass files between linux and XP. Windows XP will obtain the sector and incorporate it into the XP bootup sequence. In XP my boot.ini file is something like:
So now, if I can boot XP, I can use XP to transfer control to grub in /mastergrub. This is a big help since most OS install scripts install a boot loader with an option to boot Windows. So I can use that option, start to boot XP, but select the menu option to boot /mastergrub. Then I boot a distro, and run the mbrinstall script mentioned above.
floppyinstall
Booting from XP will not work if I have damaged the grub software in /mastergrub. I don't have room on a floppy for those kernels, but I have never broken my kernels. I easily have room on a floppy for grub, including the grub.conf file. This script creates such a floppy. Then I can boot the floppy and start the system that way.
cdinstall
What if I completely lose /mastergrub? cdinstall creates a CD which is a complete backup of /mastergrub. Additionally, it is a bootable CD which can boot any of the distros without using /mastergrub at all. This script needed a piece of Grub called stage2_eltorito which was not supplied with any version of Grub that I had. So I downloaded and compiled the source code from the Grub home page.
/backupgrub and /testgrub
Actually all of the above scripts have benn extended to support /backupgrub. This is simply another partition which is a copy of /mastergrub. Every now and then, I use rsync to copy the files over. Then I cd into /backupgrub and run the localinstall script. Whenever one of these scripts runs, it figures out what partition it is running in. The grub.conf file is adjusted to reflect the current partition (or in the case of cdinstall, adjusted to boot from cd). I also created a /testgrub partition so that I would stop running dangerous experiments in a critical partition.
supermbrbackup
A number of utilities exist to backup and restore the MBR. This includes the boot code and the partition table. The thing is though, that of my partitions are described in Extended Boot Records scattered all over my disk. I wanted a utility that would recreate all of my partitions (empty of course) on a brand new disk. And while I was at it, I had it scan the unused sectors after the MBR which is where GRUB stage 1.5 resides. So this backs up everything except the contents of partitions. The backup are written to a floppy along with a script to restore them. This script can be run after booting the System Rescue CD. My intent was that this would be the first step in a bare metal restore. But it turns out that I didn't need it.
Bare Metal Restore
This is what happen if I lose the entire hard disk. This is the ultimate in ensuring that I can boot. I used Acronis True Image to do a complete backup of my drive. It does not support Linux LVM nor FreeBSD and Solaris slices. But it can do a sector-by-sector backup of those partitions. After the backup finished, I replaced my hard drive and used my bootable Seatools disk to zero it out (9 hours with a 100 GB disk). Then I booted my Acronis boot disk and fed it the backup DVD's. It recreated my entire system.
I used a Seagate utility to write zeros to the entire disk before I started. That means that the Linux LVM and FreeBSD/Solaris partitions probably had a lot of zeroed sectors in the unused space. This helps the compression routine in the Acronis sector-by-sector backup do a good job.
I still need a file level backup for Linux/FreeBSD/Solaris. I will work on that.
Dear all,
I would like to transfer my old laptop documents/files etc to the new laptop without using any external hard disk.
Please let me know if its possible via any way.
Thank in advance,
emily (3 Replies)
This is probably something really simple, but I don't get it. I downloaded a copy of Octave and extracted it to octave-2.1.73-sol10-sparc-local. Now what do I do with it? I chmod'ed it to 777 and tried running it which just gave me an endless stream of errors. Here's the beginning of the file... (4 Replies)
Hi all,
Good day. I just installed RHEL6.3 into my laptop to learn RH.
There is an existing Windows 7 in there.
After installing the RHEL, the laptop will just boot to Windows 7.
I tried to use this BCDedit to add Linux entry to the boot menu, BUT each time i pick the redhat selection,... (5 Replies)
Hej all,
I have an script which I run it with Octave command in Linux, I want to know how could I put bash commands like grep and sed and use them together with octave?
My Octave script:
Script.sh:
m = load ("file", "-ascii")
for i=1:10
g(i)= sin(m)
end
and then I use this... (2 Replies)
Hej guys,
I'm doing some simple matrix operations with octave and don't know where and how it stores it's variables. Is there any file somewhere that could be accessed?
I was using MATLAB before and now Octave is new for me.
Or maybe I should use some commands to save and load it.
but... (0 Replies)
Hi to all,
I have the problem that a laptops with windows XP cannot startup even in safe mode nor using last good known configuration. I have a Ubuntu 10.10 Live CD and booting from it I can read the Hard Drive.
I need to do a backup the Hard Drive from XP laptop and I want to connect this... (5 Replies)
I have an x86 Sun server, with no CDROM drive and no OS currently loaded on it. I need to install CentOS on it... trying to figure out how to do that.
I've heard there are ways to connect to the serial management port, and mount a laptop's CDROM drive as a drive the server will recognize to... (0 Replies)