Table of Contents

Disk Partitions

Introduction to Partitions

When the IBM PC was first launched, it came with a simple disk operating system called DOS, provided by Microsoft. For the PC-XT and its hard disk, IBM made a decision that a PC might ultimately have up to four operating systems installed at the same time. Each operating system would have its own portion of the disk, called a partition. For this reason, the first sector of each disk on a PC, called the MBR (Master Boot Record), contains a table with four entries, each giving the starting and ending locations of the four partitions.

The order of the four entries in the MBR need not correspond to the actual order of the partitions of the disk, and there may be gaps between the partitions and before the first one and after the last one. Some thought reveals that in the worst case, a disk may have as many as nine regions: four partitions and five gaps, like this.

www.minix3.org_doc_part-1.jpg

It is also possible for a single operating system to use multiple partitions. For example, a user might decide to partition the disk with two partitions, one for the operating system and one for user data. This arrangement makes it easy to back up user data without having to back up the operating system. It also makes it easy to install a new version of the operating system without losing any user data.

It was not too long before IBM and Microsoft decided that four partitions was not enough. Rather than simply make the partition table in the MBR bigger (which would not have been backward compatible with previous versions of MS-DOS), it was decided that (normally only one) partition could be marked as EXTENDED, meaning that it contains one or more subpartitions, called logical drives. A partition that is not an extended partition is called a primary partition. Together, the primary and extended partitions comprise the four top-level partitions.

Unfortunately, nearly all disk partitioning software displays the primary and extended partitions, and logical drives in such as way as you might think they are all equals. This is definitely not true and is quite confusing as each logical drive is a subpartition of some enclosing extended partition. In addition, some partition management software displays partitions in the order they appear in the MBR, rather than in order of their disk addresses.

MS-DOS and Windows are normally configured with one primary partition and optionally one extended partition. In most cases, the primary partition is called C: and the extended partition, if present, contains D:, E:, etc., depending on how many logical drives have been created there. The advantage of putting D:, E:, etc inside an extended partition, instead of allocating each one its own primary partition, is that it leaves MBR partition table slots available for other operating systems. Below is an example disk showing one primary partition (C:) and one extended partition containing two logical drives (D: and E:).

www.minix3.org_doc_part-2.jpg

It is important to realize that the entire concept of drive letters, like C:, is an MS-DOS concept, later taken over by Windows. No variant of UNIX, such as BSD, Linux, or MINIX 3, uses drive letters at all. All UNIX systems simply deal with the four top-level partitions in the MBR.

Partitions and MINIX 3

When installing MINIX 3, you have to deal with two resources: partitions and free disk space. MINIX 3 needs one primary partition (i.e., one MBR table slot) as well as at least 700 MB of free contiguous disk space. Logically, one of four conditions holds:

Condition One MBR slot is free at least 700 MB contiguous disk free
1 true true
2 true false
3 false true
4 false false

Each case must be dealt with separately. The first one is easy. MINIX 3 can be installed immediately. During setup, it will ask if it can take the disk space and you will agree. The second case is harder. Some existing partition must be deleted or resized to free up 700 MB of disk space. The third and fourth cases require deleting a partition to free up an MBR table slot. Additionally, one of the remaining partitions may have to be resized to free up enough disk space. Note that if a partition is deleted, all data on it will be lost.

A common case that many beginners face is the second one: the entire disk consists of a single primary Windows partition, C:. There are three available MBR table slots for MINIX 3 to choose from, but there is no free disk space. The only solution is to resize the C: partition to free up at least 700 MB of space.

To delete or resize a partition, you need a program called a partition editor. MINIX 3 has such a program, called part. You have to be careful using it since one typing error can wipe out your disk.

Complicated as all this may be, there is one more complication we have to explain. Each primary partition or logical drive contains one file system. Extended partitions do not contain file systems–they just hold logical drives. Imagine a car trunk (a disk) that can hold up to four boxes (partitions), each of which can contain a fragile bowl (file system) or one or more smaller boxes that each contain one bowl. An outer box with two bowls (a primary partition with two file systems) is not permitted.

Many different kinds of file systems exist. Windows alone supports four types: FAT-12, FAT-16, FAT-32, and NTFS. MINIX 3, Linux, BSD, and other UNIX systems each have one or more supported file system types. If all you want to do is delete an entire partition and free up all its disk space, then the type of file system it holds is irrelevant. The problem comes in when you want to resize (e.g., reduce) a partition to free up some disk space at the end. In order to resize a partition, the partition editor has to understand the internal layout of the file system on it and different partition editors understand different file system types.

In summary, you have to make sure you have a free partition (MBR table slot) and at least 700 MB of contiguous disk space. If you already have this, you can start installing MINIX 3 now. If you can achieve this situation by just deleting an existing partition, you can also start installing MINIX 3 now since the setup procedure allow you to delete partitions. However, if you first have to resize a partition, you need a partition editor that can resize the partition you have selected for reduction and you have to do this before starting the MINIX 3 installation using a partition editor that can handle the type of partition you want to resize.

How to Partition Your Disk

Before starting to manage your disk partitions, be sure to back up your files to CD-ROM or DVD to prevent losing them all in the event something goes wrong during the partitioning process. It has been known to happen. In what follows, we will assume you are running Windows, since most people running BSD or Linux have already encountered this problem and presumably now know how to partition disks.

What you have to do depends on whether you have enough free space and a free partition. Keep in mind that the goal is end up with at least one free partition and at least 700 MB of contiguous free disk space.

Step 1: Inspect the disk.

Determine how many partitions you have and their types as well as their sizes. On Windows, they are most likely NTFS. To find the partition information, please follow the procedure below.

  1. Click on Start > Run
  2. Type diskmgmt.msc in the Open box
  3. Give the administrator password if necessary, and click OK

Step 2: Decide on a course of action.

If there is 700 MB of contiguous free space and not more than 3 partitions, you can begin installing MINIX 3 now. Similarly, if there are one or more partitions that you are willing to delete and whose removal will give you 700 MB of contiguous free space, you can also begin installation now. If all four top-level partitions are in use, you must select at least one for deletion. If there is a free partition (i.e., MBR table slot) but insufficient free disk space and you want to keep all partitions, you have to select a partition for resizing.

Step 3: Defragment the selected partition.

If a partition has to be resized to free up enough space, first defragment it to put all the data at the beginning and leave all the free space at the end to make resizing possible. Windows comes with a defragmenting program. The click sequence for starting the disk defragmenter is as follows: Start > Programs > Accessories > System Tools > Disk defragmenter. When the program starts, click on the partition to be defragmented and then click on 'Defragment.' Then defragment the same partition again as a second pass usually finds more fragments.

Step 4: Resizing the partitions

If you need to resize a partition, you need to find a suitable partition editor that can resize partitions of your chosen type. If you are using Windows Seven or Vista, you should use the built-in partition editor. Some commercial programs exist, but we will focus on free partition editors here.

The process for resizing a partition under Windows Seven or Vista is below:

  1. Click on Start > Run
  2. Type diskmgmt.msc in the Open box
  3. Give the administrator password if necessary, and click OK
  4. Right-click the partition you want to resize, and then click 'Shrink Volume'

If you are using Windows XP or earlier, you will need to use a third-party tool. The main free option is to use a Linux LiveCD that includes GParted, an open-source partition editor. All of the LiveCDs work the same way: You first download a CD-ROM image containing a bootable Linux system. These images files are normally about 700 MB. Then you decompress the file if need be and burn it to a CD as a CD image file. Then you boot the computer and wait until setup completes. The result will be a running Linux system, albeit with nothing installed on the hard disk. Then you have to run the partition editor, gparted, to resize a partition. Detailed instructions for MEPIS 8.0 are given below, but the others are similar. Again, before using any partition resizer, back up your data to CD-ROM or DVD.

Using MEPIS

If you are still having problems, subscribe to the Google newsgroup and post your question there. There is a good chance another MINIX 3 user can help you.

Web Resources