Partitioning Basics

This post was published 8 years, 9 months ago. Due to the rapidly evolving world of technology, some concepts may no longer be applicable.

One of the necessities of a multi-boot setup is partitioning, but the uses of partitioning go far beyond its application to multi-boot setups.

The act of splitting a drive into multiple logical parts is known as partitioning; each part is called a partition. A physical drive refers to the actual, tangible device, while logical drives refer to what an operating system typically displays in a file manager.

Partitioning a hard drive yields multiple logical drives from a single physical drive (typical, although it can be performed on multiple physical drives (e.g. RAID setups)). That is one hard drive in your computer is recognized by your operating system as multiple drives. Each drive is assigned a different letter (under windows) or is displayed as its own device (with its own mount point, under Linux) and its own space.

Advantages of partitioning

Organization: different types of files can be kept on different drives and not interfere with the operation of the computer

Fragmentation: in order to use the space available on a volume (generic name for partition, drive, etc… anything that is assigned a letter (e.g. C:\) by the operating system) the file system (e.g. NTFS, FAT32, etc) will break files into parts (fragments) to fit them into available spaces; fragmentation can only occur if files are deleted, and will be more evident as the number of deletions increases and the size of the files deleted decreases. To illustrate, if you have 10 files ranging from 1 to 10MB in 1MB increments on a 60 MB drive; the 10 files will take up 55MB, you have 5 MB free; if you add a 3MB file, it will be physically added after the last file; if you now delete the 2MB file, your free space has increased (to 4 MB) however, you do not have 4 MB of continuous space on your hard drive but rather two 2MB regions of free space (one at the end of the drive which was never filled and one from the deleted 2MB file). If you now want to add a 3 MB file to the disc, it must be broken into two parts. The file system will fill the available free regions in the order in which they physically exist on the drive. Therefore, the 2MB from the deleted file will be filled first (leaving 1MB) and the remainder of the file will be placed in the free region at the end of the drive. The file system keeps track of where a file and its fragments are using a database called the MFT (master file table). Clearly, it will take longer to access a file that is broken into multiple parts than it will take to access a file that is in a single piece. The act of defragmenting a drive will reunite all the separated pieces of each file on the volume and will typically make a computer run a bit faster (most defrag programs require about 15% free space in order to work well). With a smaller volume, the process of defragmentation will be considerably faster. Additionally, defragmentation of the volume containing the operating system generally takes at least twice as long as defragmenting a comparable amount of data on a non-system volume. With the advent of SSDs, the issues of fragmentation is less relevant, but until SSDs become more cost-effective, fragmentation cannot be ignored.

Cluster size: Each partition divided into fragments called clusters. These clusters represent the smallest unit of storage that can be allocated on the drive. Common cluster sizes are between 512B and 4kB, although cluster sizes can exceed 64kB. A smaller cluster size results in more overhead, but less wasted space, while a larger cluster size results in less overhead but more wasted space. If, for instance, a 5kB file is stored on a partition with a 2kB cluster size, 3 clusters will be allocated (6kB), and there will be 1kB of wasted space. If a partition will store files of similar sizes (e.g. videos are large, text documents are small, etc), it can have merit to adjust the cluster size (i.e. a large cluster size for a drive storing videos will reduce the number of fragments, and may increase read/write performance). Some platforms, however, do not handle varied cluster sizes well and may become unstable with certain cluster sizes (this becomes particularly relevant in RAID configurations).

Efficiency: since a smaller space is allocated to each drive, a computer will be able to locate requested files faster and generally perform better. A drive dedicated to the operating system and software, can be maintained independently of one for videos or documents. This allows both a custom cluster size and reduces fragmentation on each partition.

Shared files: on a multi-boot system, it is possible to share files between operating systems. One of the best ways of doing this can be to use partition with a file system that is recognized by all the operating systems in question, and keep any shared files on that partition.
There are other possible benefits (e.g. security, restricted access, etc), however, these are dependant on what a person wishes to achieve and how the partitions and system environment is set-up.

Basic Process

The act of partitioning essentially involves the following basic steps:

  • move all the data to the front of the volume (defragment) or format volume
  • split volume after point where data ends
  • format the new volume to the desired file system
  • update the partition table with information about the new partition

Typical Approaches

There are two typical ways in which partitioning is performed:
Partitioning can sometimes be done while running Windows, however it is not recommended as it is likely to be very slow, and likely to encounter many problems (is isn’t possible on a drive that has only a single volume, as the volume must first be unmounted). The process is therefore typically carried out from a standalone bootable environment.

Command Line

One way is to do the process ‘manually’ (from a command line) as in each step must be carried out individually, and precisely. I really wouldn’t recommend trying this method if you wish to preserve the data on your computer unless you are well versed with partitioning. If you plan on formatting your hard drive, then it is acceptable to try out this method.

  • DOS: use fdisk (to partition) and format (to create the file system)
  • Linux: use fdisk (to partition), mkfs (to create the file system), (dd might be needed to zero the first sector for DOS compatibility)
  • For both Linux and DOS, you will need to make/use a bootable disk. With Linux, live CDs are available, most of which will already have the necessary tools on them. You would partition (it is important to check where your data resides on the disk, and to defragment first if the disk isn’t empty) and then format the new partition.

Graphical Interface

A far easier way, is to use a program that perform the necessary steps. There are many programs for this task: my personal preference is Acronis Disk Director (used as a bootable disk, not through Windows), followed closely by Parted Magic (which uses GPartEd). For older systems, Partition Magic was a good choice, but is quite hard to come by these days.

These programs have a graphical interface, and allow you to use a mouse. You will be able to see the layout of your drive and will be able to partition by specifying where you wish the new volume to begin. You will need to define the primary partition(s) and the extended partition (which will contain logical partitions). These type of partitioning programs will also allow you to partition without affecting your existing data. It is important to note that Windows must be installed on the first partition (although, some more recent versions will accept any primary partition). Linux operating systems will boot from both primary and logical partitions.

Other considerations when partitioning

Do you wish to make a backup image before beginning?

This will allow you to format your hard drive, create your partitions, and copy all your data back; the data will automatically be defragmented since you will be adding files to an empty volume. Additionally, partitioning of a blank volume is almost instantaneous whereas partitioning of a volume containing data can take a considerable amount of time (from about 10 min to a few hours, depending on how much data you have). Programs such as Acronis True image and Norton Ghost are well suited to this task, as well as more manual methods. Unless you have nothing to lose, it is a good idea to make a backup.

Do you wish to reinstall your software?

Typically people accumulate a lot of software and files they do not require, and when you reinstall your software you will typically only put on the programs you need; additionally, since this includes reinstalling your operating system, the computer will generally perform considerably better since you will have minimized your registry, and eliminated all the unnecessary files that the operating system and other program add with time.

If you are going to reinstall your O/S do you wish to create a slipstreamed disc?

A slipstreamed disc is one that contains additions to the core setup files (typically seen for major installations e.g. Windows). examples include the windows service packs (SP1, SP2), hotfixes, windows updates, and other miscellaneous addons. The advantage of this is that Windows will be fully up to date after the install, and it typically results in a cleaner system than installing and then updating. Also there are some interesting addons that can only be added in this manner. (Linux and OS X do not, to my knowledge have slip streamed disks).

Computer Maintenance

While slightly off-topic from partitioning, the idea of computer maintenance is not entirely unrelated. Since computers do require regular maintenance, to keep a computer running optimally, the following options exist: a periodic maintenance ritual or a periodic format and reinstall.

Obviously a bit of maintenance is recommended, however eventually a system will slow down no matter how well it is maintained. Formatting and reinstalling everything requires a good bit more patience and is quite a bit harder.

A good maintenance schedule will take about 30-45 min to run through and is generally performed weekly. Someone who is comfortable with partitioning and formatting and reinstalling software will typically take 3-5 hours to fully restore a machine.

While it is true that it is possible to have most maintenance tasks run automatically, I tend to be on a computer at any hour so there is no fixed time when running these tasks would not deter from what I am doing. Moreover, I tend to go through ‘phases’ where my software will match my current interest – a few months later, a particular program will be left essentially unused. Even after software is uninstalled, a ‘footprint’ is left behind, and a computer’s performance has degraded slightly.

I therefore opt to let my computer degrade slowly and reinstall my operating systems twice a year. Formatting is a relatively quick process (less than 5 min), however there are two additional things that are required; firstly, one must backup all the data they do not wish to lose – while this used to be a very time consuming task, with a properly partitioned disk, it takes only a few minutes (all the valuable data is already on a separate partition that will not be erased, only programs remain on the disk that will be erased). Once the format is complete one must put back all the programs that were on the computer starting with the operating system (this takes around 3 hrs, the operating system itself takes between 15 and 60 min depending on your computer and the O/S). While I am formatting, I will typically also adjust the size of my partitions as my needs for each volume change over time.

I typically keep the following paritions: Windows, Linux: Ubuntu, Apple’s OS X, Music, Documents, Web, Spare, Videos

It is also relevant to note that software such as Firefox can be setup to store the user profile on a different partition (which means, that even after a format and reinstall, all my addons and bookmarks are just as they were before).

Drive Math

Hard drives are sold in GB (gigabytes – SI – 1000^3), whereas computer storage is in GiB (gibibytes – binary – 2^10^3 = 1024^3). In some programs, when you specify the size of a drive, you must do so in bytes; computers unfortunately do not use powers of 10 but rather powers of 2, therefore, a kilobyte is not 1000 bytes but 1024 (2^10) bytes… similarly a MB is 1024^2 bytes; and a GB is 1024^3 bytes (the ^ (caret or more commonly ‘hat’) means ‘to the power of’ (exponentiation)). 1 GB is therefore 1,073,741,824 bytes not 1,000,000,000. This must be taken into consideration when partitioning; most hard drive sizes are stated using a metric ‘gigabyte’ instead of a computer gibibyte (therefore a 200GB hard drive is actually 186GB).

Leave a Reply

Your email address will not be published. Required fields are marked *