Dividing your disks into partitions allows you to use each partition for separate tasks.
Listen to the full episode or read the full transcript below for more details including a description of the Master Boot Record (MBR) and GUID Partition Table (GPT) partitioning schemes.
Would you buy a house that had a single cupboard in the kitchen with one giant shelf? No drawers to keep forks and spoons. Just one big storage space. What if you had to keep your clothes there too?
And while at work or school, would you use a single roll of paper instead of separate sheets that can be stored in folders?
We need to organize things and that goes beyond just sorting. We need to group things too. These groups can be used for very different things.
As computer disks have grown in capacity over the years, the need to divide them into multiple groups has grown.
This is called partitioning your disk. Each partition can then be used for different purposes. Maybe you want one partition to hold all the operating system files. Another partition can hold your applications. Another for data file you create. Another for log files that record useful information about what your computer is doing. Another for swap space that the operating system can use when the main memory gets low. The reasons are as plentiful as there are people to use computers.
Now, dividing your disks is something that you’ll want to do from the very beginning. You don’t want to be creating new partitions later, or combining existing partitions into one, or resizing partitions. This would be like moving into a new house and realizing that your kitchen really needs to be twice as big. You probably should have chosen a different house or a different design if you’re building it new.
Making partition changes is also something that you should do before using your computer. Sure, there are some exceptions and you might be able to make some changes later. But it’s a lot better to get this right in the beginning.
You want to plan for reasonable future needs without going overboard. Remember that you can get along just fine with a single partition. So I’m not advising you to create partitions that you don’t really need. If you’re not already aware of the need for a separate partition, then you probably don’t need it.
As a programmer though, you do need to be aware of the concept of partitions. Maybe you want to sometimes start up your computer with Windows and other times with Linux. You could buy two computers. Or you could use partitions to divide your hard drive into parts usable by Windows and other parts usable by Linux. And other parts can be shared.
How you partition a disk will depend on which operating system you’re using and can change over time as well. Each operating system comes with applications that can do this for you. And sometimes, there are 3rd party tools you can install which might give you more control over the partitioning or an easier user interface. A lot of the tools that come with the operating systems are not known for being easy to use.
You also might want to partition removable disks and storage devices. Especially as the capacity of these gets bigger. Just be aware that different operating systems might be okay with this while others might cause problems. For example, I think Windows will only let you access the first partition on a removable disk. Or maybe it’s an active partition where you can only choose one partition at a time. You could insert that same device into a Mac computer and get access to all the partitions.
However you decide to partition your disks, all the information will be stored in a partition table. In addition to how you want to organize your partitions, you also need to choose which partitioning method to use.
When I first started using computers, there was only one partitioning scheme called the master boot record or MBR for short.
You might be familiar with the word boot. It’s not a type of footwear. It means to startup. In this case, booting your computer means to start it and load the operating system. And rebooting your computer means to restart it.
The master boot record is an area at the very beginning of your disk taking up 512 bytes. Most of this is needed for the bootloader which is just the instructions needed to start your operating system. After the bootloader but still inside the 512 bytes, you’ll find the partition table.
It’s the partition table that defines how your disk is to be divided. You can have up to 4 partitions. Each partition is called a primary partition. What do you do if you want more than 4 partitions? Well, this always seemed strange to me but the way to get more than 4 partitions is to turn one of the primary partitions into an extended partition. You can only do this to one of the primary partitions and it’s usually the last one. This gives you up to 3 primary partitions and 1 extended partition.
Okay, now that you have your extended partition, how does this help? You can now create as many logical partitions as you want. The only thing to remember is that all the logical partitions exist inside the one and only extended partition.
It’s also possible to not use a partitioning scheme and have the entire disk devoted to the filesystem. When you do use partitioning, then you can select the type of filesystem that will be used for each partition.
MBR has some problems and is showing its age. For example, you can’t use MBR to partition disks larger than 2 terabytes. Although if you have an older computer, then MBR may be your only choice.
A new scheme called GUID partition table or GPT for short was introduced along with the Unified Extensible Firmware Interface or UEFI for short. UEFI provides a standard method for operating systems to be started and to interact with the computer firmware.
The firmware is the programming that is included with the computer or device hardware. And hardware is the actual electronics that make up the computer. UEFI was created to provide a common interface to computers that the operating system can use. If your computer has support for UEFI, then you should probably be using GPT for your partitioning.
If there’s nothing forcing you to use either MBR of GPT, then you should really consider using the newer GPT scheme in your partitions.
There are a lot of details that I’m skipping over here. For a couple reasons. First, this is not something that I’m an expert with. And second, this is probably not something that you really need to be an expert in either. If you do need to know more about UEFI and partition schemes, then this episode should give you enough background information to help you get started. And if you don’t need all that detail, then trying to explain it will only add confusion to what should be a simple concept.
All you really need to remember is that you can partition your disks so that each partition can have its own filesystem to be used for its own purpose.
Hard drives will have full support for partitions even if the tools are sometimes difficult to use. Floppy disks and other removable storage devices will give you varying results depending on which operating system you’re using. Normally, removable disks will not be using partitions. But this could become more common as they become larger.