Find the answer to your Linux question:
Results 1 to 6 of 6
i'm trying to clone a hard drive using dd & netcat. on target: nc -l -p 1333 |dd of=/dev/sdb on source: dd if=/dev/sdb |nc 192.168.0.5 1333 However after a while ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2008
    Posts
    60

    Question dd imaging


    i'm trying to clone a hard drive using dd & netcat.
    on target:
    nc -l -p 1333 |dd of=/dev/sdb

    on source:
    dd if=/dev/sdb |nc 192.168.0.5 1333
    However after a while since the process was initiated I get a

    I/O error in filesystem ("....") meta-data dev ...block 0x..... ("xfs_read_buf") error 5 buf count 512
    XFS: size check 2 failed


    Further digging showed that the target hard drive was less in space by 100 kb. Both are 1 T drives seagte but different models, hence the diff in space maybe.The data on the original drive is only 900 GB. How do i get around this problem?

    Cheers
    David

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,746
    The dd utility is copying data at a layer below the filesystem. If the filesystem has issues after using dd because the destination is too small, there is nothing dd can do about it.

    If your destination drive can hold all of the data, use a utility to copy the data (instead of the lower-level that dd handles.)

    Code:
    man rsync

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    11,167
    I usually use rsync to clone the file system, after configuring and formatting (fdisk, mkfs) the target. That way, I can use a different file system type or different size hard drive. With dd you have to be sure that the target is EXACTLY the same as the source drive.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. #4
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,746
    Quote Originally Posted by Rubberman View Post
    With dd you have to be sure that the target is EXACTLY the same as the source drive.
    No, not exactly the same - the same size *or larger.* But if you dd a smaller drive > bigger drive, then you copy over the smaller partition table. This will mean the "extra" space on the bigger drive will not be available until the partition table is fixed/re-done.

    For all of these reasons, copying at the filesystem level (rsync) is simpler.

  5. #5
    Just Joined!
    Join Date
    Jun 2008
    Posts
    60
    Thank you all, that was very informative.

    I intend to preserve the low level stuff as well, as in filesystem fragmentation and anything else that may be in there (nothing else apart from fragmentation that i can think of) .thats reason for me using dd. rsync woulnt preserve that right? it would be more like a copy of the data...?


    Cheers
    David

  6. #6
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    11,167
    If what you want is a bit image of the drive, including partition table, then what I do is a simple cat on the drive to a file. IE: cat /dev/sdx >bit-image-file
    You can also use dd to do the same, with some more options for how big you want the i/o buffers to be which cat doesn't provide. In either case, you get a full disc image that can be used for forensic or other types of off-line analyses.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

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