Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.hardware > #898 > unrolled thread
| Started by | Haines Brown <haines@HistoricalMaterialism.info> |
|---|---|
| First post | 2011-12-05 11:37 -0500 |
| Last post | 2011-12-07 17:25 +0000 |
| Articles | 10 — 5 participants |
Back to article view | Back to comp.os.linux.hardware
Recover zonked USB sticks Haines Brown <haines@HistoricalMaterialism.info> - 2011-12-05 11:37 -0500
Re: Recover zonked USB sticks Lew Pitcher <lpitcher@teksavvy.com> - 2011-12-05 12:24 -0500
Re: Recover zonked USB sticks Haines Brown <haines@HistoricalMaterialism.info> - 2011-12-06 13:03 -0500
Re: Recover zonked USB sticks "David W. Hodgins" <dwhodgins@nomail.afraid.org> - 2011-12-06 16:01 -0500
Re: Recover zonked USB sticks Henrik Carlqvist <Henrik.Carlqvist@deadspam.com> - 2011-12-06 23:13 +0100
Re: Recover zonked USB sticks Haines Brown <haines@HistoricalMaterialism.info> - 2011-12-07 10:42 -0500
Re: Recover zonked USB sticks Richard Kettlewell <rjk@greenend.org.uk> - 2011-12-06 19:29 +0000
Re: Recover zonked USB sticks Haines Brown <haines@HistoricalMaterialism.info> - 2011-12-07 10:39 -0500
Re: Recover zonked USB sticks Haines Brown <haines@HistoricalMaterialism.info> - 2011-12-07 12:13 -0500
Re: Recover zonked USB sticks Richard Kettlewell <rjk@greenend.org.uk> - 2011-12-07 17:25 +0000
| From | Haines Brown <haines@HistoricalMaterialism.info> |
|---|---|
| Date | 2011-12-05 11:37 -0500 |
| Subject | Recover zonked USB sticks |
| Message-ID | <878vmrgejw.fsf@engels.HistoricalMaterialism.info> |
I am in the habit of putting an ISO on a USB stick to netinst install
the Debian Squeeze system. However, when I try to do it with a custom
ISO and installer combo, the # zcat command destroys the stick. After
doing it, I now plug the stick in (with automount) I get:
$ dmesg
...
[250357.735511] sd 28:0:0:0: [sdb] Assuming drive cache: write through
[250357.735514] sdb:
$ df -k
...
/dev/sdb 489208 25408 463800 6% /media/usb0
$ mount
...
/dev/sdb on /media/usb0 type vfat
(rw,noexec,nodev,sync,noatime,nodiratime)
With the custom boot image I do:
# zcat boot-i386-0808.img.gz > /dev/sdb
$ ls /media/usb0
adgtk.cfg f2.txt f8.txt initrd.gz rqtxt.cfg vesamenu.c32
adtxt.cfg f3.txt f9.txt ldlinux.sys setup.exe win32-loader.ini
disk.lbl f4.txt g2ldr linux splash.png
exithelp.cfg f5.txt g2ldr.mbr menu.cfg stdmenu.cfg
f10.txt f6.txt gtk.cfg prompt.cfg syslinux.cfg
f1.txt f7.txt initrdg.gz rqgtk.cfg txt.cfg
However these files are probably remnants of a prior run of zcat on
a stock ISO, but they are not in /dev/sdb1 for some reason.
# cfdisk /dev/sdb
FATAL ERROR: Bad primary partition 0: Partition begins after
end-of-disk
I've done this to two sticks. Although they are old, small and cheap, it
would be nice to recover them. Any suggestions?
Haines Brown
[toc] | [next] | [standalone]
| From | Lew Pitcher <lpitcher@teksavvy.com> |
|---|---|
| Date | 2011-12-05 12:24 -0500 |
| Message-ID | <d77Dq.8094$X02.5688@newsfe03.iad> |
| In reply to | #898 |
On December 5, 2011 11:37, in comp.os.linux.hardware, haines@HistoricalMaterialism.info wrote: > I am in the habit of putting an ISO on a USB stick to netinst install > the Debian Squeeze system. However, when I try to do it with a custom > ISO and installer combo, the # zcat command destroys the stick. After > doing it, I now plug the stick in (with automount) I get: > > $ dmesg > ... > [250357.735511] sd 28:0:0:0: [sdb] Assuming drive cache: write through > [250357.735514] sdb: > > $ df -k > ... > /dev/sdb 489208 25408 463800 6% /media/usb0 > > $ mount > ... > /dev/sdb on /media/usb0 type vfat > (rw,noexec,nodev,sync,noatime,nodiratime) > > With the custom boot image I do: > > # zcat boot-i386-0808.img.gz > /dev/sdb > > $ ls /media/usb0 > adgtk.cfg f2.txt f8.txt initrd.gz rqtxt.cfg vesamenu.c32 > adtxt.cfg f3.txt f9.txt ldlinux.sys setup.exe win32-loader.ini > disk.lbl f4.txt g2ldr linux splash.png > exithelp.cfg f5.txt g2ldr.mbr menu.cfg stdmenu.cfg > f10.txt f6.txt gtk.cfg prompt.cfg syslinux.cfg > f1.txt f7.txt initrdg.gz rqgtk.cfg txt.cfg > > However these files are probably remnants of a prior run of zcat on > a stock ISO, but they are not in /dev/sdb1 for some reason. Given that you zcat the image to /dev/sdb, you no longer /have/ a /dev/sdb1. > # cfdisk /dev/sdb > FATAL ERROR: Bad primary partition 0: Partition begins after > end-of-disk Yup. No valid partitions on /this/ device. Remember, when you write to /dev/sdb, you are writing to the complete device, without regards for it's partition table. In fact, since the partition table sits within the first 512 bytes of /dev/sdb, your zcat overwrites that table with data, and you no longer /have/ a partition table (as such). > I've done this to two sticks. Although they are old, small and cheap, it > would be nice to recover them. Any suggestions? How do you mean "recover them"? Do you mean a) regain access to the data that you placed on /dev/sdb ? or b) regain access to the data that originally sat on /dev/sdb1? or c) clean them up so that no data remains, and that they can be reused as standard devices again? or d) something else? If you mean a), then simply mount /dev/sdb to a mountpoint. If you mean b), then unless you took backups before you started, you are out of luck. You clobbered the partition table, and any data on that partition with the zcat command. If you mean c), then you can simply fdisk /dev/sdb, and create a new partition table. Then mkfs /dev/sdb1 with the proper filesystem. If you mean d), then please elaborate. HTH -- Lew Pitcher Master Codewright & JOAT-in-training | Registered Linux User #112576 Me: http://pitcher.digitalfreehold.ca/ | Just Linux: http://justlinux.ca/ ---------- Slackware - Because I know what I'm doing. ------
[toc] | [prev] | [next] | [standalone]
| From | Haines Brown <haines@HistoricalMaterialism.info> |
|---|---|
| Date | 2011-12-06 13:03 -0500 |
| Message-ID | <874nxdh91q.fsf@engels.HistoricalMaterialism.info> |
| In reply to | #899 |
Lew Pitcher <lpitcher@teksavvy.com> writes: > How do you mean "recover them"? Do you mean > c) clean them up so that no data remains, and that they can be reused > as standard devices again? or > If you mean c), then you can simply fdisk /dev/sdb, and create a new > partition table. Then mkfs /dev/sdb1 with the proper filesystem. Lew, sorry I wasn't clearer. It is your option (c) that I want: make the stick usable again. The problem is that the FATAL ERROR message is when I try to run cfdisk on the device. Cffisk can't see it. Perhaps I should add that while a # df -k command tells me the device is /dev/sdb, the kernel can't see it ($ dmsg does not report it). The reason for my wish to recovery is that I want to try and zcat a custom boot.img to /dev/sdb again and have my supply of UBS sticks to dwindle. Haines
[toc] | [prev] | [next] | [standalone]
| From | "David W. Hodgins" <dwhodgins@nomail.afraid.org> |
|---|---|
| Date | 2011-12-06 16:01 -0500 |
| Message-ID | <op.v525z9ssa3w0dxdave@hodgins.homeip.net> |
| In reply to | #900 |
On Tue, 06 Dec 2011 13:03:29 -0500, Haines Brown <haines@historicalmaterialism.info> wrote: > I try to run cfdisk on the device. Cffisk can't see it. cfdisk -z /dev/??? Regards, Dave Hodgins -- Change nomail.afraid.org to ody.ca to reply by email. (nomail.afraid.org has been set up specifically for use in usenet. Feel free to use it yourself.)
[toc] | [prev] | [next] | [standalone]
| From | Henrik Carlqvist <Henrik.Carlqvist@deadspam.com> |
|---|---|
| Date | 2011-12-06 23:13 +0100 |
| Message-ID | <pan.2011.12.06.22.13.28.238309@deadspam.com> |
| In reply to | #900 |
Haines Brown <haines@HistoricalMaterialism.info> wrote: > Perhaps I should add that while a # df -k command tells me the device is > /dev/sdb, the kernel can't see it ($ dmsg does not report it). If "df -k" tells you that the device is /dev/sdb it means that you have mounted the device, you would not have been able to mount it without the kernel to see it. When the device is mounted you should not try to alter the partition table or the file system. > The reason for my wish to recovery is that I want to try and zcat a > custom boot.img to /dev/sdb again and have my supply of UBS sticks to > dwindle. If you once again want to put something to sdb like that there is no reason to put a partition table on /dev/sdb first. However, you whould first unmount the device before doing any such operation. regards Henrik -- The address in the header is only to prevent spam. My real address is: hc123(at)poolhem.se Examples of addresses which go to spammers: root@localhost postmaster@localhost
[toc] | [prev] | [next] | [standalone]
| From | Haines Brown <haines@HistoricalMaterialism.info> |
|---|---|
| Date | 2011-12-07 10:42 -0500 |
| Message-ID | <87ty5c2xtj.fsf@engels.HistoricalMaterialism.info> |
| In reply to | #906 |
Henrik Carlqvist <Henrik.Carlqvist@deadspam.com> writes: >> Perhaps I should add that while a # df -k command tells me the device is >> /dev/sdb, the kernel can't see it ($ dmsg does not report it). > > If "df -k" tells you that the device is /dev/sdb it means that you have > mounted the device, you would not have been able to mount it without the > kernel to see it. > > When the device is mounted you should not try to alter the partition table > or the file system. Sorry, should have made clearer that I unmounted the stick before issuing the cfdisk command. It turns our that zeroing the first partition as suggested did the trick. Haines
[toc] | [prev] | [next] | [standalone]
| From | Richard Kettlewell <rjk@greenend.org.uk> |
|---|---|
| Date | 2011-12-06 19:29 +0000 |
| Message-ID | <87ehwhqz11.fsf@araminta.anjou.terraraq.org.uk> |
| In reply to | #898 |
Haines Brown <haines@HistoricalMaterialism.info> writes: > However these files are probably remnants of a prior run of zcat on > a stock ISO, but they are not in /dev/sdb1 for some reason. > > # cfdisk /dev/sdb > FATAL ERROR: Bad primary partition 0: Partition begins after > end-of-disk > > I've done this to two sticks. Although they are old, small and cheap, it > would be nice to recover them. Any suggestions? Zero out the first sector, e.g.: dd if=/dev/zero of=/dev/sdb count=1 bs=512 Make sure you get the device name right. cfdisk will probably tolerate it thereafter. -- http://www.greenend.org.uk/rjk/
[toc] | [prev] | [next] | [standalone]
| From | Haines Brown <haines@HistoricalMaterialism.info> |
|---|---|
| Date | 2011-12-07 10:39 -0500 |
| Message-ID | <87y5uo2xyh.fsf@engels.HistoricalMaterialism.info> |
| In reply to | #902 |
Richard Kettlewell <rjk@greenend.org.uk> writes: > Haines Brown <haines@HistoricalMaterialism.info> writes: >> FATAL ERROR: Bad primary partition 0: Partition begins after >> end-of-disk > Zero out the first sector, e.g.: > > dd if=/dev/zero of=/dev/sdb count=1 bs=512 Yes, thanks. That seems to be what was needed. Haines
[toc] | [prev] | [next] | [standalone]
| From | Haines Brown <haines@HistoricalMaterialism.info> |
|---|---|
| Date | 2011-12-07 12:13 -0500 |
| Message-ID | <87pqg02tkp.fsf@engels.HistoricalMaterialism.info> |
| In reply to | #902 |
Richard Kettlewell <rjk@greenend.org.uk> writes:
> Zero out the first sector, e.g.:
>
> dd if=/dev/zero of=/dev/sdb count=1 bs=512
Well, I spoke too soon. Still can't partition the USB stick.
When the stick processed as above is inserted, dmsg tells me that the
stick is "sdc: sdc1" (since initially writing I added another HD and
thus the stick no longer sdb). But only sometimes (see below).
The automount did not mount it, and the kernel fails to see it (df -k
returns nothing for it).
When I try to mount it:
$ sudo mount -t vfat /dev/sdc /media/usb0
mount: wrong fs type, bad option, bad superblock on /dev/sdc,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
When I run cfdsk on the unmounted stick I now get:
$ sudo cfdisk /dev/sdc
sdc1 Boot Primary FAT16 <32M> ---- 1008.43 MG
Isn't this what I should expect?
However, it may not be the stick's fault, for I try to run cfdsk on a
fresh mint unmounted stick, and get this error:
# cfdisk /dev/sdd (dmsg tells me the device is sd0: sdd1)
FATAL ERROR: Bad primary partition 0: Partition begins after
end-of-disk
So obviously I'm doing something stupid along the line.
I should mention that I have erratic USB optical mounse movements
(pointer hangs a bit, but this behavior comes and goes), and
often when I expect dmesg to tell me about a key I just inserted,
it instead tells me again about the mouse (I do pause):
usb 4-1: Product: USB-PS/2 Optical Mouse
usb 4-1: Manufacturer: B16_b_02
usb 4-1: configuration #1 chosen from 1 choice
input: B16_b_02 USB-PS/2 Optical Mouse as
/devices/pci0000:00/0000:00:1a.1/usb4/4-1/4-1:1.0/input/input90
generic-usb 0003:046D:C024.0056: input,hidraw0: USB HID v1.10 Mouse
[B16_b_02 USB-PS/2 Optical Mouse] on usb-0000:00:1a.1-1/input0
Sounds like some kind of driver confusion, and the mouse driver is
being loaded for the USB stick.
Haines
[toc] | [prev] | [next] | [standalone]
| From | Richard Kettlewell <rjk@greenend.org.uk> |
|---|---|
| Date | 2011-12-07 17:25 +0000 |
| Message-ID | <87iplsfg4u.fsf@araminta.anjou.terraraq.org.uk> |
| In reply to | #909 |
Haines Brown <haines@HistoricalMaterialism.info> writes: > Richard Kettlewell <rjk@greenend.org.uk> writes: >> Zero out the first sector, e.g.: >> >> dd if=/dev/zero of=/dev/sdb count=1 bs=512 > > Well, I spoke too soon. Still can't partition the USB stick. > > When the stick processed as above is inserted, dmsg tells me that the > stick is "sdc: sdc1" (since initially writing I added another HD and > thus the stick no longer sdb). But only sometimes (see below). > > The automount did not mount it, and the kernel fails to see it (df -k > returns nothing for it). > > When I try to mount it: > > $ sudo mount -t vfat /dev/sdc /media/usb0 > mount: wrong fs type, bad option, bad superblock on /dev/sdc, > missing codepage or helper program, or other error > In some cases useful info is found in syslog - try > dmesg | tail or so mount's error reporting is atrocious l-( > When I run cfdsk on the unmounted stick I now get: > > $ sudo cfdisk /dev/sdc > sdc1 Boot Primary FAT16 <32M> ---- 1008.43 MG > > Isn't this what I should expect? It sounds like you've created a partition but not initialized any kind of filesystem in it. -- http://www.greenend.org.uk/rjk/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.os.linux.hardware
csiph-web