Drive
A drive is a physical device that’s used to store data. It’s not really a formal term but a commonly-used one. While the strictest definition would be the physical device that stores data, the term is often used informally to refer to any storage device, from a disk to a volume. Technically, its meaning is restricted to describing a hardware device. A drive is a physical object upon which a disk resides.
Disk
“Disk” is the word used by Unix systems to refer to physical storage devices. Disks contain volumes and can contain multiple volumes of different sizes. A disk is like the parent container for all the logical divisions of storage that might come below it. Examine the disks attached to a Unix system, and you’ll see specifications like “disk1s2.” That specifies the parent disk (“disk1”) and the partition/volume number (“s2”) within the disk.
Partition
A partition is very much like a volume. In fact, the two terms are used almost interchangeably. Even system programs like macOS’ Disk Utility don’t distinguish between the unformatted partition and the formatted volume. But if we want to get precise, a “partition” is a chunk of a disk. It doesn’t necessarily contain a file system, and it might not be formatted to store data. Instead, a partition is just a part of a disk with a specific size, which is set at the time of creation. A partition can be resized, but it requires re-writing the disk’s partition table and possibly erasing data.
Volume
A volume is the part of the disk that you interact with as a user. While partitions and volumes are coterminal, a volume has a name and file system in addition to a size. When you mount a storage device and its icon appears in your file browser, you’re seeing the volume. Multiple volumes can be stored on a single disk, and operating systems keep track of what volumes are on what drives. Open up “Disk Utility” on macOS or Disks in Ubuntu and you’ll see your familiar volume names underneath cryptic-looking disk names.
Image
Images function like volumes, but they have no physical hardware related to them. They’re like a picture of a physical volume, containing every bit stored on the captured volume. You can create an image of any volume, whether it’s stored on a hard drive or a CD, and store it on any other device with sufficient free space. Windows makes use of images for system backups (called System Images) that can be smaller than the disk they’re capturing. This is because images don’t typically store empty space. An image must be mounted or attached before it can be accessed, just like a drive. It also has its own file system and can be “cloned” to another volume to copy the contents of the imaged volume.
Containers
Some filesystems also make use of containers. Specifically, macOS recently introduced containers into its new file system, Apple File System (APFS). Containers are distinct from the other items on this list and function a little differently. Within APFS, disks hold containers and containers hold volumes. The volumes within a given container are allowed to share the space allocated to the container, which has a set maximum size. This means the volumes can be flexible, expanding to fit files or shrinking to allow other volumes to grow. This is distinctly unlike the fixed partitions of other filesystems like ext4, HFS+ or ExFAT. The size of partitions under those file systems is specified at the time of creation, and changing the size of a partition requires rewriting the partition table. APFS, however, resizes volumes within a container on the fly to accommodate data.
Conclusion
In short, disks contain volumes which contain data. Disks are the physical manifestation of a drive. Containers are used in place of partition tables in the APFS filesystem. Images are “pictures” of the data on a volume, capturing the exact arrangement of bits on a drive. Image credit: avaragado from Cambridge