Cloning Ubuntu with dd: Boot and EFI File Issues

Abstract: Fixes boot failures after cloning Ubuntu with dd by resolving EFI and fstab UUID mismatches.

Created: 2026-09-08 by
Cloning an Ubuntu system with dd often breaks the boot process because the EFI System Partition (ESP) UUIDs do not match between the source and destination drives. The bootloader configuration files, specifically /boot/grub/grub.cfg and /etc/fstab, contain hardcoded references to the original disk identifiers. When these files are copied verbatim to a new drive, the system cannot locate the kernel or root filesystem during startup, resulting in a GRUB rescue prompt or an invalid EFI file error.

Understanding Why dd Breaks Booting

The dd command performs a bit-for-bit copy of the entire block device. While this preserves all data, it also copies the unique identifiers assigned by the Linux kernel and the partition table. In UEFI systems, the firmware locates the bootloader via the GUID Partition Table (GPT) entries and the ESP. If the target disk has different GPT attributes or if the UUIDs stored in the EFI variables differ from those on the new disk, the boot chain fails. Additionally, modern Ubuntu versions use UUIDs extensively in fstab and GRUB configurations rather than device names like sda1. Copying these files without updating them creates a mismatch that prevents the operating system from mounting necessary partitions.

Preparing the Target Disk

Before running dd, ensure the target disk is identical in size or larger than the source. Using a smaller disk will result in data corruption or truncation. It is crucial to unmount all partitions on the target disk before initiating the clone. If you are cloning to a different physical disk, verify that the BIOS/UEFI settings allow booting from the new drive. Some motherboards require disabling Secure Boot temporarily if the cloned signature does not match the secure boot database, although this is less common for standard Ubuntu installations. Always double-check the device names using lsblk to avoid overwriting the wrong drive.

Post-Clone Steps: Fixing UUID Mismatches

Once the dd process completes, you must chroot into the cloned system to update internal references. Mount the root partition and the EFI partition to temporary directories. For example, mount the root filesystem to /mnt and the EFI partition to /mnt/boot/efi. Bind the virtual filesystems such as /proc, /sys, and /dev to the mounted structure. This allows you to execute commands within the context of the cloned OS. Inside the chroot environment, regenerate the initramfs and update the GRUB configuration. This step ensures that the bootloader uses the correct paths relative to the new disk's UUIDs.

Updating fstab and GRUB Configuration

The most critical step involves editing /etc/fstab to reflect the new UUIDs. You can retrieve the current UUIDs of the target partitions using the blkid command. Compare these values with those listed in /etc/fstab and replace any discrepancies. Incorrect UUIDs here will cause the system to hang during boot while waiting for devices that do not exist. Similarly, run update-grub to regenerate /boot/grub/grub.cfg. This script scans the current hardware state and writes the correct UUIDs into the bootloader configuration. If you encounter errors, check the syntax of fstab for typos, such as misspelled filesystem types or missing tabs.

Reinstalling the EFI Bootloader

If the system still fails to boot, you may need to reinstall the EFI bootloader directly onto the target disk. Use the grub-install command with the --target=x86_64-efi flag and specify the EFI directory. Ensure that the --efi-directory points to the mounted ESP on the target drive. On some systems, adding the --removable flag can help if the drive is treated as removable media, though this is rare for internal clones. After installation, verify that the /boot/efi/EFI/ubuntu directory contains the necessary shim and grubx64.efi files. These files are essential for the UEFI firmware to hand off control to GRUB.

Troubleshooting Common Errors

If you see an "Invalid EFI File" error, check the integrity of the ESP. Sometimes, dd may copy corrupted sectors if the source disk had issues. Run fsck.vfat on the EFI partition to repair any filesystem errors. If the GRUB menu appears but fails to load the kernel, verify that the linux line in grub.cfg points to the correct root UUID. You can manually edit this line at the GRUB prompt to test bootability. Another common issue arises when cloning to a disk with a different sector size; ensure both disks have compatible logical block sizes to prevent alignment issues. Fix Bootloader Using GRUB Rescue: Overcoming Unknown File System Error provides additional steps for recovering from severe GRUB failures.

Frequently Asked Questions

Can I clone Ubuntu to a larger disk using dd?

Yes, but you must resize the partitions after cloning. dd copies only the used space structure, so the target disk will appear smaller until you expand the partition table. Use tools like gparted or fdisk to extend the root partition and then run resize2fs to grow the filesystem.

Why does my cloned system boot but fail to mount partitions?

This usually happens because /etc/fstab still contains the UUIDs of the source disk. The new disk has different UUIDs, so the system cannot find the specified volumes. Update /etc/fstab with the new UUIDs obtained from blkid to resolve this mismatch.

Is it safe to disable Secure Boot for cloning?

Disabling Secure Boot is generally safe for troubleshooting boot issues after cloning. However, it is better to try fixing the bootloader signatures first. If the cloned system lacks valid keys, re-enabling Secure Boot may prevent booting until the EFI binaries are properly signed or the machine key database is updated.

What should I do if GRUB installs to the wrong disk?

Always specify the exact target device and EFI directory in the grub-install command. Avoid installing to a partition number; instead, point it to the disk device like /dev/sdb. Verify the installation by checking the /boot/efi/EFI/ubuntu directory on the target disk for the presence of bootloader files.

How do I fix a black screen after cloning?

A black screen often indicates a graphics driver conflict or incorrect kernel parameters. Try booting with the nomodeset parameter in the GRUB menu. If this works, update your display drivers and kernel parameters in /etc/default/grub before regenerating the GRUB configuration.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More