Sanity check before trying to dd my hard disk
So I got a new bigger hard drive for my laptop and a USB enclosure for the new drive. I need to clone over all of my partitions including my extended partition with several logical partitions inside it. I wanted to post my plan and see if I'm about to do something stupid or if what I am going to do will even work.
First, I think I won't need to partition or format the new drive since I will just be copying the MBR over using: dd if=/dev/sda of=/dev/sdb bs=512 count=1 This should establish an identical partition table on my new drive. From there I just do dd if=/dev/sda1 of=/dev/sdb1 bs=4096 conv=notrunc,noerror etc. for all of the primary partitions. My current thinking is that this will get all of the formatting on each of the partitions and will also take care of copying the extended boot records since they should just be in the extended partition, sda4. From there I plan to use qtparted to expand the extended partition to encompass the new free space at the back of the drive and make some new logical partitions to put more stuff on. My questions: 1. Will this work, or should I change anything? 2. Is there a better/faster block size I should be using to copy the data with? Both drives are in good condition (probably) so I was thinking I could use a larger block size. I read the howto here: http://www.linuxquestions.org/questi...ommand-362506/ but it didn't cover extended partitions and whether the partition table will allow me to avoid doing anything else. Thanks in advance for your comments. |
Remember if you transfer the mbr on new hard disk, you can boot the system from this new hard disk setting the bios.
I don't think that using a large block size you obtain a big increment on performance but it's sure that you lose a lot of space on the disc due to small files (On Linux system are lot). Also using an hard disk on usb involves minors performance. Perhaps your solutions works but perhaps you may take advantage of having a new hard disk to better accommodate your partitions, sometimes during use happen to realize that it would be better to set them in different ways. ;) |
By the way, after simply writing MBR to a disk it is not obvious that Linux will immediately pick up new partition layout. Fdisk does some special ioctl's for that, but I cannot say which.
Next, bs that you specify for copying actual data should be either the real size of one read on your drive or something big. It doesn't affect what you get (it is not the block size used during formatting that AleLinuxBSD mentioned), but it can affect speed of the operation. If you copy entire disk, and then change something, I'd use one big dd on entire devices. But honestly, I would just partition the new drive from the beginning, tar all files and untar them back on the new partition (it can be done on the fly using pipes, of course). It can even give some defragmentation effect. |
Quote:
|
I don't know enough to say if dd will work or not for this, but I'm certain that it could be done with gparted. I would suggest booting from a live CD or rescue CD that has gparted installed, use it to partition the new disk however you like, then copy the old partitions to the appropriate partitions on the new disk.
|
All times are GMT -5. The time now is 12:17 AM. |