Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: how do I use dd to do a disk copy?

  1. #1
    Join Date
    Mar 2006
    Location
    Earth
    Beans
    577
    Distro
    Ubuntu 14.04 Trusty Tahr

    how do I use dd to do a disk copy?

    Hi Ubuntu Community:

    I accidentally removed all of my files from my home directory and the backup hard drive. A synopsis of that episode is found at: http://ubuntuforums.org/showthread.php?t=1675564

    I want to
    1. make an identical copy of the hard drive that I accidentally hosed using dd


    Here is what I've done:

    • I installed a 1Tb hard drive,
    • booted from a live Ubuntu 10.04 CD
    • used: sudo gparted, and
    • saw that the 1 Tb drive is /devsda (with 931GiB),
    • the old home drive that I hosed is /dev/sdb (232 GiB)


    The partitions of /dev/sdb are:
    • /dev/sdb1 (230 GiB ext4)
    • /dev/sdb2 (2.8 GiB extended), and
    • /dev/sdb5 (2.8 GiB swap)


    I want to use dd to make a copy of the old drive.

    Do I use:

    dd if=/dev/sdb of=/dev/sda

    ?

    Also, do i need to install dd from the live CD?

    Thanks,
    Phil Smith
    Duluth, GA

  2. #2
    Join Date
    Jun 2007
    Location
    Lynne Valley, BC
    Beans
    2,844
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: how do I use dd to do a disk copy?

    Just open terminal and:

    Code:
    sudo dd if=/dev/sdb of=/dev/sda
    No need to partition the new disk or anything.

  3. #3
    Join Date
    Jun 2010
    Location
    /home/TX
    Beans
    225
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: how do I use dd to do a disk copy?

    Correct me if I'm wrong, but considering that they're 2 different sized disks, wouldn't that somehow mess up the 2nd (1TB) disk?
    "The secret to creativity is knowing how to hide your sources." -Albert Einstein

    Ubuntu User #32977; Linux User #528876

  4. #4
    Join Date
    Oct 2009
    Beans
    2,199
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: how do I use dd to do a disk copy?

    I think if your 1TB disk will appear to be a 250GB disk after the copy. It will also have the same UUID as the 250GB drive so it would be important not to try to boot with both drives connected.
    Your data is in sdb1. So you could create a partition on the 1TB drive that is >=250GB and copy sdb1 to it using dd.

    For more info about dd this is an excellent guide: http://www.linuxquestions.org/questi...ommand-362506/

  5. #5
    Join Date
    Jun 2007
    Location
    Lynne Valley, BC
    Beans
    2,844
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: how do I use dd to do a disk copy?

    Quote Originally Posted by kroq-gar78 View Post
    Correct me if I'm wrong, but considering that they're 2 different sized disks, wouldn't that somehow mess up the 2nd (1TB) disk?
    After the dd, gparted can be used to expand the partition, or if a Windows o/s was on it, add another partition.

  6. #6
    Join Date
    Mar 2006
    Location
    Earth
    Beans
    577
    Distro
    Ubuntu 14.04 Trusty Tahr

    How do I specify file system type in mounting?

    Hi Community:

    As a prelude to using sudo dd if=/dev/sdb of=/dev/sda I tried to mount /dev/sda first... and had a problem.

    I tried to mount the 1Tb drive using:

    sudo mkdir /media/MYNEWDRIVE
    sudo mount /dev/sda /media/MYNEWDRIVE

    and got the error message: you must specify the filesystem type

    What do I need to do?

    Thanks,
    Phil Smith
    Duluth, GA

  7. #7
    Join Date
    Oct 2009
    Beans
    2,199
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: how do I use dd to do a disk copy?

    You will not be able to mount a drive that has no formatting. Mounting is not required for dd. It will copy using two unmounted disks.

    Connect up both disks. Boot off live CD. In terminal type "sudo fdisk -l" and check what device paths have been assigned to each HD. In other words, make sure you know which disk is /dev/sda and which is /dev/sdb. If you get the of= wrong you'll be sorry! Then do "sudo dd if=/dev/sdx of=/dev/sdy bs=64k conv=notrunc,noerror" choosing the x and y appropriately.

    This may take a while...an hour or more...and dd will give you no feedback at all while it does it. You'll see your HD light in a viscous blur, however.
    Last edited by YesWeCan; February 3rd, 2011 at 12:50 AM.

  8. #8
    Join Date
    Mar 2006
    Location
    Earth
    Beans
    577
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: how do I use dd to do a disk copy?

    Hi YesWeCan:

    Thanks for your explanation. dd is running right now.

    I used

    sudo dd if=/dev/sdb if=/dev/sda bs=64k conv=notruc,noerror

    How will I know it worked correctly? I mean, will I get any sort of message or something?

    Thanks!
    PHil

  9. #9
    psusi is offline Ubuntu addict and loving it
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Beans
    3,980
    Distro
    Ubuntu Development Release

    Re: how do I use dd to do a disk copy?

    It will return to the prompt when done, though you are kind of wasting your time. What do you hope to accomplish by this?

  10. #10
    Join Date
    Mar 2006
    Location
    Earth
    Beans
    577
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: how do I use dd to do a disk copy?

    Hi YesWeCan:

    Your dd code worked perfectly!

    Thanks!
    Phil

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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