[logo]     MINIX 3 - Tutorial on Disk Partitions [logo]

Introduction to Partitions

When the IBM PC was first launched, it came with a simple disk operating system called MS-DOS, provided by Microsoft. 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.


[four partitions]

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 up to three of the partitions could be marked as EXTENDED, meaning that they contained 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 partitons, 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: an 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:).


[primary and extended partitions]

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 partition (i.e., one MBR table slot) as well as 200 MB of free contiguous disk space. Logically, one of four conditions holds:

  • An MBR table slot is free and also 200 MB of contiguous disk space
  • An MBR table slot is free but there is not 200 MB of contiguous disk space
  • The MBR table is full but there is 200 MB of contiguous disk space
  • The MBR table is full and there is also no 200 MB chunk of disk space

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 200 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 200 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, but 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 200 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 200 MB of contiguous free disk space.

Step 1: Inspect the disk. Determine how many partitions you have and what types they are. On Windows 95, 98, and ME, all partitions are FAT partitions. On Windows 2000 and XP they could be either FAT or NTFS, so proceed as follows:

  Windows 2000
Click on Start
Click on 'Help'
Type 'disk management' in the dialog box
Double click on 'overview' in the left pane
Click on 'disk management' in the right pane
 
  Windows XP
Click on Start
Click on 'Help and Support'
Type 'disk management' in the dialog box
Click on 'Using disk management' in the left pane
Click on 'Computer management (Local)' in the right pane
Click on 'Disk management' in the new window

Examine the display to determine the number of partitions, their types, and their sizes.

Step 2: Decide on a course of action. If there is 200 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 200 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 4a: Resizing a FAT partition. If you need to resize a partition, you need to find a suitable partition editor that can resize partitions of your chosen type. Some commercial ones are listed below, but we will focus on free partition editors here. If you need to resize a FAT partition, a good choice is Partition resizer. It is included on the MINIX 3 CD-ROM as presz134.zip. After downloading it or copying it from the CD-ROM, unzip it and copy presize.exe onto an MS-DOS floppy disk and boot the computer from this floppy. Then run presizer.exe. If you do not have MS-DOS, see if you have a Windows 95, 98, or ME boot floppy. Usually they are MS-DOS systems. On Windows XP, go to Windows Explorer and right click on A:, then select 'Format' from the menu. Check the 'Create an MS-DOS startup disk' box. Or get FreeDOS. If you do not have a floppy disk drive, use an NTFS partition resizer as described below.

Step 4b: Resizing an NTFS partition. Several NTFS partition resizers exist, but they do not work on all computers, so you may have to try several before settling on one. Again, be sure to back up all your data before starting to resize.

A commercial program that offers a free trial is BootIT NG. To use this one, click on 'Bootit Next Generation' in the 'Downloads' menu and save it to your hard disk as Bootitng.exe. Then proceed as follows:

Using Bootit NG
  1. Unzip Bootitng.zip
  2. In Windows Explorer, double click on Bootitng.exe to run it.
  3. Select the 'Build Diskette' option and hit ENTER
  4. Insert a floppy disk in the drive and hit ENTER
  5. When the process terminates, reboot the computer from the floppy
  6. In the Welcome to Setup box, click 'Cancel'
  7. In the Notice box, click on 'OK' to enter maintenance mode
  8. When the icons appear, click on 'Partition Work'
  9. Select the drive using the radio buttons at the left
  10. Right click the partition to resize and select 'Resize'
  11. In the dialog box, click 'OK' to check the file system
  12. When it asks for a size, fill in the size and click on 'OK'
  13. In the Resize box, click 'Continue'
  14. After it completes resizing, click 'Close'
  15. Click 'Close' again to exit the program
  16. Remove the floppy and click on 'Reboot'

The main free alternative is to download, burn, and use a Live Linux CD containing a suitable partition editor. All of these 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. Easy CD-Creator uses .iso files, but for Nero you have to change the extension to .nrg. 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, qtparted, to resize a partition. Detailed instructions for MEPIS 3.3.1 are given below, but the others are similar. Again, before using any resizer, back up your data to CD-ROM or DVD.

Using MEPIS
  1. After the CD-ROM boots, hit ENTER
  2. In the Login box, use Username=root and Password=root; click on 'Login'
  3. Wait until the CD-ROM stops (takes several minutes)
  4. Click on the "K" in the lower left corner of the screen
  5. Click on 'Run command' from the menu
  6. Type: qtparted in the dialog box
  7. Click on the disk to resize, usually /dev/hda
  8. Right click on the partition and select 'Resize' from the menu
  9. Enter the new size
  10. Click 'OK'; the selected partition will turn red
  11. In the 'File' menu, click on '&Commit' and then click on 'YES'
  12. When it says 'Operations completed successfully,' click on 'OK'
  13. In the 'File' menu, click on '&Quit'
  14. Click on 'K' on the taskbar, then select 'Logout' then 'Restart'

Another approach is to use G-Parted. A final NTFS resizing option is to use the NTFSresize program from the command line, being very careful that you do not make a typing error. After the partition has been resized, you must use a partition editor to delete the partition (which only removes the MBR table entry), then immediately create a new partition of the reduced size in its place. If done right, the NTFS file system will be completely intact. This alternative is not for the faint of heart though. The manual for the ntfsresize program is here. Fortunately, several graphical front ends for it exist, making the process much easier.

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

  • Boot it NG - A commercial partition manager ($34.95) with a free trial
  • Partition Magic - A powerful commercial partition manager ($69.95)
  • Partition Commander - Another commercial partition manager ($49.99)
  • Partition Resizer - A free, simple MS-DOS resizer for FAT partitions
  • MEPIS - A Live Linux CD-ROM that contains QtParted
  • System Rescue - A Live Linux CD-ROM that contains QtParted
  • NTFS Resize A FAQ on this popular resizing program and where to get it in many forms