Udev provides users with a dynamic device directory containing only the files for actually present devices. It creates and removes device node files usually located in the /dev/ directory, and renames network interfaces.
As part of the hotplug subsystem, udev is executed if a kernel device is added or removed from the system. On device creation, udev reads the sysfs directory of the given device to collect device attributes like label, serial number, and bus device number. These attributes may be used as keys to determine a unique name for the device. Udev then maintains a database for devices present on the system.
On device removal, udev queries its database for the name of the device file to be deleted.