重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
The syntax is:dd if=/dev/input/DEVICE-HERE of=/dev/OUTPUT/DEVICE-HERE bs=64K conv=noerror,sync
To clone /dev/sdc (250G) to /dev/sdd (250G) in Linux, enter:# dd if=/dev/sdc of=/dev/sdd bs=64K conv=noerror,sync
To clone /dev/ada0 (250G) to /dev/adb0 (250G) in FreeBSD, enter:# dd if=/dev/ada0 of=/dev/adb0 bs=64K conv=noerror,sync
Where,
十年的政和网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。全网营销推广的优势是能够根据用户设备显示端的尺寸不同,自动调整政和建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联从事“政和网站设计”,“政和网站推广”以来,每个客户项目都认真落实执行。
if=/dev/file : Input device/file.
of=/dev/file : Output device/file.
bs=64k : Sets the block size to 64k. You can use 128k or any other value.
conv=noerror : Tell dd to continue operation, ignoring all read errors.
sync : Add input blocks with zeroes if there were any read errors, so data offsets stay in sync.
To clone /dev/sdc1 to /dev/sdd1, enter:# dd if=/dev/sdc1 of=/dev/sdd1 bs=128K conv=noerror,sync
Sample outputs:
15874+0 records in 15873+0 records out 1040252928 bytes transferred in 3.805977 secs (273320858 bytes/sec)
You can boot from a live cd. 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 followsdd 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
Sample outputs:
Fig.01: dd command in action
The above command just cloned the entire hard disk, including the MBR, bootloader, all partitions, UUIDs, and data.
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
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 vivek@server1.cyberciti.biz dd of=centos-core-7.gz
You need to use GNU 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
Sample outputs:
gdd (GNU DD) in action with progress bar running on MacOS X
See how to save and restore MBR only.
Not a fan of dd? See top 6 open source disk cloning and imaging softwares.
Want to deal with corrupted disk? Try ddrescue command.