Partitioning drives with GNU parted and util-linux: fdisk and cfdisk, and lsblk, wipefs and fsck

Partitioning drives using util-linux

Introduction

three options for partitioning are fdisk, gdisk and parted. parted generally seems the better option.

root partition if uefi, efi system partition (boot partition). also need boot partition if doing LVM or encryption on BIOS swap, though this is discussed later

fdisk

Same name as DOS fdisk.

fdisk is designed with MBR in mind, but later versions have some GPT support:

  • fdisk -l (list things in /dev/) (or can use lsblk)

  • fdisk /dev/sda (or whatever correct device is)

  • this opens dialogue:

    • "d" to delete partitions

    • create a new table, using MBR or GPT

    • create partitions (can press "n" for new)

    • make one bootable

    • "w" to write"

cfdisk

Curses ndisk

lsblk

See devices in /dev/

fsck

Fix file system.

gdisk

gdisk is similar to fdisk but aimed at GPT (is it part of util-linux though?)

wipefs

GNU parted

parted

partitioning using parted:

  • supports MBR and GPT

  • different to fdisk? needed if drives over 2TB?

  • parted -l (list things in /dev/) (or can use lsblk)

  • parted /dev/sda (or whatever correct device is)

  • this opens dialogue:

    • see status with "print"

    • type "quit" when done

    • make gpt using "mklabel gpt"

    • make mbr using "mklabel msdos"

    • make partitions: "mkpart". is interactive

    • make one bootable? "set <partition> boot on"