Disks and filesystems

Partition or use the whole device

Choose a partition table or whole-device filesystem from operational needs instead of habit.

8 minute lesson

~~~

A data disk can hold a filesystem directly or contain a partition table with one or more partitions.

Both work. The choice is operational, not technical purity.

The whole-device option

You can put a filesystem straight on /dev/sdb with no partition table. One less layer, nothing to size, and growing a cloud volume later means growing just the filesystem.

The downside is discoverability. Partitioning tools and installers see a disk with no partition table and may present it as blank. A colleague, or an automated provisioning script, is one confirmation prompt away from wiping it. A partition table is a visible “this disk is in use” marker.

The partitioned option

GPT is the normal partition-table choice for modern disks. The older MBR format has a 2 TiB limit and no real advantages on a data disk.

Inspect what’s there first:

sudo parted /dev/sdb print
# Error: /dev/sdb: unrecognised disk label

That error is what a truly blank disk looks like. Now create a GPT table and one partition spanning the disk:

sudo parted /dev/sdb -- mklabel gpt mkpart data ext4 1MiB 100%

The 1MiB start keeps the partition aligned. Verify the result:

sudo parted /dev/sdb print
Partition Table: gpt
Number  Start   End    Size   File system  Name  Flags
 1      1049kB  215GB  215GB               data

The File system column stays empty until you actually run mkfs on /dev/sdb1, in the next lesson. parted only reserved the space.

How to decide

Partitions can separate roles on one disk, and boot disks need them because firmware and bootloaders expect specific partitions. My advice for a single-purpose data disk: one GPT partition covering the whole device. You keep the “disk is in use” marker and give up almost nothing.

Whatever you pick, document the chosen layout. Six months from now, “why does this disk have no partition table?” should have an answer in your notes, not a guess.

For a hypothetical 200 GB data disk, write the exact intended layout before creating it. Include device, table, partition boundaries, filesystem, and mount point.

Lesson completed

Take this course offline

Get every free book and course as PDF and EPUB files.

Get the download library →