Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use dd command to clone hard disk under Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use the dd command to clone the hard disk under Linux, which has a certain reference value, and interested friends can refer to it. I hope you will gain a lot after reading this article.

Dd is a very useful command under Linux/UNIX, which is used to copy a file with a block of the specified size and perform the specified conversion at the same time.

Copy only the previous 120GB:

120GB=128MB * 938=64MB*1875

Sudo dd if=/dev/sdb of=/dev/sdc conv=notrunc bs=128MB count=938

Sudo dd if=/dev/sdb of=/dev/sdc conv=notrunc bs=64MB count=1875

The number of times count is bs

A copy of one disk to multiple disks:

Dd if=image.bin | tee > (dd of=/dev/sdc) | dd of=/dev/sdh

Progress bar dd with progress bar and statistics

Dd if=/dev/source | pv-s (blockdev-getsize64 / dev/source) | tee > (dd of=/dev/dest1) | dd of=/dev/dest2

Partial copy problem fixed:

For hard drives in GPT format, if you only copy the previous part, backup gpt table will be left out with the following error:

The backup gpt table is corrupt

When you copy a small disk to a large disk and use the parted command to view the hard disk, the gpt backup table will be repaired automatically.

For disk copies of the same size, parted will not automatically repair them. You need to use the gdisk command:

Sudo gdisk / dev/sda

Then execute: X (expert mode) e (write gpt backup table to the end of the hard disk) w (write to disk) y (yes)

View UUID:

Ls-l / dev/disk/by-uuid

Blkid / dev/sda1

Change the UUID:

Tune2fs / dev/sdbX-U random

Other related commands:

Partprobe informs the kernel that the partition table has changed. Dcfldd directly supports copies of one disk to multiple disks.

Guymager converts dd and dcfldd commands into graphical interfaces

PyFlag is a hard disk analysis tool written in python language.

Partimage partition backup compression

Rsync data mirroring remote backup tool

Ddrescue, gddrescue hard disk data recovery tool

Thank you for reading this article carefully. I hope the article "how to use the dd command to clone a hard disk under Linux" shared by the editor will be helpful to everyone. At the same time, I also hope you can support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report