[sf-lug] Dual Booting Linux Ubuntu/CentOS...Learning purposes

Rick Moen rick at linuxmafia.com
Sun Feb 8 03:21:38 PST 2009


Quoting vincent polite (vpolitewebsiteguy at yahoo.com):

> I tried a straight install to the free space I have on my hard disk.
> But, I was told I have too many "Primary Partitions", 4. I have; /,
> /boot, /home and /swap.

To be more precise, you have four entries within a data structure (the
standard type of partition table) that, on each physical hard drive, has
exactly four slots.  Originally, back in the 1980s early DOS days, that
was all you could get.  Using those four slots in the original,
circa-1982 fashion has been retroactively dubbed the use of "primary"
partitions.

A couple of years into the DOS era, though, somebody figured out a
trick:  Set a (previously unused) flag bit on one of the partitions that
by convention marked it as being an "extended" partition type, one that
is further subdivided via a subsidiary partition table (listing
"logical" partitions) in its initial sector, making possible a large
number of total partitions.

So, now that you understand a bit better the way partitioning works, you
should be able to see why that unallocated "free space" you left is
currently inaccessible:  The space is there, but the data structure
you'd want to point to it (the partition table) is _full_.

Your obvious way out is to delete one of your existing primary
partitions -- I nominate "swap", since it has no data on it -- create in
the place of that _primary_ partition an _extended_ partition taking up
all free space on the disk, then creating within that extended partition
logical partitions for your various other purposes including swap.

You should do these sorts of operations using your choice of Linux live
CD disk, by the way -- Ubuntu "desktop" disk, Knoppix, Damn Small Linux,
whatever.  _Not_ from your installed system.  (Also, before blowing away
your swap partition, I'd recommend booting up your installed Linux
system and commenting out the line in /etc/fstab for swap.  You can
re-enable it later, and meanwhile its absence won't be fatal.)

So, do that, and you can have as many partitions (within reason) as you
can possibly use.  /sbin/fdisk or /sbin/cfdisk (or a variety of other
things) can create partitions.  /sbin/mkswap will format swap partitions.
/sbin/mkfs.ext3 will format data-bearing partitions.  Go to town.

(However, please see reasons below as to why you might not want to go to
town, after all.  ;->  )

> Is there a tool I can use to remove /home and /swap from the primary
> partitions? And have them shared? 

It's usually a bad idea to try to have /home shared between Linux
distributions.  The reason is initially non-obvious:  Inevitably, it
will turn out that your two or more distributions have different
versions of some important applications or tools, that create "dotfile"
directories within your home directory.  Consider GNOME, which is among
those:  It keeps a bunch of stuff in .gnome, .gnome2, .gconf, .metacity,
and heavens knows what other directories within your homedir -- and the
format of files it stores within those directories tends to change
between versions.  The catch:  The data formats of what are store there
tends to be forwards-comptible to newer GNOME versions, but not
backwards-compatible to older versions.  So, distro A with GNOME version
n writes conffiles that distro B with GNOME version n+1 can read, _but_, 
the moment distro B updates those conffiles, distro A's GNOME is likely
to choke and die.

By contrast, sharing swap partitions among distros works pretty well.

Anyway, about the larger picture:  You should consider carefully whether
you're sure you want to operate a complex, multiboot system.  You can
get yourself in a lot of trouble, and really ought to make sure you have
a good grounding before doing that.  Given that it's news to you that
you cannot access unallocated free space on a hard drive with four
declared primary partitions, I'd say you do not yet have a good
grounding.


> I want to dual boot Ubuntu, already installed, and CentOS.
> Debian/Redhat. I wanted to create a virtual machine of CentOS using
> VirtualBox. But it just wasn't going to happen. 

Please note:  VirtualBox appears to use "virtual disk images" -- files
on the host operating system that get mounted as if they were disks.
So, it doesn't require partitioning.  So, cutting to the chase, you
should be able to use it within your existing Ubuntu setup _without_
touching your system partitioning.

Do yourself a favour, and plan what your are trying to do, and figure
out what is required, _before_ attempting to make dire changes (such as
repartitioning) to your system.






More information about the sf-lug mailing list