As a scientist, it is pretty convenient to use linux for my work. It is a flexible, lightweight and not to mention free OS. Over the past 4.5 years of using this system, I have learn't a few handy things, but this OS never runs out of things to teach me. Today, I learn't about using dd to create a cloned hard disk. Now, you will of course need to know something about how linux manages disks and partitions, but hopefully the elegance of this will be evident even if you do not.
dd creates a byte by byte replica of a source to some destination (hard drive to hard drive, or hard drive/cdrom to an image file). The advantages of this are that it only sees 1's and 0's, not files. It will replicate partitions, and file distribution. There are some downsides, like it will preserve "fragmentation" of the drive, and empty space, will still take up space on the image, ie: creating an image from a 40GB drive will produce a 40GB image file, even if the original hard drive was half empty. But, when you want to be sure that your data is preserved, then these are a small price to pay.
To use dd (which might need to be installed on your particular distro), you would use something like the following (from a terminal of course):
dd if=/dev/sda of=/dev/sdb
where if is the source, and of is the destination. The source can be anything like
/dev/sda; /dev/sda1; /dev/cdrom; /home/user/
and the destination can be anything like
/dev/sdb; /dev/sdb1; /home/user/image.img (hard drive image), or /home/user/image.iso (cd/dvd image).
You might already see how this could be used to create a hard drive image, or optical disk image, which can serve as a backup, or for replication onto several other devices.
Some tips on how to optomise this process are:
1: Change the blocksize to 1MB using "bs=1M"
2: Compress the image file using gzip (or pigz - a parallel version of gzip)
Go Linux!
Wow this is too higher grade for me :D
ReplyDeleteMost people who have never used Linux are very intimidated by a Linux terminal. Really, it is your best friend, and allows you to accomplish otherwise mundane things very quickly.
ReplyDelete