Results 1 to 10 of 10

Thread: dd command question

  1. #1

    dd command question

    I need to clone my existing 32 GB drive before attempting to recover missing files, files which I think were deleted by accident.

    I believe the files are still there but that I have to avoid writing to the drive in order to avoid overwriting them.

    So, I want to use the dd command, with sda being my source (input), sdb being my destination (output).

    Code:
    Code:
    sudo dd if=/dev/sda of=/dev/sdb
    SDA is unmounted, a 32 GB SSD and contains the raw data I need to duplicate.

    SDB is a new 64 GB USB drive.

    I am using a live cd, ver 13.04.

    Gparted would not allow me to do anything to the 64 GB USB drive, saying it was 'in use'. I tried to format it to ext4 (same as my source/input drive), but Gparted wouldn't let me format the drive either.

    In order to format the drive, I had to exit from the live cd, then boot from my primary drive. Only then, would it allow me to format the 64 GB usb memory to ext4 (I created a 39 GB ext4 partition).

    However, now I can't mount the 39 GB USB drive, getting the following error:

    Code:
    Code:
    Error mounting /dev/sdb1 at  /media/artie/f2d6e163-61fe-45f1-9225-ed0093254591: Command-line `mount  -t "ext4" -o "uhelper=udisks2,nodev,nosuid" "/dev/sdb1"  "/media/artie/f2d6e163-61fe-45f1-9225-ed0093254591"' exited with  non-zero exit status 32: mount: wrong fs type, bad option, bad  superblock on /dev/sdb1,
           missing codepage or helper program, or other error
           In some cases useful info is found in syslog - try
           dmesg | tail  or so
    I have attached screen captures obtained from the Disks tool which comes with my Xubunto 12.10.

    I have 2 questions..........

    Do I need to format the 64 GB destination/output memory before attempting to use the dd command as stated above?

    And, are there changes in 13.04 that make it necessary to do the dd command differently?

    TIA.

    Art
    Attached Images Attached Images

  2. #2
    ahallubuntu is offline Chocolate-Covered Ubuntu Beans
    Join Date
    Jul 2005
    Beans
    2,050

    Re: dd command question

    ~
    Last edited by ahallubuntu; June 24th, 2013 at 01:50 AM.

  3. #3
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: dd command question

    Quote Originally Posted by goodbye-windows(tm) View Post
    Do I need to format the 64 GB destination/output memory before attempting to use the dd command as stated above?
    No.

    If you did any formatting or partitioning on the new drive it would be overwritten anyway when you run the dd command.
    The dd command copies everything from the source to the destination, including the partition table and MBR (if any).
    Cheesemill

  4. #4

    Re: dd command question

    Thanks to you both, I'll go back to the live cd and try it again.

    Art

  5. #5

    Re: dd command question

    No Joy,

    I booted from the live cd, checked the designation on both drives (to confirm I have the correct input and output drives, then confirmed that both drives were unmounted.

    I then issued the following and received the following output:

    Code:
    xubuntu@xubuntu:~$ dd if=/dev/sda of=/dev/sdb bs=2048
    dd: opening ‘/dev/sda’: Permission denied
    xubuntu@xubuntu:~$
    I'm using the live cd, so permissions shouldn't be a problem.............

    Just before returning to this forum, I tried mounting the 39 GB USB drive (destination/output drive) using a right click on the desktop icon and got the following error:

    Code:
    Error mounting /dev/sdb1 at /media/xubuntu/f2d6e163-61fe-45f1-9225-ed0093254591: Command-line `mount -t "ext4" -o "uhelper=udisks2,nodev,nosuid" "/dev/sdb1" "/media/xubuntu/f2d6e163-61fe-45f1-9225-ed0093254591"' exited with non-zero exit status 32: mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
           missing codepage or helper program, or other error
           In some cases useful info is found in syslog - try
           dmesg | tail  or so
    Prior to trying to use the 39 GB drive to copy using the dd command, there was other data on it-but I thought anything written on it would be overwritten anyway.

    I'm lost.

    Art

  6. #6
    Join Date
    Jun 2009
    Location
    Chicago Suburbs
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: dd command question

    I still might try sudo. Sometimes even with liveCD it seems to be needed, but there is no user or password.

    Powerful command, but often misused and then nicknamed "dd" Data Destroyer
    http://www.linuxquestions.org/questi...ommand-362506/

    from caljohnsmith post #7
    I would recommend using "dcfldd", which is basically dd with more features; it has the really useful feature of showing the copying progress
    http://ubuntuforums.org/showthread.php?t=1033712
    For info on UEFI boot install & repair:
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to close thread when/if answered completely.







  7. #7
    Join Date
    Jul 2010
    Location
    ozarks, Arkansas, USA
    Beans
    6,778
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: dd command question

    goodbye-windows(tm);

    And If I may add: In Gparted... make sure that the swap partitions on the hard disk(s) are not mounted (key icon in the "work" display). Seems if the liveCD can find a swap partition on the hard disk... it will use that swap partition.. hence mounted ... and GParted balks.

    just a thought

    THE current(cy) in Documentation:
    https://help.ubuntu.com/community/PopularPages

    Happy ubutu'n !

  8. #8
    ahallubuntu is offline Chocolate-Covered Ubuntu Beans
    Join Date
    Jul 2005
    Beans
    2,050

    Re: dd command question

    ~
    Last edited by ahallubuntu; June 24th, 2013 at 01:48 AM.

  9. #9
    Join Date
    May 2013
    Beans
    3

    Re: dd command question

    First from what I have found is that you can't just make a copy of a drive to usb....you have to create a mount point.

    So:

    $sudo fdisk -l

    to see your devices. Determine based upon size what is your 32GB source drive and your destination drive.

    Create a folder to mount to:

    $ mkdir /mnt/data


    Mount your source drive:

    $ mount /dev/drivename# /mnt/ddata

    Then use dc3dd or program of choice to create image file:

    $ dc3dd if=/dev/# of = /mnt/data/imagename.dd

  10. #10
    Join Date
    Mar 2008
    Beans
    1,219

    Re: dd command question

    dd isn't the best choice for the task. Especially when you're cloning to SSD as it leads to more writes than necessary.

    I'd simply create a (large enough) partition on /dev/sdb and then copy system files using one of the commands suggested here. Then (assuming /dev/sdb1 is mounted as /mnt/sdb1):
    Code:
    sudo grub-install --boot-directory=/mnt/sdb1/boot /dev/sdb
    and then change the root partition UUID in /mnt/sdb1/boot/grub/grub.cfg and /mnt/sdb1/etc/fstab to that of sdb1.

    To display UUIDs:
    Code:
    sudo blkid
    That's all.
    Last edited by prodigy_; June 16th, 2013 at 09:17 PM.

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
  •