Linux device names look cryptic, but they follow patterns. Learning them helps you point a command at the right device.
Disks and partitions
SATA, SCSI, SAS and USB storage use the sd prefix. The letters count disks in the order they were found, and a number marks a partition.
/dev/sdais the first such disk./dev/sdbis the second./dev/sda2is partition 2 on the first disk.
NVMe drives are named differently. /dev/nvme0n1 is namespace 1 on the first NVMe drive (that numbering starts at 0), and /dev/nvme0n1p1 is its first partition. SD and eMMC cards follow the same p style, as in /dev/mmcblk0p1.
Virtual machines often show /dev/vda (virtio) or /dev/xvda (Xen). An optical drive is usually /dev/sr0.
lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 465.8G 0 disk
โโsda1 8:1 0 512M 0 part /boot/efi
โโsda2 8:2 0 465.3G 0 part /
nvme0n1 259:0 0 931.5G 0 disk
โโnvme0n1p1 259:1 0 931.5G 0 part /dataOlder versions of lsblk title the last column MOUNTPOINT.
Terminals and serial ports
/dev/tty1is a virtual console./dev/pts/0is a pseudo terminal, used by terminal windows and SSH sessions./dev/ttyS0is a built in serial port./dev/ttyUSB0and/dev/ttyACM0are common names for USB serial devices.
Run tty to see which one you are using.
Names can change
The sd letters depend on detection order. Add a USB stick or another disk, reboot, and yesterday's /dev/sdb might be /dev/sdc.
udev creates links under /dev/disk that are based on properties of the disk or filesystem:
ls -l /dev/disk/by-uuidlrwxrwxrwx 1 root root 10 Nov 29 09:00 3f1c9a2e-7b4d-4c1a-9e0f-2a6b8c5d1e44 -> ../../sda2
lrwxrwxrwx 1 root root 10 Nov 29 09:00 8A2C-11F7 -> ../../sda1Other directories include by-id (hardware identity), by-label (filesystem label) and by-path (physical connection). Which ones exist depends on your devices.
For /etc/fstab, use UUID= so the correct filesystem is mounted even if its letter changes. blkid or lsblk -f shows the UUIDs. Reformatting a filesystem normally gives it a new UUID.
Before any command that writes to a disk, check the name again with lsblk. The disks and filesystem lab gives you more practice with storage.
Try it
- Run
lsblk -fand match each name with its filesystem and mount point. - Run
ls -l /dev/disk/by-idand follow where the links point. - Run
ttyin two terminal windows and compare the answers. - Open
/etc/fstabwithcatand see how filesystems are identified.
Check your understanding
Device names
All 5 sections ยท no timer
Unlimited retries
Questions from every section are combined into one assessment. Answer them all correctly to complete the article.
Your completion saves in this browser. Sign in to sync it to your account.