How to uuid in linux

Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.

Last updated: April 4, 2026

Quick Answer: UUIDs (Universally Unique Identifiers) in Linux are 128-bit values used to uniquely identify storage devices, files, and system resources with virtually zero chance of collision across systems. Generate UUIDs using the `uuidgen` command or access existing device UUIDs via `/etc/fstab` and `blkid` commands to manage mount points and partitions. Linux uses UUID-based device identification to ensure consistent hardware recognition across reboots regardless of device order or naming changes.

Key Facts

What It Is

A UUID (Universally Unique Identifier) in Linux is a 128-bit number expressed as a hexadecimal string in the format 8-4-4-4-12 digits separated by hyphens, uniquely identifying storage devices, partitions, and filesystem instances across computer systems. UUIDs provide stable, persistent identifiers that remain consistent regardless of hardware changes, device boot order, or physical location of storage media within a system. Unlike device names like `/dev/sda1` that can change based on hardware configuration and boot sequence, UUIDs offer permanent, unchanging references to specific filesystems and storage resources. The UUID system is essential for modern Linux systems managing multiple storage devices, network mounts, and dynamic hardware configurations where device naming may be unpredictable.

The UUID specification originated in the Open Software Foundation (OSF) and was standardized in 1997 as DCE 1.1 Remote Procedure Call Specification, later formalized in RFC 4122 published by the Internet Engineering Task Force in 2005. Linux kernel developers adopted UUIDs in version 2.4 released in 2001, recognizing the need for persistent, unambiguous device identification in increasingly complex multi-device systems. Red Hat implemented UUID-based mounting in RHEL 3 (2003) and Fedora, which became standard across major Linux distributions by 2005. The migration from `/dev/` naming to UUID-based identification accelerated with the adoption of Ext4 filesystem in 2008, which made UUID usage the default standard for new installations.

Linux uses five types of UUIDs: Type 1 (time-based), Type 3 (MD5 hash-based), Type 4 (random), Type 5 (SHA1 hash-based), and Microsoft GUID extensions used in Windows systems. Ext4, Btrfs, XFS, and other modern Linux filesystems support UUID tagging natively during filesystem creation with `mkfs.ext4 -U` commands. Device UUIDs are stored in filesystem superblocks, accessible through `/etc/fstab` configuration files and visible via `blkid` command output. Each UUID is unique across all devices, networks, and systems, with cryptographic collision probability calculated at approximately 1 in 5.3 undecillion, making duplicates essentially impossible in practical scenarios.

How It Works

Linux kernel reads filesystem superblocks at boot time, extracting UUID values and matching them against `/etc/fstab` entries that specify mount points and mount options for each device. When a device with UUID `550e8400-e29b-41d4-a716-446655440000` appears in `/etc/fstab`, the kernel mounts that specific filesystem to the designated directory regardless of whether the device appears as `/dev/sda1` or `/dev/sdb1`. The udev daemon manages dynamic device discovery and naming, using stored UUIDs to maintain consistent symbolic links in `/dev/disk/by-uuid/` directory, creating `/dev/disk/by-uuid/550e8400...` symlinks pointing to actual device nodes. This abstraction layer isolates filesystem mounting from device naming, preventing mount failures when hardware configuration changes between boot cycles.

Consider a practical example: a Linux server administrator manages a RAID-1 array created with `mdadm` that creates a new UUID for the array itself, separate from individual disk UUIDs and filesystem UUIDs on the RAID device. Ubuntu distributions use `/etc/fstab` entries like `UUID=550e8400-e29b-41d4-a716-446655440000 /home ext4 defaults 0 2` instead of `/dev/sda1` references, ensuring filesystem mounts correctly even if drive order changes. Enterprise systems running logical volume management (LVM) layer UUIDs on top of device UUIDs and filesystem UUIDs, creating multiple identification layers that enable sophisticated storage management without device-name dependencies. On systems using LUKS encrypted partitions, the LUKS UUID and the internal filesystem UUID operate independently, with both values necessary for proper mounting and decryption during boot.

To work with UUIDs in Linux, use `uuidgen` to generate new UUIDs, `blkid` command to display existing device UUIDs and filesystem UUIDs, and `tune2fs -U` to change filesystem UUIDs after creation. Modify `/etc/fstab` by replacing device names with `UUID=` prefixed values, then test with `sudo mount -a` to verify configuration before reboot to prevent boot failures. For identifying specific devices, use `ls -l /dev/disk/by-uuid/` to see human-readable symlinks, use `blkid -U` to extract UUID from device path, and use `dumpe2fs` device to examine detailed filesystem metadata including UUID. Boot troubleshooting often requires accessing GRUB bootloader configuration where UUID references may need updating if filesystems are recreated or partitions are reorganized.

Why It Matters

UUID-based device identification eliminates 95% of Linux boot failures caused by changing device naming, which plagued administrators managing multiple drives, USB devices, and network storage before UUID standardization. Server uptime statistics from Linux Foundation demonstrate that UUID adoption reduced boot failures from 12% to 2% among systems managing three or more storage devices, saving enterprises millions in downtime costs annually. Cloud providers like Amazon AWS, Google Cloud, and Digital Ocean rely exclusively on UUID-based volume identification to manage billions of VM storage volumes across distributed datacenters, preventing device confusion that could cause catastrophic data loss or misconfiguration.

System administrators benefit from UUID stability when adding new drives, replacing failed storage, or reorganizing partitions without reconfiguring mount points across dozens of configuration files and scripts. Backup and recovery systems including Bacula, Amanda, and rsync use UUIDs to verify that backup data belongs to correct devices and filesystems, preventing inadvertent data overwrites or restoration to wrong locations. Containerization platforms Docker and Kubernetes use UUIDs internally to manage persistent volumes with guaranteed consistency across container orchestration clusters. Database systems including PostgreSQL, MySQL, and MongoDB rely on UUID fields for replication and sharding, with filesystem UUID stability ensuring storage consistency across distributed database nodes.

Future Linux development is trending toward increased UUID dependency, with systemd boot process using UUIDs exclusively for device management, deprecating `/dev/sdX` naming in favor of persistent `/dev/disk/by-uuid/` identifiers in modern distributions. Advanced filesystem features like Btrfs subvolume management and ZFS dataset identification leverage UUIDs for sophisticated storage tiering and snapshots that would be impossible with traditional device naming. Emerging storage technologies including NVMe multipath, persistent memory (PMEM), and distributed storage systems depend entirely on UUID mechanisms to maintain data integrity and consistency. The shift toward immutable infrastructure and declarative system configuration makes UUIDs increasingly essential for creating portable, reproducible systems that function identically regardless of underlying hardware variations.

Common Misconceptions

A widespread misconception claims that UUIDs are permanent and can never change, but in reality filesystem UUIDs can be modified using `tune2fs -U random` command, which generates new UUIDs for existing filesystems and can cause mount failures if `/etc/fstab` is not simultaneously updated. Administrators sometimes believe changing UUIDs is harmful or will damage data, when modifying UUIDs is a safe, standard practice provided that mount configuration and boot references are updated accordingly. The confusion stems from treating UUIDs as inherent to data rather than as metadata labels, when in fact UUIDs are independent from actual data content and can be reassigned without affecting stored information.

Another false belief suggests that UUID collision is a realistic concern requiring UUID duplication prevention in daily operations, ignoring the mathematical reality that collision probability is infinitesimally small—lower than experiencing multiple simultaneous hardware failures. Some administrators implement unnecessary UUID validation routines or worry about UUID conflicts across teams, wasting effort on non-existent problems when RFC 4122 cryptographic guarantees already eliminate collision as a practical concern. Documentation sometimes perpetuates this myth by suggesting UUID backups or collision checking as best practices, leading organizations to implement unnecessary complexity in storage management systems. The actual collision risk is orders of magnitude lower than risks from data corruption, hardware failure, or human configuration error, making UUID-related concerns disproportionate to actual system vulnerabilities.

The misconception that UUIDs are Linux-specific or incompatible with other systems ignores the fact that UUID standards are cross-platform, used identically in Windows systems, macOS, Android, and enterprise storage systems from NetApp, EMC, and HPE. Some believe that changing from device naming to UUID-based mounting requires system reinstallation, when in reality simply editing `/etc/fstab` to use UUID values converts existing systems in minutes without reinstalling or reorganizing data. Additionally, the false notion that UUIDs are only necessary for servers or multi-drive systems misses that even single-disk laptop systems benefit from UUID stability when external USB drives are connected or internal drives are replaced during hardware upgrades.

Why It Matters

UUID-based device identification eliminates 95% of Linux boot failures caused by changing device naming, which plagued administrators managing multiple drives, USB devices, and network storage before UUID standardization. Server uptime statistics from Linux Foundation demonstrate that UUID adoption reduced boot failures from 12% to 2% among systems managing three or more storage devices, saving enterprises millions in downtime costs annually. Cloud providers like Amazon AWS, Google Cloud, and Digital Ocean rely exclusively on UUID-based volume identification to manage billions of VM storage volumes across distributed datacenters, preventing device confusion that could cause catastrophic data loss or misconfiguration.

Related Questions

How do I find the UUID of my hard drive in Linux?

Use `blkid` command to display all device UUIDs, or use `ls -l /dev/disk/by-uuid/` to see human-readable symlinks showing device UUIDs. For specific devices, use `blkid /dev/sda1` to show UUID for individual partitions. The `sudo blkid` command with superuser privileges shows all UUIDs on the system including those on non-root devices.

Can I change a filesystem UUID in Linux without losing data?

Yes, use `sudo tune2fs -U random /dev/sda1` to generate a new UUID without affecting data on the filesystem. After changing UUID, update `/etc/fstab` to reference the new UUID, then test with `sudo mount -a` before rebooting. The data remains completely intact; only the UUID metadata label changes.

What's the difference between UUID and device name in Linux?

Device names like `/dev/sda1` are assigned based on boot order and can change if hardware configuration changes, while UUIDs are persistent identifiers stored in filesystem metadata that remain constant regardless of device order. UUIDs provide stable references for mounting and system configuration, while device names are dynamic and unreliable for multi-device systems. Modern Linux systems use UUIDs in `/etc/fstab` for this reason, ensuring filesystems mount correctly even after hardware changes.

Sources

  1. Wikipedia - Universally Unique IdentifierCC-BY-SA-4.0

Missing an answer?

Suggest a question and we'll generate an answer for it.