A disk is divided up into [partitions](/Operating_Systems/Disks/Partitions.md) which are subsections of the overall disk. The kernel presents each partition as a [block device](/Operating_Systems/Devices.md#Devices) as it would with an entire disk.
Whenever you install a Linux distribution on a real or virtual machine, you must partition the drive. There are three main tools to choose from: `parted`, `g(raphical)parted`, `fdisk`.
For a top-level overview of your disks and their main partitions you can run `lsblk` (_list block devices_):
The two tools disclose that the main harddrive is `/dev/nvme0n1` (equivalent to `sda` on older machines running Linux) and it has the standard three partitions:
- Boot partition (`/dev/nvme0n1p1`)
- This takes up the smallest amount of space and exists in order to bootstrap the operating system: to load the kernel into memory when the machine starts. This is where your bootloader is stored and that will be accessed by the BIOS. In Linux this will be GRUB.
- Root dir (`/dev/nvme0n1p2`)
- This is the domain of the [superuser](/Operating_Systems/User_Space.md#root-user-superuser). The part of the filesystem that you need sudo priveleges to access and where you manage users
In the Linux world there are two main types: MBR and GPT. The type of table used determines how the OS boots. So although partition tables are also responsible for the partitioning of non-bootable sectors of a disk, **they are distinguished by the boot system they implement**.
Most standard partition tables allow for primary, extended and logical partitions. The primary partition is the part of the harddisk that contains the operating system and is thus described as 'bootable' and may be called the 'boot partition'. During the bootstrapping process this is injected into memory as the [kernel](/Operating_Systems/The_Kernel.md).
The extended partition is basically everything other than the primary partition. This is typically subdivided into other partitions that are called _logical_ partitions. This is because they physically reside in the same sector of the disk (the extended partition) but are treated as virtual and independent disks.
<li>Can only works with disks up to 2TB in size</li>
<li>Only supports 4 primary partitions. This means the number of operating systems you install is limitied to this number.</li>
<li>This is the first 512 bytes of a storage device, preceding the first partition.</li>
</ul>
</dd>
<dt>GPT</dt>
<dd>
<ul>
<li>Stands for GUID Partition Table </li>
<li>Gradually replacing MBR</li>
<li>Uses UEFI instead of BIOS</li>
<li>As name indicates, every partition on disk has its own globally-unique identifier</li>
<li>Vastly more partitions available than with MBR (dependent on operating system)</li>
<li>Offers greater recovery options and anti-corruption safeguards</li>
</ul>
</dd>
</dl>
## Creating a partition table
To demonstrate the process of partitioning a harddrive I am going to repartition an external SATA drive as if it were being primed for a fresh Linux install.
Let's take a look at the disk in its current form:
```
$ fdisk -l
Disk /dev/sda: 465.74 GiB, 500079525888 bytes, 976717824 sectors
Disk model: My Passport 071Aumount /dev/sda2
Disklabel type: gpt
Disk identifier: 9993F1BB-626C-485F-8542-3CC73BB40953
Device Start End Sectors Size Type
/dev/sda1 40 409639 409600 200M EFI System
/dev/sda2 409640 976455639 976046000 465.4G Apple HFS/HFS+
(This disk was previously used as a backup disk for MacOS so in addition to the extended partition which has a proprietary file system type (Apple HFS) it has a primary partition which would load the recovery OS. In contrast to my main harddrive this uses the standard SCSI prototcol and thus the partitions are prepended with `sda`.)
> Whilst we have created our partitions we cannot yet mount them. This is because we have not yet set up a filesystem on the partitions. This is the next step.