My "lazy way" of cloning a drive is to copy the contents to a drive of the same size or bigger using dd.
I then do like the following:
have the SOURCE and TARGET drives connected to a PC or something that runs linux.
One way is to use a live linux system on a CD or USB stick.
And Clonezilla is a very good live cloning system that can manage most drive cloning with ease, but one can also boot Clonezilla up and use the shell to manually do some operations. Clonezilla have a great support of different hardware, like raid controllers, LVM et cetera already set up for you.
Ok. The drives are connected. Make sure they are not mounted in any way!
command 'df' will show if they had been automounted. Then umount them
If there are raid partitions on any of the disks, (SOURCE or TARGET), then the command 'cat /proc/mdstat' will show if the raid partions have been automatically loaded by the system. You will in that case want to stop the raid partitions.
Lets say you want to clone sda to sdd, and 'cat /proc/mdstat' give you the following:
Personalities : [raid6] [raid5] [raid4] [raid0]
md0 : active raid0 sda1 sdb1
1172463360 blocks 256k chunks
unused devices: <none>
Then you must issue the command 'mdadm --stop /dev/md0' to stop that raid set.
Recheck /proc/mdstat will to see that you stopped the raid set. You will not damage anything unless you stop the raid in the actual booted os that uses the raid. You will merely so to say "unmount" the raid set.
So far, so good.
You can check what partitions and filesystems you currently have on your disks by the commands:
which will show you all the recognized drives and partitions, and
which will show you the UUID and filesystem type of all drives and partitions recognized by the OS.
Lets say that the TARGET drive already have some partitions on it. Then you will have to remove them first.
Easiest way is to remove them with 'cfdisk' or 'fdisk' or whatever your prefer.
If there are any DOS partitions, you will have to remove them, and then reboot to make sure the system forgets about them. (d*mned sneaky BIOS)!
Check that the partiotions are all gone on /dev/sdd by the command:
It should only list the sdd drive, and not any partitions, like sdd1.
Then, to be paranoid, you can completely remove the partitioning and boot sector data from the target drive, through the following command, where we use /dev/sdd as the TARGET drive:
dd if=/dev/zero bs=1k count=64k of=/dev/sdd
Which wipes the first 64 megabytes of the TARGET drive /dev/sdd.
(Dont forget the 'sync'. It makes sure the writes are flushed to the disks).
Next step, when we have the SOURCE and TARGET drives online and unmounted, is to copy the partitions.
Simplest way is to first copy over partition table and boot sector from the SOURCE, like the following where SOURCE is /dev/sda and TARGET is /dev/sdd
dd if=/dev/sda bs=1b count=42 of=/dev/sdd
Copies 42 sectors. Why 42, where one sector is enough? Why not?
Then open up the target drive in cfdisk, take a look, and then Write the contets (unchanged) to disk.
This makes sure that BIOS understands the new partitioning of the drive /dev/sdd
If you have copied/created any DOS partitions you will have to reboot before the next step.
You can now check that the partitioning has been copied from /dev/sda to /dev/sdd with:
ls /dev/sda* /dev/sdd*
if you now want to completely clone the SOURCE drive to the TARGET drive, go ahead and:
dd if=/dev/sda of=/dev/sdd
You can also copy each partition one by one, like:
dd if=/dev/sda1 of=/dev/sdd1
Then the cloning is all done.
Disks now have the same partitions, MBR, UUID's and disk volume id. Remember that strange things will happen if you connect both these disks to the same PC, or uses these two disks in two PCs, sinve they have the same UUIDs and disk volume ids. (Especially if you use Windows).
Bear in mind that some PCs use the "dead space" between the first sector containing master boot record and partition table, and the first partition on disk for things like hibernation storage and other "under the hood handling", like for example the IBM/Lenovo Thinkpad laptops, so for a safe clone, just copy the entire drive.
But i still think you should use either Clonezilla or R-Studio to copy the drive. Safer that way.