Cloned or restored ext4 filesystems in Linux can share a UUID and confuse mount rules. A new filesystem UUID requires updated saved mount references and a remount check to confirm the filesystem uses its new identity.

In Linux, the filesystem stores its own UUID in on-disk metadata, and tools such as blkid, lsblk, findmnt, and /etc/fstab can use that value with UUID=… references. That filesystem UUID is separate from a partition-table PARTUUID, so changing one does not automatically change the other.

tune2fs from e2fsprogs changes the UUID of an unmounted ext4 filesystem. Root, boot, encrypted, or resume-related filesystems need extra care because every saved reference to the old UUID must be updated before rebooting, and non-ext filesystems such as XFS, Btrfs, or swap use different tools.

Steps to change an ext4 filesystem UUID in Linux:

  1. Open a terminal with access to sudo.
  2. Identify the target filesystem device and its current UUID.
    $ lsblk -o NAME,TYPE,FSTYPE,UUID,MOUNTPOINTS
    NAME    TYPE FSTYPE  UUID                                 MOUNTPOINTS
    vda     disk
    ├─vda1  part ext4    177d9ef8-e333-4882-995c-d464bfb9147b /
    ├─vda13 part ext4    d70f2689-1d3d-4530-a3a1-a39676b13105 /boot
    └─vda15 part vfat    26D3-C9E2                            /boot/efi
    vdb     disk
    └─vdb1  part ext4    3f5e6c0d-2c2f-4a7f-b2b7-a1d4fd6c9ec4 /mnt/data
    ##### snipped #####

    Use the device that holds the filesystem itself, such as /dev/vdb1 or /dev/nvme1n1p1, not the parent disk unless the filesystem was created directly on that whole-disk device.

  3. Unmount the filesystem so the metadata can be checked and updated safely.
    $ sudo umount /dev/vdb1

    If the target is the root filesystem, a boot filesystem, or another busy production volume, make the change from a rescue system or a maintenance window instead.

  4. Check the filesystem for errors before writing a new UUID.
    $ sudo e2fsck -f /dev/vdb1
    e2fsck 1.47.2 (1-Jan-2025)
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
    data: 13/65280 files (0.0% non-contiguous), 8285/65280 blocks

    If it reports damage that needs repair, complete that repair before changing the UUID.

  5. Assign a new random UUID to the filesystem.
    $ sudo tune2fs -U random /dev/vdb1
    tune2fs 1.47.2 (1-Jan-2025)

    For a preselected value, replace random with a full UUID such as 8f407127-907c-4ff0-99d3-3b1d7cde9e12.
    Tool: Universally Unique Identifier (UUID) Generator

  6. Read the new UUID from the filesystem.
    $ sudo blkid /dev/vdb1
    /dev/vdb1: LABEL="data" UUID="8f407127-907c-4ff0-99d3-3b1d7cde9e12" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="2b3f8a51-01"
  7. Create a backup of the current /etc/fstab file before editing it.
    $ sudo cp /etc/fstab /etc/fstab.bak
  8. Update every saved reference that still uses the old UUID, starting with /etc/fstab.
    $ sudoedit /etc/fstab
    UUID=8f407127-907c-4ff0-99d3-3b1d7cde9e12 /mnt/data ext4 defaults 0 2
    ##### snipped #####

    If the filesystem is used for boot files, encrypted mappings, hibernation resume, or custom boot loader entries, update those references before rebooting or the system may fail to start cleanly.

  9. Reload systemd so it reads the updated /etc/fstab.
    $ sudo systemctl daemon-reload
  10. Mount the filesystem again by its configured mount point.
    $ sudo mount /mnt/data

    If the mount fails, compare the UUID in /etc/fstab with the blkid output from the earlier step.

  11. Confirm that the filesystem is mounted with the new UUID.
    $ lsblk -o NAME,TYPE,FSTYPE,UUID,MOUNTPOINTS
    NAME    TYPE FSTYPE  UUID                                 MOUNTPOINTS
    vda     disk
    ├─vda1  part ext4    177d9ef8-e333-4882-995c-d464bfb9147b /
    ├─vda13 part ext4    d70f2689-1d3d-4530-a3a1-a39676b13105 /boot
    └─vda15 part vfat    26D3-C9E2                            /boot/efi
    vdb     disk
    └─vdb1  part ext4    8f407127-907c-4ff0-99d3-3b1d7cde9e12 /mnt/data
    ##### snipped #####
Share this guide