Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Quick help with dd; I need to clone a hard disk

  1. #1
    Join Date
    Mar 2008
    Location
    Deep South Texas
    Beans
    1,890
    Distro
    Ubuntu 11.04 Natty Narwhal

    Quick help with dd; I need to clone a hard disk

    I did a quick search for "dd" postings, but came up confused.


    Scenario:

    I have a customer's computer with a 250Gb hard drive.
    Her husband did a format and re-install of XP. Wife very un-happy.

    I need to return the computer as quickly as possible, so...
    I have a 250Gb drive that I want to "clone" the customer drive onto,
    then I can try recovering any document and jpg files that may have been left (doubtful, I know, but he's paying the piper.)

    1st question
    is it possible to set the original drive to "read-only" to reduce any problems? Original drive must remain un-touched.

    2nd question
    does the destination drive need to be formatted?
    my understanding is; no format needed. True?

    3rd question
    what is the SIMPLEST way to simply clone the drive from one 250gb drive to another?
    Are there any options that would help in increasing SAFETY?
    SPEED is secondary... the original MUST remain untouched by ME.

    I have two more days to return the computer, so the clone/copy operation can take up to 48hrs (safety first, speed second).

    The original drive has approx 150gb used on it.

    And then I can take whatever time I wish to invest in running file recovery software on the clone.

    Again, I do not want to touch the original drive.

    Thanks

    Any pointers to SIMPLE examples will be most appreciated.
    Most examples I've seen have been too complicated

    Again, thanks.

    ErnestG

  2. #2
    Join Date
    Nov 2007
    Beans
    1,818
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: Quick help with dd; I need to clone a hard disk

    I would suggest using a Live CD, and gparted. You can either mount the hard drive to the Live CD and pull files off, or you can use gparted to copy the partition to the other drive.

  3. #3
    Join Date
    Mar 2008
    Location
    Deep South Texas
    Beans
    1,890
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Quick help with dd; I need to clone a hard disk

    Quote Originally Posted by JoshuaRL View Post
    I would suggest using a Live CD, and gparted. You can either mount the hard drive to the Live CD and pull files off, or you can use gparted to copy the partition to the other drive.
    sounds reasonable,

    question..
    will this copy EVERYTHING, including "empty", "unused" sectors?

    I know dd will do a "byte-for-byte" copy, whether it's in use or not, empty or not.

    I need to find erased/deleted/removed files, remember.

  4. #4
    Join Date
    Mar 2008
    Location
    NSW Australia
    Beans
    232
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Quick help with dd; I need to clone a hard disk

    I'm not sure how you have the drives connected, but say the customer's HD is /dev/sda and yours is /dev/sdb. Browse the filesystem to make sure you know which is which.

    1) Yes.
    When you mount the customer's HD, use the 'readonly' option. The disk will not be touched in this mode.

    ie.
    Code:
    sudo mount /dev/sda /where/you/want/to/mount -o readonly
    If you're not sure if this worked, just look for a safe place on the HD and try to save 'blank.txt' or such.

    2) The destination does not have to be formatted. The easiest & safest way IMO to do it is to make an iso file.

    The dd command will be:

    Code:
    dd if=/where/you/mounted/HD of=/where/you/want/backupfile.iso
    So the HD will be backed up to an iso file, which you can mount in any filesystem and look over in any operating system.

    It could take a long time, and dd gives no status messages.

  5. #5
    Join Date
    Dec 2007
    Location
    UK
    Beans
    1,351
    Distro
    Ubuntu Gnome

    Re: Quick help with dd; I need to clone a hard disk

    For cloning you could try Clonezilla:
    http://clonezilla.org/
    But if the drive has been formatted & you are wanting to recover files using some sort of file recovery software you would need the original drive, as I don't think that the data would transfer well for recovery.
    Why such a short time to get the machine back & why can't you touch the drive? I know, mind your own business
    Registered Linux user #475388
    Using Various flavours of Linux: Ubuntu 10.04, Linux Mint 6, Mandriva, OpenSuse.

  6. #6
    Join Date
    Mar 2008
    Location
    NSW Australia
    Beans
    232
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Quick help with dd; I need to clone a hard disk

    I'll just mention, for absolute byte-for-byte accuracy you might need to clone the partition directly.

    ie. dd if=/dev/sdX of=/wherever/backup.iso

    The command works like this:

    if=somewhere
    Where data is read from. I use it to back up cd's or DVD's using dd if=/dev/dvd

    of=somewhere
    Where data is put to
    You can probably do that straight to another device, though I've not tried it myself, the documentation suggests it will work for that purpose. It's just an issue if you have existing data on that drive, as it will overwrite everything including the MBR.

    I'm not sure if the first way will preserve everything, and this way while /dev/sdX will remain untouched, if you get it wrong you'll corrupt the data on the partition.

    http://www.mckeay.net/2004/10/18/usi...to-clone-a-hd/
    Last edited by AndyCee; January 7th, 2009 at 10:55 PM. Reason: Added link

  7. #7
    Join Date
    Mar 2008
    Location
    California, USA
    Beans
    8,111

    Re: Quick help with dd; I need to clone a hard disk

    Hi Ernest, I just wanted to mention that if you use gparted to copy the Windows partition to another drive, you will just get a copy of the partition without copying the MBR or any unused disk space on the original drive. If you want to use dd to clone the entire drive, I would recommend using "dcfldd", which is basically dd with more features; it has the really useful feature of showing the copying progress, unlike dd where you have no idea how much data has been copied while it runs. You could do the following:
    Code:
    sudo apt-get install dcfldd
    sudo dcfldd if=/dev/<source drive> of=/dev/<destination drive> statusinterval=10 bs=10M conv=notrunc
    The "statusinterval" times the "bs" or blocksize is how many bytes dcfldd copies before it updates its progress, so in the above example the progress will be updated for every 10M X 10 = 100 MB of data copied. Using a blocksize of 10 MB works well, because that means dd copies 10 MB chunks at one time, rather than the default which is only 32 kB. That means the copying goes alot faster. Also, to try and answer your questions, I don't know of any way to set your source drive as read-only, but if you are careful with the above command you should be fine. In addition, you don't have to format the destination drive since you will cloning the source drive byte-for-byte. Good luck and let us know how it goes.

  8. #8
    Join Date
    Mar 2008
    Location
    Deep South Texas
    Beans
    1,890
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Quick help with dd; I need to clone a hard disk

    Quote Originally Posted by kestrel1 View Post
    For cloning you could try Clonezilla:
    http://clonezilla.org/
    But if the drive has been formatted & you are wanting to recover files using some sort of file recovery software you would need the original drive, as I don't think that the data would transfer well for recovery.
    Why such a short time to get the machine back & why can't you touch the drive? I know, mind your own business
    Clonezilla is not an option.

    Forensic analysis of hard drives is often done on a copy.
    Law-enforcement-level copies can be done with 'dd', as courts have held this a valid technique to assure a complete, legitimate copy.

    I have a friend who does this kind of stuff for a living.
    and no, I can't ask him to do this for me...in this case...

    As for the short time-frame, the lady needs the computer back at the start of her class-work.

    And I can't touch the drive, so as to be able to certify that I did not damage, delete, erase or remove any data on that drive.

    Normally, I would sub-contract this out, but this is a "special" exception.

    It's called "pro bono" work.

  9. #9
    Join Date
    Nov 2007
    Beans
    49
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: Quick help with dd; I need to clone a hard disk

    If u have ever read 2600 the most recent relase has a very good data recovery tutorial useing a live cd the dd command and foremost its very simple and effective for what your doing.

    O btw since he didnt only format he reinstalled he wrote over the data so you probley wont be able to recovery every thing

  10. #10
    Join Date
    Dec 2007
    Location
    UK
    Beans
    1,351
    Distro
    Ubuntu Gnome

    Re: Quick help with dd; I need to clone a hard disk

    Fair enough.
    Registered Linux user #475388
    Using Various flavours of Linux: Ubuntu 10.04, Linux Mint 6, Mandriva, OpenSuse.

Page 1 of 3 123 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
  •