Linux multi-boot

Some folk like to have more than one linux version installed on a computer.  And, possibly, they also have Windows installed.  So that’s a multi-boot situation.

I’m doing that.  In this post, I’ll describe how I am doing it.

When I first did multi-boot, I was somewhat haphazard in how I organized things.  But by now, based on my experience, I’m a bit more organized.

Partitioning

I’ll describe my laptop, and how I am using that.  I have Windows 7 installed (that came on the computer when I purchased it).  And I currently have opensuse 13.2, opensuse Leap 42.1 and opensuse Tumbleweed all installed.

Here’s the current partition table:

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1            2048   1087487   1085440   530M 83 Linux
/dev/sda2         1087488  31807487  30720000  14.7G  7 HPFS/NTFS/exFAT
/dev/sda3  *     31807488 236603391 204795904  97.7G  7 HPFS/NTFS/exFAT
/dev/sda4       236603392 976773119 740169728   353G  5 Extended
/dev/sda5       236605440 237629439   1024000   500M 83 Linux
/dev/sda6       237631488 239671295   2039808   996M  7 HPFS/NTFS/exFAT
/dev/sda7       239673344 649273343 409600000 195.3G 8e Linux LVM
/dev/sda8       649275392 733173759  83898368    40G 83 Linux

And here’s a rundown of what those partitions are:

/dev/sda1: This is used as “/boot” for opensuse 13.2.  It is formatted with “ext2”.  I chose “ext2” because I don’t need journaling for “/boot”, and grub2 probably cannot read the journal anyway.

/dev/sda2 and /dev/sda3: These are used for Windows 7.  I normally don’t mount those in linux.  I do have “fstab” entries, but with the “noauto” option so that they are only mounted on request.

/dev/sda4: The extended partition, which is further subdivided into other partitions.  This system uses legacy BIOS booting and partitioning, as suggested by the existence of an extended partition.

/dev/sda5: This is “/boot” for Leap 42.1, also using “ext2” for the file system.

/dev/sda6: This is an NTFS formatted partition for data.  I do mount that in linux.  I use it for data that I want to share between Windows and linux.

/dev/sda7: Here there is an encrypted LVM.  It uses standard LUKS encryption (standard for linux).  Inside the LVM, there are four volumes.  Those are “root1“, “root2“, “home” and “swap“.

/dev/sda8: This is where I have Tumbleweed installed.  I do not use a separate “/boot” for Tumbleweed, since it is not using the encrypted LVM for its root file system.

As for the LVM volumes, I use “root1” for the root file system of opensuse 13.2, and “root2” for the root file system of opensuse Leap 42.1.  I use “swap” for swap in all three opensuse systems.

I also use the “home” volume in all three systems.  However, I don’t use it in quite the same way.  In opensuse 13.2, the “home” volume is mounted as “/home”.  In the other two systems, “home” is mounted as “/xhome”.  On those systems, “/home” is part of the root file system.  But I add symbolic links to “/xhome” so that I can easily share parts of “/xhome” with all system.  The idea here is that desktop settings, which are in places such as “.kde4” and “.config” and “.local” are distinct on all three systems, so that they won’t interfere with one another.  Then symlinks allow parts to be shared.

For example, in my Leap 42.1 home directory, I did:

rmdir bin  ### the installer creates an empty bin directory
ln -s ../../xhome/$USER/bin .

I used relative links rather than direct links, though that’s probably not too important in the user home directory.  Thus I have the same programs and scripts (mostly scripts) in “$HOME/bin” on each system.

Creating partitioning

The computer came with “/dev/sda1” (a Dell OEM partition), and “/dev/sda2”, “/dev/sda3” (for Windows).

I resized “/dev/sda3” to around 100G, using a “gparted” live CD.  That was back in 2010.  Windows complained about errors, so I ran “CHKDSK /f” to fix that.  I took over the OEM partition (originally 100M) for “/boot”.  I then created the extended partition and added other partitions.

I have since redone much of that.  I again resized, to enlarge “/dev/sda1”.  But “gparted” messed up more badly with Windows.  So I reinstalled Windows from an Acronis backup (that went well).

Apart from the resizing with “gparted”, I mostly used the linux “fdisk” to create partitions.  I always create partitions in advance before install.

Installing

When I first did an install into existing partitions (back with SuSE 10 on an older computer, before opensuse existed), I made a bit of a mess.  But I did learn from that.

My mistake was to take the proposed partitioning and try to edit it.

These days, I ignore the installer’s proposal.  Instead, I click on “Create Partitioning”.  On the next screen, I choose the custom partitioner.  That gives me a list of the existing partitions and logical volumes.

Then, on any line displayed, I can right-click and select “Edit”.  That allows me to change how that partition will be used.

In recent experience, the list of partitions and logical volumes shows all swap partitions and volumes assigned to swap.  If I don’t want that, I have to edit that line and change it to “do not mount”.

Next, I select the partition that I want for root, and edit that.  I set it to be formatted, and to be mounted at “/”.  I do similarly for swap (if not already configured) and for “/boot” (if I use that), and for “/home” or “/xhome” to mount my “home” volume.

On a UEFI system, I also must edit the line for the system EFI partition, to have that mounted at “/boot/efi”.

Booting

I’ll write a followup post on how I deal with booting.  The main idea is to have entries for all systems in the boot menu.  So, no matter which system controls the booting, there is a boot menu entry to boot whichever system I want.

During install, I usually tell the installer to boot from “/boot” if there is a separate “/boot”, or from “/” if there is no separate “/boot” (note that this does not apply to EFI booting).  I also tell it to not boot from the extended partition and to not set the active flag.  I can take care of that later with “fdisk” if I want to change the active flag.

Advertisements

Tags:

About Neil Rickert

Retired mathematician and computer scientist who dabbles in cognitive science.

Trackbacks / Pingbacks

  1. Linux multi-boot part 2 (booting) | Thoughts on computing - 2016/01/23

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: