View previous topic :: View next topic |
Author |
Message |
1clue Advocate
Joined: 05 Feb 2006 Posts: 2569
|
Posted: Thu Jul 26, 2012 3:46 am Post subject: USB stick wrong size after dd |
|
|
Hi,
In an attempt to make a usb stick bootable, I used dd to write an iso image to the thumb drive. Yes it's stupid.
The image didn't work and isn't mountable by any computer I have, but not only that the thumb drive says it's maximum size is the size of the iso, not 32g anymore.
Does anybody know how to repair this using Linux tools? The stuff on the net i found refers to windows apps.
Thanks. |
|
Back to top |
|
|
cach0rr0 Bodhisattva
Joined: 13 Nov 2008 Posts: 4123 Location: Houston, Republic of Texas
|
|
Back to top |
|
|
1clue Advocate
Joined: 05 Feb 2006 Posts: 2569
|
Posted: Thu Jul 26, 2012 6:01 am Post subject: |
|
|
Yes.
Fdisk won't write a partition table, nor will gparted or testdisk or disk utility on the Mac.
I also tried sudo dd of=/dev/sde if=/dev/zero bs=512 count=4 and that still doesn't do anything.
I tried changing disk geometry (cylinders, tracks sectors) and it won't write that either.
If there's a read-only switch on this thing i can't see it and haven't found it in almost a year of using this thing. |
|
Back to top |
|
|
The Doctor Moderator
Joined: 27 Jul 2010 Posts: 2678
|
Posted: Thu Jul 26, 2012 6:08 am Post subject: |
|
|
Have you tried just creating a file system on it? _________________ First things first, but not necessarily in that order.
Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box. |
|
Back to top |
|
|
creaker l33t
Joined: 14 Jul 2012 Posts: 651
|
Posted: Thu Jul 26, 2012 9:04 am Post subject: |
|
|
It is normal for usb stick that was written by dd.
The size reduced to iso size because of usb stick seems for system like a cd or dvd.
When I need to get back my stick, I using GParted instead of fdisk. Fdisk can't recreate a partition table.
Also usb stick that was written with dd may be unbootable. It depends on iso type (hybrid or not)
You can write iso to stick with Unetbootin tool. |
|
Back to top |
|
|
frostschutz Advocate
Joined: 22 Feb 2005 Posts: 2977 Location: Germany
|
Posted: Thu Jul 26, 2012 11:15 am Post subject: |
|
|
You could be a bit more generous with dd, i.e. zero the first 8MiB instead of just a couple bytes.
dd if=/dev/zero of=/dev/usbstick bs=1M count=8
Verify that this data is actually written to the stick
dd if=/dev/zero bs=1M count=8 | md5sum
dd if=/dev/usbstick bs=1M count=8 | md5sum
should be identical (in this example 96995b58d4cbf6aaa9041b4f00c7f6ae)
disconnect the stick, reconnect the stick
If it still shows old capacity, the stick is probably defective. Either that or it's not a plain simple stupid storage device. Which brand/model? |
|
Back to top |
|
|
1clue Advocate
Joined: 05 Feb 2006 Posts: 2569
|
Posted: Thu Jul 26, 2012 12:21 pm Post subject: |
|
|
The stick is an a-data n005 32g usb3 stick.
I copied the iso over with dd to the raw device: /dev/sde rather than /dev/sde1 for example. I have been unable to make a partition after the 4g one because all the disk utilities think there's nothing out there. And somehow it magically turned into 4.00g rather than the size of the iso.
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. |
|
Back to top |
|
|
creaker l33t
Joined: 14 Jul 2012 Posts: 651
|
Posted: Thu Jul 26, 2012 1:06 pm Post subject: |
|
|
If all the linux tools (fdisk, parted and so on) failed, you can try two things. The first one is a HP Low Level Format Tool. If HP Tool doesn't helps, you can search over manufacturer's site for special recovery tool.
But these programs doesn't works under linux.
Also if you still trust dd you can just copy a hard drive to stick. At least it writes a partition table to the stick:
dd if=/dev/youharddrive of=/dev/yourusbstick
without device number and count limit.
But I'm not sure it is a good idea |
|
Back to top |
|
|
frostschutz Advocate
Joined: 22 Feb 2005 Posts: 2977 Location: Germany
|
Posted: Thu Jul 26, 2012 8:26 pm Post subject: |
|
|
1clue wrote: | The various utilities fail in different ways when I try to write a partition table. |
There's really nothing special about writing a partition table; it's just a few bytes of data in the first sector. If that fails then not many things come to mind, apart from faulty drive.
Try badblocks -b 4096 -c 1024 /dev/thingy |
|
Back to top |
|
|
chiefbag Guru
Joined: 01 Oct 2010 Posts: 542 Location: The Kingdom
|
Posted: Fri Jul 27, 2012 3:55 pm Post subject: |
|
|
Run parted where XYZ is your usb device
Run the print command to list partitions
You will see something like the following
Code: | Number Start End Size Type File system Flags
1 32.3kB 189GB 189GB primary ext3
2 189GB 320GB 131GB primary ext3 |
To REMOVE from eg partation 1
To exit parted
Now just create a new partation with cfdisk
|
|
Back to top |
|
|
chadfurman n00b
Joined: 21 Feb 2013 Posts: 1
|
Posted: Thu Feb 21, 2013 7:55 am Post subject: mklabel |
|
|
So, where gparted failed parted succeeded. Opening up parted on /dev/sdd, running mklabel msdos, then "quit", caused gparted to now be able to create partitions. |
|
Back to top |
|
|
|