Partitioning a hard drive: for Mac, Windows, and Linux

Partitioning a hard drive: for Mac, Windows, and Linux

Partitioning means writing the hard drive sectors that will make up the partition table. It contains information on the partition, including sector size, position with respect to the primary partition, types of partitions present, operating systems installed, etc. When a partition is created, it is given a volume name, which allows it to be easily identified. Read on for more information.

What is a partition?

The partitioning of a hard drive occurs after the drive has been physically formatted but before it is logically formatted. It involves creating areas on the disk where data will not be mixed.

It can be used, for example, to install different operating systems that do not use the same file system. Therefore, logically there will be at least as many partitions as operating systems using different file systems. A single partition of the full disk size is sufficient if you use just one operating system. That is unless you want to create several partitions to have several drives on which data is kept separately.

Three types of partitions exist: primary, extended, and logical. A disk may contain up to four primary partitions (only one can be active), three primary, and one extended partition. In the extended partition, the user can create logical drives (i.e., "simulate" several smaller-sized hard drives).

Here is an example of where the disk contains one primary partition and one extended partition made up of three logical drives:

Primary partition & Extended partition
© Primary partition & Extended partition

For DOS systems (DOS, Windows 9x), only the primary partition is bootable and is, therefore, the only one on which the operating system can be started.

What is Master Boot Record?

What is a “master boot record”? The boot sector (called the Master Boot Record or MBR) is the first sector of a hard drive (cylinder 0, head 0, sector 1). It contains the primary partition table and the code, called the bootloader, which, when loaded into memory, will allow the system to boot up.

After it is loaded into memory, this program will determine which system partition to boot and will start the program (called the bootstrap), which will start up the operating system present on that partition.

This disk sector also contains all the information concerning the hard drive (i.e., manufacturer, serial number, number of bytes per sector, number of sectors per cluster, number of sectors, etc.). This sector is, therefore, the most important on the hard drive and is also used by the BIOS setup to recognize the hard drive. In other words, your hard drive is useless without it, making it a favourite target for viruses.

What are the different file systems?

In this section, it is essential to differentiate between the FAT file system and the file allocation table (FAT).

FAT is the file system used by DOS operating systems (DOS and Windows 95, as well as Windows NT and OS/2, which support it).

Operating system Associated file system
Windows XP NTFS
Windows 98 FAT32
Windows 95 FAT16 - FAT32 (for version OSR2)
Windows NT NTFS
Linux Linux Ext2, Linux Ext3

FAT file systems are characterized by using a file allocation table and clusters (or blocks).

Clusters are the smallest unit of storage in a FAT file system. A cluster represents a fixed number of disk sectors.

The FAT (File Allocation Table) is the heart of the file system. It is located in sector 2 of cylinder 0, head 1 (and is duplicated in another sector as a precaution in the event of an accident). This table records the numbers of the used and where the files are located in the clusters.

The FAT file system supports disks or partitions up to a maximum size of 2 GB but only allows at most 65,536 clusters. So, whatever the size of the partition or disk, there must be enough sectors per cluster so that the entire disk space can be contained in these 65,525 clusters. As a result, the larger the disk (or partition), the greater the number of sectors per cluster.

The FAT file system uses a root directory (represented on the operating systems that use this type of file system by the symbol C:\) , which must be located at a specific location on the hard drive. This root directory stores information on the sub-directories and files that it contains. For a file, it will store the file name, the file size, the date and time the file was last modified, the file attributes, and the cluster number at which the file starts.

What about using multiple partitions?

As mentioned before, there are three types of partitions: primary, extended, and logical drives. A disk may contain up to four primary partitions (only one can be active), three primary, and one extended partition. In the extended partition, the user can create logical drives (i.e. create the impression that there are several smaller-sized hard drives).

Primary partition

What is a “primary partition”? A primary partition must be logically formatted and have a file system appropriate to the operating system installed on it.

If you have several primary partitions on your disk, only one will be active and visible at a time, depending on the operating system with which you started the computer. Choosing which operating to load at start-up determines which partition will be visible. The active partition is the partition from which one of the operating systems was loaded when the computer was started up. The other inactive partitions will then be hidden, preventing their data from being accessible. Therefore, the data on a primary partition is only accessible from the operating system installed on that partition.

Extended partition

Now that we’ve discussed the primary partition, it is time to answer the question of what is “extended partition”? Extended partitions were developed to overcome the limit of four primary partitions, as you can create as many logical drives as you want in them. At least one logical drive is required in an extended partition, as you cannot store data in them directly.

Many machines are formatted with one large partition using up all available space on the drive. This is not, however, the most advantageous solution in terms of performance and capacity. The solution is to create several partitions, allowing you to install several operating systems on your disk, save disk space, increase file security, and organize your data more efficiently.

Here is what a system containing several operating systems looks like:

System containing several operating systems
© System containing several operating systems
do you want to know more about partitioning? check our forum!
Around the same subject