Many Linuxes, Single /boot
What’s the correct plural for Linux? Linuxii, Linuxes, Linux, Linii? So, last night at seven o’clock this morning I found myself in #ubuntu on IRC trying to help a new user who wound up with an unbootable machine because of a problem with grub. Typically, it was self-inflicted. He originally ran Lucid 10.04 on an extended partition, upgraded it to Maverick 10.10 on the same partition and then copied the contents of the partition to a primary partition without updating /etc/fstab and /boot/grub/grub.cfg to reflect the move.
He really was absolutely new to the command line, and it took a while for me to communicate how to acquire the information I wanted, and likewise it took me a while to wrap my head about his partition setup:
<code> Device Boot Start End Blocks Id System /dev/sda1 * 1 11400 91570468+ 83 Linux /dev/sda2 11401 24322 103785473 5 Extended /dev/sda5 23330 24322 7963648 82 Linux swap / Solaris /dev/sda6 11401 21947 84713981+ 83 Linux /dev/sda7 22840 23329 3935232 82 Linux swap / Solaris </code>
In layman’s terms:
<code>
/dev/sda-->
sda1--> <strong>Ubuntu 10.10 #2</strong>
sda2--> Extended Partition
sda5--> Linux Swap #1
sda6--> <strong>Ubuntu 10.10 #1</strong>
sda7--> Linux Swap #2
sda3--> --
sda4--> --
</code>
The intent of the owner was to have Ubuntu 10.10 on sda1 and the current Arch (it has a rolling release instead of Ubuntu’s discrete versions). Over the course of about two hours we sequentially worked through every possible fix for a grub problem, short of an outright OS reinstallation – he was planning to eventually wipe the hard disk anyways, but had to back up data first, but ultimately the best fix I was able to offer was to restore grub on sda6. I’m at least happy that I was able to show him how to chroot and and perform a backup with a live CD.
Many–> One
To get to the point of this post, we eventually turned to what would be the easiest way to manage multiple Linux installations without using virtualization. A partition structure like this is what popped into my head:
<code>
/dev/sda-->
sda1--> /boot
sda2--> Linux Swap
sda3--> /home
sda4-->
sda5--> Distribution #1
sda6--> Distribution #2
sda7--> Distribution #3
</code>
It’s baroque but functional. Each distribution will have its own swap and boot partition. I’l return to grub configuration after I talk about /home for a moment.
/home
You have a few options for accessing your /home folder:
- Mount /dev/sda3 as /home
- Discrete, per operating system /home folder.
- Dropbox. Make your Dropbox folder synonymous with /home.
The upside of a single /home partition is that you have no-mess, no-fuss access to your files, no matter what operating system you boot into. On the other hand you might want to sample the unique differences of different Linux flavours and as so use different settings for the same program, depending on where you boot in to. A workaround for this is to only keep folders like Documents, Downloads, and Pictures (etc) on /dev/sda3.
Dropbox is a good “fix” if you don’t have a whole lot of data, have a good connection and are working off a notebook. Add encryption. It will also work very well with option #2.
Grub
Soooo. Grub. Single installation, once. Mount /boot identically under each one. Install kernels separately. Set up menu.lst/grub.cfg along these lines:
<code> # (0) Arch Linux title Arch Linux root <strong>(hd0,4)</strong> kernel /ubuntu-vmlinuz26 root=/dev/disk/by-uuid/5c17a28a-ea7c-4740-b1e2-b75a1450521e ro initrd /ubuntu-kernel26.img # (1) Ubuntu Linux title Ubuntu 10.10 Maverick root <strong>(hd0,5)</strong> kernel /vmlinuz26 root=/dev/disk/by-uuid/8d7924ab-67c2-4099-9416-cac5c5299076 ro initrd /kernel26.img </code>
And, with a glance at the clock, I bid this post finished.
Categorised as: internet
Nicely done Mark, well done!! You have another fan now