[conspire] Comments on setting up disk partitions.

Rick Moen rick at linuxmafia.com
Tue Apr 7 10:43:50 PDT 2009

Quoting Paul Zander (paulz at ieee.org):

> My basic question is what disk partitions to set up on a new desktop.
> The new machine has three hard drives:
> o  new 500 GB  SATA
> o  used 200 GB IDE  (has partitions from previous Linux install, but it's 
>         time to update the OS)
> o  used 120 GB IDE (has some partitions with data files, and also what
>    was C: which can now be re-purposed.)
> It would be really nifty to have Thunderbird set up to run on both
> OS's but share the same email data files.  

It's important determine which drive you can (and wish to) boot from,
for two reasons:  1.  MS-Windows will want to be on an NTFS filesystem
("partition"), there, i.e., it really likes to be on the first primary
partition on the first drive recognised in the BIOS.  2.  The booting
process will be controlled from that drive.  Boot sequence thus goes:

1.  BIOS branches to
2.  Microsoft unnamed program in the first drive's MBR, branches to
3.  First stage of GRUB in first sector of /dev/sda2[1] (second filesystem
    of the first physical drive, a native-Linux ext3-formatted 
    filesystem; /dev/sda1 being a huge honking NTFS partition for
    MS-Windows).  GRUB presents you with the "What do you want to boot?"
    screen, with a countdown to whatever OS you'll set up as default,
    Windows of Linux.  Depending on which you pick at boot time, 
    branch to either:

3a. Remainder of GRUB's code in /dev/sda2, which finds the kernel, 
    loads it with instructions about where to find the root filesystem,
    and there you go.   The kernel reads /etc/fstab ("FileSystem Table")
    to locate the other filesystems, mounts them during startup.


3b. First sector of /dev/sda1, where Microsoft's OS Loader program
    takes over, locating the NT kernel and all that other stuff. 

Machine BIOSes' boot routines are idiosyncratic, so you should consider 
checking to see which drive(s) you can boot from.  

And then, fortunately, you have gobs of space, so you can afford to (1)
be generous in your allocations and (2) keep it pretty simple, i.e., use
relatively few Linux partitions.

In fact, when people are starting out and don't have well-developed
opinions on partitioning, I urge them to lean towards the simple.  You
can always back up your data and redo the filesystems, when you have a
clearer idea what you want to accomplish.

You can use the fact that the system has three physical drives to
increase Linux performance by reducing average drive seek time.
"Seeking", i.e., changing from one concentric track to another, is by
orders of magnitude the slowest operation a hard drive is called upon to
do, so anything you can do that decreases the average seek distance (and
thus seek time) is good.  One thing is thus to include a swap partition
on each drive.  Another is to split among the drives the parts of the
total Linux file tree that get the most seek activity on average, i.e.,
put all of /usr on one drive, /var on another, and /home on the third.

So, how about this (under the assumption that the SATA drive is first
in BIOS drive order):

500 GB  SATA "/dev/sda" divided up as:

Size     Type   Device      Mountpoint within Linux
300 GB   NTFS   /dev/sda1   /windows
  2 GB   swap   /dev/sda2   [not applicable]
100 GB   ext3   /dev/sda3   /
rest     -      -           None - unallocated space

200 GB "IDE" (PATA) /dev/sdb, divided up as 

Size     Type   Device      Mountpoint within Linux
  2 GB   swap   /dev/sdb1   [not applicable]
100 GB   ext3   /dev/sdb2   /usr
rest     -      -           None - unallocated space

120 GB "IDE" (PATA) /dev/sdc:
I'm a little confused, here.  You say it has "some partitions with data
files".  If those are files you care about, you might want to boot the
Linux live CD of your choice (I like Sidux), mount those partitions, and
copy the files over to somewhere for safekeeping.[2]  Since you say
nothing about what kind of partitions, how large, etc., are on the
drive, and whether you want to keep them completely unchanged, or
alternatively want to keep the contents but are OK with blowing away the
partitions currently holding them, it's difficult to advise you.
Assuming you can copy those files away, and are willing to rebuild the
partition table:

Size     Type   Device      Mountpoint within Linux
   2 GB  swap   /dev/sdc1   [not applicable]
  20 GB  ext3   /dev/sdc2   /var
rest     -      -           None - unallocated space

There ya go.  Clean, easy to understand, avoids all the complexity of
"extended partitions" and "logical drives" by keeping per-drive
filesystem count to four or fewer, and has room unallocated on each 
drive that can be deployed however needed, later.

You'll eventually regret at least part of whatever partitioning scheme
you start with -- but that'll be when you can think over how you'll
re-do it.  ;->

Personally, I like to use whatever is my favourite Linux live CD of the
moment to lay out partitions (edit the partition table) on each drive.
You could even establish there the definition of the /dev/sda1 space
that you'll later turn into NTFS when you install MS-Windows on it.
The Microsoft installer will format the target partition, so there's no
point in running mkfs.ntfs on it.  Just define /dev/sda1 to be 300 GB
and type 7 ("HPFS/NTFS"), which edits the partition table appropriately
but doesn't mkfs ("format") the actual partition.

So, in your live CD, you can do

fdisk /dev/sda
...and lay out your partitions for it.  Save, exit.  Then

fdisk /dev/sdb
...and lay out your partitions for it.  Save, exit.  Then

fdisk /dev/sdc
...and lay out your partitions for it.  Save, exit.  Then

mkfs.ext3 /dev/sda3
mkfs.ext3 /dev/sdb2
mkfs.ext3 /dev/sdc2
mkswap /dev/sda2
mkswap /dev/sdb1
mkswap /dev/sdc1

...with the result that your data-bearing and swap partitions 
are now already defined and formatted (except that the MS-Windows 
one isn't formatted), even before you install your OSes.

But you don't _need_ to use a live CD.  Instead, you can (1) first,
install MS-Windows to /dev/sda1, and then (2) do all of the
above (or equivalent) in your chosen Linux distro installer.

Either way, remember that it's always advisable to install MS-Windows
_before_ other OSes on multiboot machines, because Microsoft makes no
effort to get along with others, and will without asking permission
overwrite your MBR, reset partition flags, etc.

As to your question about Thunderbird sharing e-mail data files across
OSes:  Last time this question came up, I think it was posed by Darlene 
Wallach, and I suggested using a symbolic link from the Linux side
pointing to the Windows-side files.  The user (Darlene or whoever) 
said it didn't work.  However, here's a different way:

Note:  Referenced page talks about fetching and installing the "ntfs-3g" 
tool.  That's often no longer needed, as many distros have been
incorporating ntfs3g.  The point about using that driver set is that, 
for the first time, it safely permits not only reading but also
_writing_ arbitrary files to NTFS partitions from Linux.  That had been
a longstanding problem, because Microsoft refuses to publicly document
the NTFS specification, and the Linux coders were obliged to
reverse-engineer it.

> It might be a good idea to have partitions to back up data on other drives.

Well, you can either repurpose some of the unallocated space as
dedicated filesystems for that, or you can just create backup
subdirectories on the existing ones.  Footnote [2] gives tips on using
rsync (and other tools) for copying directory trees.

I'm sure there are things I'm forgetting, but I hope the above is
somewhat useful.

[1]  I change /dev/sda2 to /dev/sda3, further on, to insert swap.  Don't
    be confused.

[2]  If you need to move files around, just boot a live CD and use
rsync.  See:  "Copying Directory Trees" on http://linuxmafia.com/kb/Admin .

conspire mailing list
conspire at linuxmafia.com

More information about the conspire mailing list