Cloning 1 hard disk to smaller hard disk, dd or ghost?
As the title says.
I've got 2 disks, source disk is 4GB with 2.5GB used and target is 3.2GB. The file system is NTFS with Windows2k.
I've been using dd if=/dev/hda of=/dev/hdb for the past five (identical) disks without a problem. I have 3 more disks to clone. A 3.2GB disk and 2-13GB disks.
I have several linux boxes and an XP box, is this something I can do in Linux with the smaller and larger disks or is this something I have to by ghost/partition magic for?
Any help is appreciated.
I'm no ntfs guru, but I'm pretty sure it often scatters data, and you might have some valuable data at the end of the drive. If you have a copy of that partition to restore from, you might be better off using NTFS-resize to make it a 3GB partition and cloning that.
Otherwise, Ghost or Partition Magic would handle this with the least amount of uncertainty.
dd writes out the information natively in 1s and 0s and so the filing system, the operating system and the conent has no influence. You basically mirror the disk 100%.
For obvious reason one can clone a hard disk if both the source and target disk have identical size. The effect of doing it with different size is the copied partition table can't match the disk interior and the operation may be fruitless when the disk cannot be read.
One can dd one partition at a time as it is easier to have the target partition created in exactly the same size as the source. The successfull rate is pretty good with XP and Win2k, the toughest Windows to be cloned. Like
dd if=/dev/hda1 of=/dev/hdb1
I always add bs=32256 to speed up the process. 32256=63 sector times 512 bytes and is a full track size. Omitting the bs parameter Linux will defaults to copying 512 byte at a time.
Ghost can "scale" the different sizes automatically but again one should know if one has in the source disk more data than the capacity of the target disk nothing in the world can make it work, unless the content is compressed.
Unless the NTFS disk has a XP or Win2k system inside the normal data can be done in "drag and drop" without cloning. If the disk does have a XP or Win2k inside it wouldn't be any good other than the machine from which it is installed. NT versions of Windows will lock up if it detects a significant hardware change. A legal copy XP of course will necessitate a re-activation whereas an illegal copy can work for a while without activation and then drops dead suddenly. So know where you are going with the "dd" command.
If I understand correctly how dd works, if you copy a 2.5 gig partition to a 3 gig partition, dd truncates the 3 gig down to 2.5 gig. To reclaim the lost .5 gig, you will have to resize the partition.
On the other hand, you could use tar to clone the partitions.
1) it's faster.
2) it doesn't resize the partition.
First, cd to the root of the filesystem, or the highest level directory to be cloned.
cd /, or cd /<some directory>
Then clone from one partition to another.
tar cf - . | (cd /path/to/mountpoint; tar xf -)
It should be obvious that both the target and object partitions must be mounted.
Slightly incorrect interpretation.
The empty space in the 3G can be use for another partition. It is never lost and permantly available. Resizing is an option.
What dd got over tar is dd writes the full partition "including" the boot sector, which is a reserved area of the partition.
Tar and its variants deal with the filing system only and the boot sector is untouched because it is not part of the filing system. Tar is for backup and not intended for cloning.
There is no such thing one is better than the other. Just pick the right tool for the right job. For example you can't possibly tar a NTFS partition and have it bootable , can't you? Also dd is king when cloning the whole disk with multiple partition.
I use tar as suggested by bigrigdriver a lot. Speed wise tar is slightly slower but more flexible.
Between tar, dd and ghost the transfer speeds are not much to choose from, in my experience. I got a kick out of not using Ghost after learning the Linux way because it is so simple.
I am seeing a lot of confusion here.
dd will not resize a 3GB partition to a 2.5GB partition if you specify partition devices instead of drive devices. i.e if you partition the destination drive first and use:
dd if=/dev/hda1 of=/dev/hdb1
However, the original question states pretty clearly that he wants to copy a 4GB drive to a 3.2GB drive. Only 2.5GB is used, but NTFS does not necessarily store all its data sequentially on the disk, and dd would lose any data stored beyond the 3.2GB mark on the original drive.
I can't believe this question is being re-answered so badly more than a year after it was originally posted and solved.
You would be right is there is always "one" partition in the hard disk. I did state that the "partition sizes" have to match.
The post was answered by mistake becasue it was displayed at the bottom of a similar thread.
It is a fact that a PC user can download a Linux Live CD and use it to clone a bootable XP partition.
I hate to crash a really and old thread but this one keeps coming up every time I search for "cloning a hard drive to a smaller drive", the way I usually do it is with the following method:
1) I resize the partition using gparted
2) I let the operating system with the resized partition boot so it can fix any possible errors.
3) I use clonezilla to clone the drive
This is how I do it and it has NEVER failed for me
Hope it helps.
Here was my process:
1) Use dd to copy from big partitions to small partitions on a 500GB harddrive to an 80GB SSD.
2) Open up gparted, and see that the small partition had a red exclamation point. When I viewed the information about the drive, the error status window was too tall for my screen.
3) Switch to the big drive and shrink the partitions to match exactly in MiB the size of the target, small partitions. Gparted claims that part of this process is checking the new small partitions on the big harddrive.
4) Use dd again, to partition on small drive, from equally-sized parition on the big drive.
5) In gparted, right click on the partitions on the small drive that still have exclamation points, and choose "check." This queues checking the partitions, and when I pressed the green check mark to do the queued operations, it worked for a sec and then the red exclamation points went away.
Seems to me like you could get away with just doing steps 3 and 4, and that steps 1, 2, and 5 were only because I originally used dd to copy from a larger partition to a smaller one. The real timesaver is that you don't need a Clonezilla live CD/USB key. I did all of this from an Ubuntu live USB. So basically, the answer to everyone saying "oh, but, dd doesn't work from a larger partition to a smaller one," is, "make the larger partition smaller first, and then use dd."
(I'll admit that I'm writing this from the live USB while the second dd run for the second partition I want is running. So, I'm not 100% positive that it worked. But it looks from here like it will have. If I don't reply, assume it worked.)
|All times are GMT -5. The time now is 02:18 AM.|