Linux Ghost-dd command

Source: Internet
Author: User
Tags gparted
Linux Ghost-dd command-Linux Enterprise Application-Linux server application information. The following is a detailed description. Dd is a common command in linux and is usually used to export data between devices.
Standard usage:
Dd if =/dev/hda of =/dev/hdb
Where if is the input device and of is the output device
Available parameters include bs = xxxx byte size count = n times
For example, dd if =/dev/hda of =/dev/hdb bs = 512 count = 1. Copy the hda MBR to hdb, 512 Bytes.
Dd can be used in many powerful ways. This compact tool can be used as a Ghost and can also be used as a Ghost through TCP/IP.

Dd is used to erase Data.
Nowadays, many people know that it is useless to completely delete data and clear the recycle bin. Chen Guanxi certainly does not know.
Now commercial software can be deleted and written repeatedly with blank data, so as to destroy the dead.
Dd can also be used.

Dd if =/dev/zero of =/dev/sda conv = notrunc

Create an image

Dd if =/dev/hda1 of = hdimage. img conv = noerror, notrunc

For a CD, each slice is 2048 bytes, so dd if =/dev/hdc of =/home/kevin/mycd. iso bs = 2048 conv = notrunc will generate the CD iso

Clone Hard Disk
Dd if =/dev/sda of =/dev/sdb notrunc, noerror

Network clone
Through netcat, netcat is the Swiss army knife for network debugging.
Run netcat-l-p 1234 on the target machine | dd of =/dev/hdc bs = 16065b
Run dd on the source machine if =/dev/hda bs = 16065b | netcat targethost-192.168.3.33 1234

There is a problem here, that is, what is the situation of cloning between partitions of different sizes?
The answer is: if the 80 GB hard disk (assuming there is only one partition) is cloned to the GB partition, the GB partition will become 80 GB, and the remaining space is not allocated.
In this case, you need to use the partition tool to Resize the partition.
You can choose Partition Magic or Acronis Disk ctor, a veteran of lossless partitioning, and a rising star.
But this time I chose the open-source Gparted LiveCD, one reason is that the USB device will be recognized as removable storage, at least Acronis Disk Director cannot recognize it. Another reason is that Gparted is LiveCD, which is quite green.

Proposition: How should we migrate the 80 GB old hard disk to a GB new hard disk?

Step 1. Use LiveCD. Any released version of LiveCD can be used. dd commands are very popular, and almost all releases contain LiveCD.

Step 2. identify the device number of the new and old hard disks. For example, the old hard disks are usually HDA new hard disks and SATA, so they are often sda sdb. Mistaken device numbers may cause serious consequences.

Step 3. Use LiveCD seems to be popular with Ubuntu LiveCD, but in fact Gparted LiveCD is enough, less than 100 M.

Step 4. Terminal window of LiveCD, dd if =/dev/hda of =/dev/sdb bs = 32256 conv = notrunc, noerror
Parameter description: "32256" indicates that one track is copied at a time. There are 63 sectors in one track, with 512 bytes per sector. "notrunc" indicates that the idle part is not skipped. "noerror" indicates that the warning is ignored.

Step 5. Use Gparted to view the new hard disk. You can see that there is a large amount of unallocated space, Resize to 100%, Apply, Reboot, and get it done!
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.