Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: usb stick wrong size after dd

  1. #11
    Join Date
    Oct 2007
    Location
    Chennai, India
    Beans
    3,804
    Distro
    Ubuntu Development Release

    Re: usb stick wrong size after dd

    Quote Originally Posted by 1clue View Post
    The device is /dev/sde, not /dev/sde1. It's not a fake drive,

    I tried the dd if=/dev/zero and it still shows as 4g, still unrecognized partition table and still won't write a new one using gparted as root.

    If you used dd correctly, it should not show you any partitions at all. I assume you used sudo. It should also trigger a kernel refresh to re-read the partitions; assuming it didn't, try this command to refresh the kernel's knowledge of the partitions:
    Code:
    sudo partprobe /dev/sdX #sde
    Then, please check the "disklabel". you can do this in GParted: for your usb "drive": Click Device-Set Disklabel and set it to msdos. Then click "Create". You can then try to partition as normal.

    Before starting any of the above, please issue the below command in ANOTHER terminal
    Code:
    tail -f /var/log/syslog
    Then plug in the usb drive and perform the above operations. I assume your data is long gone and you are only interested in bringing the pendrive back to life.

    If you find the problem is still not solved, please post back the log output from the above command.
    Cheers,PRShah
    Make your own: Ubuntu, Kubuntu, Xubuntu, Mythbuntu All-in-One Live DVD
    "I never make mistakes; I thought I did, once.. but I was wrong."

  2. #12
    Join Date
    Mar 2009
    Beans
    1,982

    Re: usb stick wrong size after dd

    Yes, I copied the iso over with dd to the raw device. I have been unable to make a partition after the 4g one because all the disk utilities think there's no drive out there.

    I did all this stuff as root. There is no partition, just a blank 4g space. I can't create a partition at all because there is no partition table. The various utilities fail in different ways when I try to write a partition table. testdisk lets me 'create' one and even change the disk geometry so it looks like 32g again, but when I power the device down and remove/reinstall it, nothing was written at all.

    The data on the drive was never an issue. It's long gone or useless by now. The drive on the other hand is usb3 64g and it cost a significant amount of money.

  3. #13
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: usb stick wrong size after dd

    If you just want to erase MBR, which will zero out partition table. Normally you only use dd on first 446 as that is the boot code & the rest is the partition table.
    dd has the nickname Data Destroyer for a reason.

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


    Erase Partition- Make double sure you have correct drive & partition example is sda1
    sudo dd if=/dev/sda1 bs=512 count=1 | hexdump -C
    example is sda be sure to change:
    Zero out MBR and partition table
    dd if=/dev/zero of=/dev/sda bs=512 count=1

    Info on MBR
    http://www.dewassoc.com/kbase/hard_d...oot_record.htm
    MBR details including 2TiB limit and GPT link
    http://en.wikipedia.org/wiki/Master_boot_record

    Then you may be able to build a new partition table.
    For more info on UEFI boot install & repair - Regularly Updated :
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  4. #14
    Join Date
    Mar 2009
    Beans
    1,982

    Re: usb stick wrong size after dd

    Dude,

    I'm one of the guys who's been calling it data destroyer. I don't even know what the original name means. I have to fire up the man page every time I use it, because I'm terrified of it.

    The whole point of this project was to fool the system that my usb was a true iso cd. That didn't work, but what I forgot to do is grab the boot block(s) before I trashed it.

    If I DD the first few blocks from a 64g stick over the top of this 32g one, will it hurt anything?

    I don't have another 32g, nor do I have another usb3 stick. I do however have a couple 64g usb2 ones.

  5. #15
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: usb stick wrong size after dd

    I have seen testdisk & some Windows tools create partition tables with the wrong size that we then had to repair.

    You may be able to write the output from sfdisk, edit end value and import into defective one? See man sfdisk.


    Backup partition table to text file & save to external device.
    sudo sfdisk -d /dev/sda > PTsda.txt

    Restore from PT.txt, adjust examples with sda or sdc to your drives
    sudo sfdisk --no-reread -f /dev/sdc -O PT.save < PT.txt
    sudo sfdisk --no-reread -f /dev/sdc -O PTsda.save < PTsda.txt
    "--no-reread" means don't check if disk is unmounted
    -f force
    "-O PT.save" means save a backup of original partition table in PT.save. PT.save is in binary format.


    Using sfdisk to fix partition table problems - not without risk
    http://ubuntuforums.org/showthread.php?t=1192598
    Equivalent sfdisk values would keep the start point and convert the end point via the formula size = end - start + 1.
    Also fdisk -lu shows start & blocks, blocks * 2 also equals size in sectors

    Caljohnsmith using sfdisk to edit partition table from text file
    http://ubuntuforums.org/showthread.php?t=1036600
    http://ubuntuforums.org/showthread.php?t=1038943
    caljohnsmith and meierfra use sfdisk links:
    Exported partition table & reimported to fix with sfdisk.
    http://ubuntuforums.org/showthread.php?t=1591704
    For more info on UEFI boot install & repair - Regularly Updated :
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  6. #16
    Join Date
    Feb 2009
    Location
    Slovenija
    Beans
    Hidden!

    Re: usb stick wrong size after dd

    Quote Originally Posted by oldfred View Post
    If you just want to erase MBR, which will zero out partition table. Normally you only use dd on first 446 as that is the boot code & the rest is the partition table.
    dd has the nickname Data Destroyer for a reason.

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


    Erase Partition- Make double sure you have correct drive & partition example is sda1
    sudo dd if=/dev/sda1 bs=512 count=1 | hexdump -C
    example is sda be sure to change:
    Zero out MBR and partition table
    dd if=/dev/zero of=/dev/sda bs=512 count=1

    Info on MBR
    http://www.dewassoc.com/kbase/hard_d...oot_record.htm
    MBR details including 2TiB limit and GPT link
    http://en.wikipedia.org/wiki/Master_boot_record

    Then you may be able to build a new partition table.
    I did the exact same thing as OP with a 4 GB USB drive. I dd-ed an Linux DVD iso to it. I was really surprised when it didn't allow me to delete the files in Linux. So I booted to windows and I was even more surprised that there seem to be no way to delete the partition table. The only thing I was able to do is to allocate ~230 MB through Windows 7.

    So I gave this instructions above a try. I used
    Code:
    sudo dd if=/dev/sdb bs=512 count=1 | hexdump -C
    dd if=/dev/zero of=/dev/sdb bs=512 count=1
    sudo fdisk -l /dev/sdb //some progress was shown here
    sudo fdisk /dev/sdb //this is how i entered the partition editing
    In fdisk I pressed n for new partition table, p for primary and w to write it. Then I executed:

    Code:
    sudo mkfs.vfat -F 32 /dev/sdb1
    And I recovered the full disk size. I didn't try to write such amount of data on it, but it seem to have worked.

Page 2 of 2 FirstFirst 12

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
  •