dd 常用法

dd clone disk
dd if=/dev/sda of=/dev/sdb bs=64k conv=noerror,sync

dd make disk image
dd if=/dev/sda conv=sync,noerror bs=128k |gzip -c centos-disk.gz

dd restore image
gunzip -c centos-disk.gz | dd of=/dev/sdb

conv=noerror #告訴 dd 繼續操作,忽略所有讀取錯誤。
sync #如果有任何讀取錯誤,則添加帶有零的輸入塊,因此數據偏移量保持同步。

See progress while making an image with dd
dd if=/dev/sda conv=sync,noerror status=progress bs=128k |gzip -c centos-disk.gz

dd clone MBR
dd if=/dev/sda of=/dev/sdb bs=512 count=1

dd save MBR to image
dd if=/dev/sda of=/tmp/mbrsda.bak bs=512 count=1

映像恢復到任何 sdb: 上述命令將保留分區模式
dd if=/tmp/mbrsda.bak of=/dev/sdb bs=446 count=1

分割區備份
sfdisk -d /dev/sda > /tmp/sda.bak

分割區恢復
# sfdisk /dev/sda

only delete MBR
dd if=/dev/zero of=/dev/sda bs=446 count=1

delete all partition and MBR
dd if=/dev/zero of=/dev/sda bs=512 count=1

本篇發表於 未分類。將永久鍊結加入書籤。

發表迴響

您的電子郵件位址並不會被公開。 必要欄位標記為 *

*

您可以使用這些 HTML 標籤與屬性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>