Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 06-21-2008, 10:41 AM   #1
LQ Newbie
Registered: Sep 2005
Distribution: Slackware-current, Sabayon, Suse 11
Posts: 11

Rep: Reputation: 0
Exclamation 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: 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.
Old 06-21-2008, 12:01 PM   #2
Registered: May 2006
Location: Italy
Distribution: Ubuntu, ArchLinux, Debian, SL, OpenBSD
Posts: 274

Rep: Reputation: 38
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.
Old 06-21-2008, 12:15 PM   #3
Senior Member
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (
Posts: 1,900

Rep: Reputation: 68
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.
Old 06-21-2008, 06:44 PM   #4
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 16,460

Rep: Reputation: 2391Reputation: 2391Reputation: 2391Reputation: 2391Reputation: 2391Reputation: 2391Reputation: 2391Reputation: 2391Reputation: 2391Reputation: 2391Reputation: 2391
Originally Posted by raskin View Post
But honestly, I would just partition the new drive from the beginning, tar all files and untar them back on the new partition
*Much* better idea. I just use "cp -a ..." but either will work. "dd" is not aware of filesystem errors - using tar/cp you get to find out about them. Also you get to set up the partitions to the size and type (perhaps change the filesystem altogether) as you want them to actually exist.
Old 06-21-2008, 08:08 PM   #5
Registered: Mar 2008
Location: Baltimore Md
Distribution: ubuntu
Posts: 184

Rep: Reputation: 41
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.


dd, partition

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to check processor, ram and hard disk? jolly Linux - General 16 02-11-2014 05:05 PM
Check hard disk usage per directory alaios Linux - General 4 10-09-2006 03:55 PM
Sanity Check DotHQ Linux - General 6 03-31-2006 09:24 PM
prog for hard disk sector check? Thinking Linux - Software 5 12-22-2005 04:09 PM
Kernel corrupt, check hard disk Hal Linux - Hardware 2 12-22-2005 10:15 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:37 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration