$ home/mntdataLinux kernel/dev/sdasda1 · ext4 · mounted at //dev/sdbGPTsdb1 · empty blockssdb1 · ext4
Back: the terminal and the directory tree. Middle: the Linux kernel. Front: disks sda and sdbOn each disk: a partition table strip (GPT) and a partition with its filesystem tablesTokens: requests through the kernel, the mount badge, and a file's bytesAt the back: the terminal and the one directory tree. In the middle: the Linux kernel. At the front: two disks, sda (the system, mounted at /) and sdb (new and empty). sfdisk gives sdb a GPT table and one partition, sdb1; mkfs.ext4 writes a filesystem onto it; mount attaches it to /mnt/data. A copy to /mnt/data lands on sdb1, and after umount the folder is empty but the file stays on the disk. The machine is an example with two disks, sda and sdb. Real lsblk output often also lists loop devices and the CD drive (sr0), and the card leaves out the sizes because they depend on your disk.

Disks

  1. A disk is a block device: the kernel reads and writes it in fixed-size blocks. It names each disk in /dev. sda is the first, sdb the second. Here sda holds the system and sdb is new and empty.

Preparing a new disk

Mounting

Using it

What happens

;; step 1/10 · disks
block device   storage read and written in blocks
the kernel names each disk in /dev:
  /dev/sda    first disk   (the system)
  /dev/sdb    second disk  (new, empty)
  NVMe disks: /dev/nvme0n1, /dev/nvme1n1 ...

sfdisk and mkfs destroy what is on the device you name. Run lsblk first, make sure the name is the new, empty disk, and never point them at a mounted partition. The machine is an example with two disks, sda and sdb. Real lsblk output often also lists loop devices and the CD drive (sr0), and the card leaves out the sizes because they depend on your disk.