Partitions and mounting

Disk, MBR or GPT partition table, partition, file system, formatting, mount point, mount, umount, fstab, lsblk, df, and names like /dev/sda1 or /dev/nvme0n1p2.

  • 26 cards
  • 4 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Concepts
  2. Questions
  3. Sort and link
  4. Scenarios

A few cards from the deck

  • Partition: what is it?

    Show the answer

    A contiguous slice of a disk that the system treats as a disk of its own, with its own file system.

    That separates the system, personal data and swap space. On Linux, partition 1 of the first SATA disk is /dev/sda1.

  • /mnt/usb already contains notes.txt. You run mount /dev/sdb1 /mnt/usb, then ls /mnt/usb. What do you see?

    • The stick's content: notes.txt is hidden, and comes back after umount
    • The stick's content and notes.txt, merged in the same directory
    • Only notes.txt: mounting never replaces the content of a non-empty directory
    • Only the stick's content: notes.txt is permanently erased from the disk
    Show the answer

    The stick's content: notes.txt is hidden, and comes back after umount

    The mounted file system takes the place of what the directory showed. The old files have not moved, they are only hidden. That is why you mount on an empty directory.

  • The second SATA disk is called /dev/sdb and its third partition …; on an NVMe disk, the second partition of the first disk is called ….

    Show the answer

    The second SATA disk is called /dev/sdb and its third partition /dev/sdb3; on an NVMe disk, the second partition of the first disk is called /dev/nvme0n1p2.

    An NVMe disk's name ends in a digit, so a p separates the disk from the partition number: /dev/nvme0n1 is the whole disk.

  • Partition table: what is it?

    Show the answer

    The area of a disk that lists the partitions with their start and size; the two common formats are MBR and GPT.

    MBR is the old format, with four primary partitions and disks limited to 2 TiB. GPT lifts those limits and goes with UEFI boot.

  • umount /mnt/usb answers “umount: /mnt/usb: target is busy”. What is the likely cause?

    • The stick is read-only, which blocks unmounting it: umount -r frees it
    • The mount point is not declared in /etc/fstab, so the system refuses to unmount it
    • The partition has no valid file system, so the kernel cannot release it
    • A process is using the mount, for instance a terminal sitting in it: lsof /mnt/usb shows it
    Show the answer

    A process is using the mount, for instance a terminal sitting in it: lsof /mnt/usb shows it

    Unmounting fails as long as a file on the mount is open, or a process has its current directory there. You leave with cd, close the programs, then run umount again.