Skip to main content

Copy Disk with dd

Introduction

You need to make a backup of an active disk to a image file, the following describes howto do this.

Problem Description

Maybe you have an SSD where S.M.A.R.T. is telling you that badblocks are starting to show up. So you need to replace the SSD with a new one. You need to create an image of the actual disk (If te badblocks are not too high you can try it).

Solution

Take a backup to an Image on the running system:

dd if=/dev/sda conv=sync,noerror bs=128k status=progress | gzip -c > YYYYMMDD-boot-disk.gz
  • Then you need to save the resulting file to any storage (USB stick, external disk etc.).
  • Shutdown the system and replace the faulty SSD with a new one.
  • Boot from a emergency disk/iso, check the links section for downloadable ISO files.

Restore the Image File. Double Check that you use the right Device Name (/dev/sda, /dev/da0 etc.)

gunzip -c YYYYMMDD-boot-disk.gz | dd of=/dev/sda

Boot the System with the new SSD.