Results 1 to 3 of 3

Thread: Using dd to copy hard drive partitions

  1. #1
    Ah, Mrs. Peel! mike_w's Avatar
    Join Date
    Oct 2003
    Location
    Hertfordshire, England
    Posts
    3,326
    Thanks
    3
    Thanked
    9 times in 7 posts

    Using dd to copy hard drive partitions

    At some point in the near future, I intend to get a new hard drive, and intend to use dd to copy some partitions across. However, I've never actually used it before, so a few questions:

    1) The new drive is SATA (old is PATA). I assume that doesn't make any difference?

    2) The new partition is liable to be of a different size. Again, does that make any difference? (That's assuming I would have to make the new partition beforehand...?)

    3) What command would I actually use? So far as I understand, dd if=/dev/hda1 of=/dev/sda1 (or something very similar) is what I want to use.

    Any advice is appreciated.

    Thanks

    Mike.
    "Well, there was your Uncle Tiberius who died wrapped in cabbage leaves but we assumed that was a freak accident."

  2. #2
    Agent of the System ikonia's Avatar
    Join Date
    May 2004
    Location
    South West UK (Bath)
    Posts
    3,736
    Thanks
    39
    Thanked
    75 times in 56 posts
    ok

    1.) no problem at all
    2.) yes it does matter and you won't have to make the partition yourself, that the problem, dd will copy the disk (partition table included) at a block level, so if you have a 200GB disk and your moving from an 80 gig disk then your partition layout will have the same as it did on the 80 gig disk. This can be a problem if you a.) want to change your partition sizes b.) have already used up all your partition spaces as 4 primary partitions = 80 gig = 120 gig of wasted disk.
    3.) dd if=/dev/hda of=/dev/sda bs=512k (block size is important - too low and it will take forever, too fast and you'll overrun the bus and get corruption)

    There is however, a better way for your situation.

    1.) insert new disk and partition
    2.) boot from a livecd distro - format your new disk with the correct file systems you want (handy if you want to move from say ext3 to xfs say also depends on distro support)
    3.) mount your old disk on /mnt/old (mount /dev/hda1 /mnt/old /dev/hda2/mnt/old/boot etc) mount your new disk on /mnt/new (mount /dev/sda1 /mnt/new /dev/sda2 /mnt/new/var etc)
    4.) cp -Rpx /mnt/old /mnt/new
    cp -Rpx /mnt/old/boot /mnt/new/boot
    5.) re-install boot loader
    6.) change core files /etc/fstab menu.lst etc etc to point at the correct partitions/disks)

    the -x makes it not follow mount points so anything under /mnt/old thats on a seperate mount point you'll need to do manually.
    Last edited by ikonia; 07-04-2006 at 06:45 PM.
    It is Inevitable.....


  3. #3
    Ah, Mrs. Peel! mike_w's Avatar
    Join Date
    Oct 2003
    Location
    Hertfordshire, England
    Posts
    3,326
    Thanks
    3
    Thanked
    9 times in 7 posts
    Righto - sounds like a better plan, seeing as I wanted to increase partition sizes. I don't suppose there really is much benefit from moving file system? I was just going to stick with ext3 - don't really need any speed boost.

    Thanks.

    Mike.
    "Well, there was your Uncle Tiberius who died wrapped in cabbage leaves but we assumed that was a freak accident."

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help with extending my hard drive
    By JRO7563 in forum PC Hardware and Components
    Replies: 2
    Last Post: 21-12-2005, 01:41 AM
  2. new hard disk want to copy old hard disk
    By skha in forum Help! Quick Relief From Tech Headaches
    Replies: 6
    Last Post: 03-10-2005, 01:55 AM
  3. Laptop and new hard drive - will not boot/bios.
    By nev_payne in forum Help! Quick Relief From Tech Headaches
    Replies: 6
    Last Post: 28-09-2005, 11:44 AM
  4. Servers
    By [GSV]Trig in forum PC Hardware and Components
    Replies: 32
    Last Post: 28-01-2005, 06:19 PM
  5. Looking for a Database Programmer
    By tillyoubreakit in forum Software
    Replies: 35
    Last Post: 25-04-2004, 05:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •