INFORMATICS

The Best

Przełącznik języka

Zaproś mnie na KAWE

Jeżeli podoba Ci się strona i chcesz wspomóc projekt!

Postaw mi kawę na buycoffee.to

This Site

Płatnik

CMS

Hardware

Uncategorised

Emulators

Powershell

Storage Array

DNS

Antivirus program

Licznik

2.png9.png0.png0.png3.png8.png9.png
Today62
Yesterday832
This week2525
This month20514
Total2900389

Visitor Info

  • IP: 3.145.47.253
  • Browser: Unknown
  • Browser Version:
  • Operating System: Unknown

Who Is Online

2
Online

wtorek, 30 kwiecień 2024 02:25

How to make disk image with dd on Linux

Gwiazdka nieaktywnaGwiazdka nieaktywnaGwiazdka nieaktywnaGwiazdka nieaktywnaGwiazdka nieaktywna
 

How to make disk image with dd on Linux

How to clone an entire hard disk

The syntax is as follow to make disk image with dd:
dd if=/dev/input/DEVICE-HERE of=/dev/OUTPUT/DEVICE-HERE bs=64K conv=noerror,sync
To clone /dev/sdc (xxxG) to /dev/sdd (xxxG) in Linux, enter:
dd if=/dev/sdc of=/dev/sdd bs=64K conv=noerror,sync

Where,

  1. if=/dev/file : Input device/file.
  2. of=/dev/file : Output device/file.
  3. bs=64k : Sets the block size to 64k. You can use 128k or any other value.
  4. conv=noerror : Tell dd to continue operation, ignoring all read errors.
  5. sync : Add input blocks with zeroes if there were any read errors, so data offsets stay in sync.

How to clone a partition and make disk image with dd

To clone /dev/sdc1 to /dev/sdd1 with dd and create an image, enter:
dd if=/dev/sdc1 of=/dev/sdd1 bs=128K conv=noerror,sync

Making disk image with dd using live CD/DVD or USB pen drive

You can boot from a live cd or USB pen drive. Once booted, make sure no partitions are mounted from the source hard drive disk. You can store disk image on an external USB disk. The syntax is as follows
dd if=/dev/INPUT/DEVICE-NAME-HERE conv=sync,noerror bs=64K | gzip -c > /path/to/my-disk.image.gz
In this example, create disk image for /dev/da0 i.e. cloning /dev/da0 and save in the current directory:
dd if=/dev/da0 conv=sync,noerror bs=128K | gzip -c > centos-core-7.gz

https://www.cyberciti.biz/media/new/faq/2016/08/freebsd-dd-demo-300x52.jpg 300w" alt="Fig.01: dd command in action" width="599" height="104" class="size-full wp-image-145587 entered lazyloaded" style="margin: 0px auto 19px; padding: 0px; word-break: break-word; border: 0px; max-width: 100%; height: auto; display: block;" aria-describedby="caption-attachment-145587" data-lazy-srcset="https://www.cyberciti.biz/media/new/faq/2016/08/freebsd-dd-demo.jpg 599w, https://www.cyberciti.biz/media/new/faq/2016/08/freebsd-dd-demo-300x52.jpg 300w" data-lazy-sizes="(max-width: 599px) 100vw, 599px" data-lazy-src="https://www.cyberciti.biz/media/new/faq/2016/08/freebsd-dd-demo.jpg" data-ll-status="loaded" />

Fig.01: dd command in action

The above command just cloned the entire hard disk, including the MBR, bootloader, all partitions, UUIDs, and data.

How to restore system (dd image)

The syntax is:
gunzip -c IMAGE.HERE-GZ | dd of=/dev/OUTPUT/DEVICE-HERE
For example:
gunzip -c centos-core-7.gz | dd of=/dev/da0

Tip #1: Not enough disk space locally? Use the remote box

You can send the image through ssh and save it on the remove box called server1.cyberciti.biz:
dd if=/dev/da0 conv=sync,noerror bs=128K | gzip -c | ssh Ten adres pocztowy jest chroniony przed spamowaniem. Aby go zobaczyć, konieczne jest włączenie w przeglądarce obsługi JavaScript. dd of=centos-core-7.gz

Tip #2: See progress while making an image with dd

You need to use GNU/BSD dd with coreutils version 8.24 as follows (pass the status=progress to the dd):
dd if=/dev/sdc1 of=/dev/sdd1 bs=128K conv=noerror,sync status=progress

Search