The Advantages of Partitions
When people ask me why Linux is better than other operating systems, one of the first things I always mention is partitions. It's common for a linux installation to have eight or more partitions.
- Data storage efficiency
Partition Basics:So what exactly is a partition? Well, it's just what you'd think. It's a divider. "Partitioning" a hard drive simply means splitting into little pieces. Each partition is treated similar to a hard drive itself.
There is a vast array of both free and non-free partitioning software for every operating system around; and pretty much all operating system installers come with a way to partition your hard drive.
Many hard drive formats have no limit to the number of partitions they can have. Some windows and linux distributions limit you to four, although with the linux ones you can make "logical" partitions inside the "primary" ones. While only the four primary partitions are bootable on some systems, creating a very small "boot" partition at the head of the disk--inside the Master Boot Record (MBR)--and installing a boot loader on it will allow you to boot from any part of your drive.
Partition Advantages/Why you should partition your hard drive:I mentioned four reasons earlier why partitioning your hard drive is a good idea. I'd like to spend a minute expanding on those, giving examples and adding a couple more incentives.
I'd say the strongest argument for partitions is safety and security. When partitioning a hard drive, one of the first things I recommend people consider is making a separate partition for their operating system and a separate one for their files.
Separating your operating system and files means that if something happens to one, the other is more likely to be safe. If you need to reinstall your operating system(OS) and all of your files and applications are on a different partition, you can simply wipe your OS partition and start over, with very little lost time.
Likewise, if something should happen to your files, you still have a perfectly fine operating system to try to get them back with.
Another reason to separate your operating system and files is to avoid overflow attacks, either accidental or intentional. A common hacker trick is to bombard your computer with so much useless information that it uses up every last bite on your hard drive and halts your computer. If your OS is on a different partition then your firewall logs, that isn't a problem.
Overflows aren't limited to hackers however. If you've ever had a renegade program spit out data uncontrollably, you know what I mean. One rouge process can bring your system to its knees if you put all your eggs in one basket.
One of the reasons Linux distributions have so many partitions is to allow for different permissions to be set for each one. I wont go into permissions too much now, but there are three basic flags that files, folders and partitions have on unix machines. They are Readable, Writable and Executable, with every combination in between. Not only do these flags exist, but they can be set differently for different "users." A file could be set to executable for "root" but read-only for "admin". Likewise the system has permissions as to what it can and can't do. Where I'm going with all this is that some important system files are more secure with different permissions. Restricting executability is perhaps the most important function of separate partitions. By having a buffer in between the internet and your system where no files can be executed, you ensure that no malicious code runs itself without your knowledge. On Mac and Windows this isn't quite as feasible, but it is still useful to some degree.
Having your OS and files on separate partitions makes upgrades a breeze. If you want to backup your system before you change operating systems, you only need to back up your smaller OS partition.
Separating your files and applications from your OS also makes it much easier to share common things between multiple operating systems installed on different hard drives or partitions. By having one large partition that holds all of your documents, music, applications etc. you can easily share those files between all the operating systems you might have installed. This saves you space by preventing duplicate files.
Any standalone application--one that doesn't require an installer--can immediately be shared across operating systems. For larger and more complex programs--like the Adobe Creative Suite--lots of specific smaller files need to be placed in important system folders, but the bulk of the files being written to disk are simply that of the application itself, which can later be shared by any operating system that has undergone the install. Another trick is to simply alias a program or the entire Applications folder.
After suggesting a different partition for the operating system and for files and applications, I usual suggest having an "emergency partition." This one should be much smaller than the operating system partition and contain a very stripped down OS with all the tools you'll ever need in an emergency. Despite it's name, an emergency partition is very useful in situations that aren't emergencies.
A lot of maintenance tasks require you to unmount your hard drive in order to proceed. Because you can't unmount a hard drive you are currently running from, you need to boot from another drive to do these actions. If you don't have a second operating system installed with the tools you need--like the emergency drive I propose people make--you will need to boot up from a CD that contains the tool you want. While CD's are nice, they are very slow and prevent you from working while you use them.
If you have all of your maintenance tools installed on your emergency partition you can continue using your computer while you maintain your main partition. You also don't have to constantly change boot discs. When one programs finished, you simply launch the next one until you're done. Because everything--including your operating system--isn't running from the RAM, like a bootable CD or DVD, programs will run much much faster and more reliably.
If at all possible, I urge people to make their emergency partition on a second hard drive. The main reason for this is that if something were to physically happen to your main hard drive, all of the tools you might need to diagnose, fix or recover data from that hard drive will still be accessible. It also allows you to reformat or partition your main hard drive if that is something you need to do.
Multiple hard drives are almost always better than multiple partitions. However, multiple hard drives cost money and are often limited by the number of free chains or ports to connect them to. Partitioning is a free and easy way to segment your data.
The final benefit that partitions have which I would like to bring up is speed. Even disk formats like HFS+ get fragmented, which greatly slows down read and write times, in turn decreasing the overall operating speed of the entire system.
Because reading and writing large files--which OS files usually are not--is one of the main causes, it makes sense to separate you large files from your operating system. Because an OS frequently reads and writes files, the more fragmented a disc is, the slower the OS will run. Fragmentation on a storage partition will have no effect on an operating system.
This idea is especially important the larger your files are and the more frequently they are written to disc. The main field you see this in is audio and video production. That is why it has been the industry standard for many many years to have a separate partition or hard drive to hold all the files you're working with. While it might not be quite as crucial for you to do, you will certainly notice the difference in speed.
Another way that partitions can speed things up is by assigning custom block sizes for different partitions. When a hard drive or partition is formatted, it is assigned a block size. The block size is the size of the pieces a file is split into before writing it to disc. When everything is on one partition, a relatively inefficient block size is used to anticipate files of any size. If you know the average size of the files to be written to a disk, you can optimize the block size which will reduce fragmentation and increase read and write speeds. I will admit that this is a relatively complex concept for your average user; however, it is yet another advantage that partitioned systems have over their non-partitioned counterparts.
A (relatively) ideal partitioning setup:A question that is likely going through your mind at this point is: What is the best way to partition my hard drive?
Unfortunately there is no good answer to that. The answer depends entirely on your situation. How much space you have, across how many hard drives, as well as what your intended uses for the system are, are the main factors in how you should partition your setup.
I would recommend that all people have the following partitions:
- Main Operating System
- Files and Applications
and for people who read and write large files often:
- "Scratch" read/write
If a second hard drive is available, that is where the emergency/maintenance partition should reside. However, if one and only one second hard drive is available, a thorough and frequent backup is the most important thing that it can be used for. An emergency partition and a good backup are not mutually exclusive.
For standard use, these would be my partitioning recommendations given the following hard drive arrangements.
At this point in the article you might be wondering: Is it still too late to change my partitioning scheme? About 14 years ago the answer to that was no. Today it can be achieved through what is known as Live or Non-Destructive Partitioning. A very clever person figured out that if you take the data that's scattered about the entire disk and crunch it down to one compact location, new partitions can be made with the empty space. Of course, a partition with the size of the files currently on the disk must also be present, but the rest of the space can be freely divvied up. Like partitioning in the first place, repartitioning requires you to unmount the target hard drive and hence be booted from another media. That is yet another reason to keep a maintenance/emergency installation on a second hard drive.
If you're looking for a tool to repartition your hard drive, I would suggest a linux tool called gparted if you're using Linux or Windows. If that's over your head you can always use Partition Magic. If you're using a Mac, I would recommend DriveGenius, and if that fails or you need more options, iPartition.
Due to the nature of live partitioning, it is even more recommended that you back up your files before attempting it.