Operations 8 min read

How to Clone an Ubuntu System Disk with dd: A Complete Step‑by‑Step Guide

This guide explains how to use the low‑level dd command to create exact backups of an Ubuntu system disk, covering required hardware, preparation steps, precise dd commands for disk‑to‑disk and disk‑to‑image copying, optional compression, restoration procedures, advantages, limitations, and safety precautions.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Clone an Ubuntu System Disk with dd: A Complete Step‑by‑Step Guide

Overview

The dd utility copies raw bytes from an input source to an output destination. It can clone an entire disk or a single partition, preserving the boot sector, partition table, file system metadata, and all user data. This makes dd suitable for creating exact system images for backup, migration, or disaster recovery.

Prerequisites

Source device : the disk that contains the operating system, e.g., /dev/sda.

Target device or file : another disk (e.g., /dev/sdb) or a backup image file (e.g., /mnt/backup/system_backup.img).

Backup storage : a storage medium whose capacity is at least equal to the source disk.

Bootable LiveCD/LiveUSB : a Linux live environment used to perform the backup while the system is offline.

Preparation Steps

Create a bootable Live medium : download an Ubuntu ISO and write it to a USB stick or DVD.

Identify device names : boot the Live medium and run lsblk to list block devices. Verify the identifiers for the source ( /dev/sda) and the target ( /dev/sdb or a mount point).

Check available space : ensure the target storage can hold at least the size of the source disk. If using an image file, confirm that the destination filesystem has enough free space.

Example environment :

/dev/sda   # source (system) disk
/dev/sdb   # backup storage disk
/dev/sdc   # LiveUSB boot disk

Backup Procedure

Clone to another disk (direct disk‑to‑disk copy):

sudo dd if=/dev/sda of=/dev/sdb bs=4M status=progress

This copies the entire source disk to the target disk using a block size of 4 MiB. The status=progress flag displays ongoing transfer statistics.

Create an image file (disk‑to‑file copy):

sudo dd if=/dev/sda of=/mnt/backup/system_backup.img bs=4M status=progress

The resulting .img file can be stored on any filesystem that supports files of the required size.

Optional compression (useful when storage is limited):

sudo dd if=/dev/sda bs=4M | gzip > /mnt/backup/system_backup.img.gz

The pipeline streams raw data to gzip, producing a compressed image. Decompression is required for restoration.

Restoration Procedure

Restore from an image file to a disk :

# Mount the backup storage if it is on a separate disk
sudo mount /dev/sdb1 /mnt
# Write the image back to the original disk
sudo dd if=/mnt/system_backup.img of=/dev/sda bs=4M status=progress

Restore from a compressed image :

gunzip -c /mnt/backup/system_backup.img.gz | sudo dd of=/dev/sda bs=4M status=progress

Direct disk‑to‑disk restoration (when the backup was made to another disk):

sudo dd if=/dev/sdb of=/dev/sda bs=4M status=progress

Feasibility Analysis

Advantages : simple command line interface; creates a bit‑for‑bit replica including boot loader and partition table; works with any filesystem; no additional software required.

Disadvantages : backup time scales with disk size; uncompressed images occupy the same space as the source disk; restoring to dissimilar hardware may require post‑restore adjustments (e.g., reinstalling GRUB, updating network interface names).

Typical use cases : hardware migration, disaster recovery, cloning identical environments across multiple machines.

Precautions

Never write to the source device while a backup or restore operation is in progress; this can corrupt the copy.

The target device must be at least as large as the source; dd cannot shrink data.

When using a Live environment, verify that the target disk is correctly recognized and free of hardware errors before mounting.

Conclusion

Using dd to back up an Ubuntu system provides a reliable, low‑level method for full‑disk cloning and restoration. Optional compression can reduce storage requirements, and careful planning of device sizes and boot configuration ensures a smooth recovery process.

LinuxCommand LineUbuntuddsystem backupdisk cloning
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.