ITNuvoAkademiya
Academy homePackagesPlaylistsToolsSubnet calculatorSearchGlossary
CiscoCCNA · CCNA: networking fundamentals1. Introduction2. Network Fundamentals3. Network Access4. IP Connectivity5. IP Services6. IPv67. Security Fundamentals8. AutomationCCNP: Enterprise networks · coming soon
LinuxLinux: system administrator üçün · Linux for system administrators1. Getting to know Linux2. Working with text3. Users and permissions4. Processes and packages5. Inside the system6. Monitoring and logs7. NetworkingRed Hat Enterprise Linux · Red Hat Enterprise Linux: from beginner to advanced1. Getting started2. Packages3. Users and permissions4. SELinux5. Services6. Storage7. Networking8. Building services9. Boot and recovery10. DevOps11. Security and monitoring
FortinetFortiGate Administrator · FortiGate Administrator: from first login to ZTNA1. Getting to know FortiGate2. Routing, policy and NAT3. Security profiles4. Users and logs5. Resilience, SD-WAN and automation6. VDOM7. VPN and ZTNA8. Proxy9. DMZ
MonitoringZabbix · Zabbix: from installation to alerts1. Introduction2. Installation and the database3. Basics: groups, templates, users4. Connecting devices5. Alerts, Grafana and the API
VirtualizationProxmox VE · coming soonVMware ESXi · coming soon
My account / Sign in
AZENRU
← itnuvo.com

Devices: /dev, lsblk, udev

Lesson 5.17 minIntermediateDecember 1, 2026
Open

This lesson is open to everyone. The other lessons open with a package: sign in or sign up, then choose a package.

Key points

  • Files under /dev are devices: block devices (disks, b) and character devices (terminals, c).
  • Disk names: sda, sdb (SATA/SCSI/virtual), nvme0n1 (NVMe), vda (KVM virtio); partitions sda1, nvme0n1p1.
  • lsblk -f shows disks, partitions, file systems and mount points as a tree.
  • blkid gives each partition's UUID — a name can change, the UUID does not.
  • udev creates the /dev file when a device is connected; dmesg and udevadm monitor show what happened.

Everything is a file

A famous Linux principle: you work with devices as files too. Writing to a disk, sending text to a terminal, reading random numbers — all go through files under /dev.

srv-web01
ali@srv-web01:~$ ls -l /dev/sda /dev/sda1 /dev/tty1 /dev/null
brw-rw---- 1 root disk 8, 0 Dec  1 08:55 /dev/sda
brw-rw---- 1 root disk 8, 1 Dec  1 08:55 /dev/sda1
crw--w---- 1 root tty  4, 1 Dec  1 08:55 /dev/tty1
crw-rw-rw- 1 root root 1, 3 Dec  1 08:55 /dev/null

The first letter shows the type: b — a block device (reads data in blocks, disks), c — a character device (works as a stream: terminals, /dev/null). The 8, 0 shown instead of a size are the device numbers (major, minor).

FileWhat it is
/dev/sda, /dev/nvme0n1A whole disk
/dev/sda1The disk's first partition
/dev/nullA "black hole" — everything written is lost
/dev/zeroEndless zeros
/dev/urandomRandom bytes
/dev/tty1, /dev/pts/0Console and SSH terminals

The logic of disk names

NameDisk typePartition example
sda, sdb, sdcSATA, SAS, USB, many virtual diskssda1, sda2
nvme0n1, nvme1n1NVMe SSDnvme0n1p1 (with p)
vda, vdbKVM/virtio virtual diskvda1
sr0CD/DVD—

The letters follow the order in which disks are found — so after a reboot sdb and sdc can swap. That is why configuration uses the UUID, not the name (end of the lesson).

lsblk: a map of the disks

srv-web01
ali@srv-web01:~$ lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda      8:0    0   20G  0 disk
├─sda1   8:1    0    1G  0 part /boot/efi
├─sda2   8:2    0    2G  0 part /boot
└─sda3   8:3    0   17G  0 part /
sdb      8:16   0   10G  0 disk
└─sdb1   8:17   0   10G  0 part /var/www
sdc      8:32   0   20G  0 disk

The picture is clear: the system is on sda, the site is on a separate disk sdb, and sdc has just been added and is still empty — no partition, no mount point. We will prepare it in the next lesson.

lsblk -f shows the file system and UUID too:

srv-web01
ali@srv-web01:~$ lsblk -f /dev/sdb
NAME   FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sdb
└─sdb1 ext4   1.0   www   5f3c9a2e-8d41-4b6e-9a77-2c1e0b6d4f18    8.7G     7% /var/www

blkid and the UUID

srv-web01
ali@srv-web01:~$ sudo blkid /dev/sdb1
/dev/sdb1: LABEL="www" UUID="5f3c9a2e-8d41-4b6e-9a77-2c1e0b6d4f18" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="c1d2e3f4-01"
ali@srv-web01:~$ ls -l /dev/disk/by-uuid/ | grep sdb1
lrwxrwxrwx 1 root root 10 Dec  1 08:55 5f3c9a2e-8d41-4b6e-9a77-2c1e0b6d4f18 -> ../../sdb1

The UUID is a unique number given when the file system is created. Even if the disk is plugged into another port and its name becomes sdc, the UUID stays the same. The /dev/disk/by-uuid/, by-label/ and by-id/ directories hold links from stable names to the real device.

udev: what happens when a device is connected

When a disk is added, the kernel detects it and sends an event. The udev service catches the event, creates the file in /dev, builds the by-uuid links and sets permissions according to its rules.

srv-web01
ali@srv-web01:~$ sudo dmesg | tail -n 4
[ 5521.304112] scsi 2:0:2:0: Direct-Access     QEMU     QEMU HARDDISK    2.5+ PQ: 0 ANSI: 5
[ 5521.306981] sd 2:0:2:0: [sdc] 41943040 512-byte logical blocks: (21.5 GB/20.0 GiB)
[ 5521.307420] sd 2:0:2:0: [sdc] Attached SCSI disk
ali@srv-web01:~$ sudo udevadm monitor
ToolWhat for
dmesgKernel messages: new disks, USB, driver errors
udevadm monitorWatches device events live
udevadm info /dev/sdcWhat udev knows about a device
lsusb, lspciLists of USB and PCI devices

If a disk was hot-added to a virtual server and does not appear in lsblk, you can rescan the SCSI bus: echo "- - -" | sudo tee /sys/class/scsi_host/host*/scan.

Look at the server's disks with lsblk and blkid in the Linux simulator.

Check yourself

5 questions · answers are shown instantly · 3 correct answers complete the lesson

1What is the first letter of /dev/sda in ls -l?

A disk is a block device.

2What is the name of the first partition of an NVMe disk?

On NVMe a p comes before the partition number.

3Why is the UUID used in configuration instead of the disk name?

sdb and sdc can swap depending on detection order.

4Which command shows as a tree whether a newly added disk has a file system?

df only shows mounted file systems.

5Which service creates the /dev file when a device is connected?

udev processes the kernel's events.
Was this lesson useful?

Comments

Sign in to comment.