LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices



Reply
 
Search this Thread
Old 11-29-2012, 06:26 PM   #1
r@fitiiixxx
LQ Newbie
 
Registered: Aug 2012
Posts: 8

Rep: Reputation: Disabled
Unhappy can't recover USB pendrive after 'dd'


Hello,

I recently used my 16Gb Verbatim STORE N GO pendrive to create an usb-install image of Arch. After looking at the wiki i tried for the first time to create an image with dd as described in there
Quote:
On GNU/Linux

Overwrite the USB drive
Warning: This will irrevocably destroy all data on /dev/sdx.
Note: Check with lsblk that the USB device is not mounted, and use /dev/sdx instead of /dev/sdx1. These are very common mistakes!
# dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx
After that i wanted to recover my pendrive but instead of following the wiki i did something stupid and formated the whole pendrive.
I restored a fully functional pendrive, but with only 400MB of capacity. So i reformated with Gparted and it gave me an error that i couldn't save in a .txt file as i was on a liveCD Ubuntu 10.04.
Next thing i tried is the wiki solution to recover the pendrive
Quote:
How to restore the USB drive
Because the ISO image is a hybrid which can either be burned to a disc or directly written to a USB drive, it doesn't include a standard partition table.
After you install Arch Linux and you're done with the USB drive, you should zero out its first 512 bytes (meaning the boot code from the MBR and the non-standard partition table) if you want to restore it to full capacity:
# dd count=1 bs=512 if=/dev/zero of=/dev/sdx
Then create a new partition table (e.g. "msdos") and filesystem (e.g. EXT4, FAT32) using gparted
The thing is that now whenever i try to format it with Gparted or with terminal comands i can't fix it, it drops me an error about
Quote:
Error in / out during read /dev/sdb
and i can't fix my pendrive.
I need help to retrieve my pendrive back.

PS: ask me any questions you might have.
 
Old 11-29-2012, 09:38 PM   #2
jefro
Guru
 
Registered: Mar 2008
Posts: 12,084

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
If you can't create a partition with fdisk then can you see any info on the drive or select it at all in fdisk?

The OEM may offer a program so see their site.


I am not sure this is for flash drives. "# dd count=1 bs=512 if=/dev/zero of=/dev/sdx" Looks more like a usb hard drive.
 
Old 11-29-2012, 09:51 PM   #3
r@fitiiixxx
LQ Newbie
 
Registered: Aug 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
usb pendrive = usb drive, it is a memory stick, not a flash card.
Verbatim STORE N GO
Also this is what fdisk -l gives me:
Code:
$ sudo fdisk -l
[sudo] password for nicolas: 

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Identificador del disco: 0x00076938

Disposit. Inicio    Comienzo      Fin      Bloques  Id  Sistema
/dev/sda1   *          63      385559      192748+  83  Linux
Partition 1 does not start on physical sector boundary.
/dev/sda2          385560    10153079     4883760   82  Linux swap / Solaris
/dev/sda3        10153080   650150549   319998735   83  Linux
/dev/sda4       650150550  1953525167   651687309   83  Linux
Partition 4 does not start on physical sector boundary.
it's on spanish but the info is well known. Haven't used fdisk ever. I allways use graphical solutions for these problems as i'm not that experienced with sh.
 
Old 11-29-2012, 10:05 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,651
Blog Entries: 2

Rep: Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095
It is missing the flash drive in that output, did you plug it in before running the fdisk command?
 
Old 11-30-2012, 12:01 PM   #5
r@fitiiixxx
LQ Newbie
 
Registered: Aug 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
Yes i did, before running fdisk. That's the problem, i don't even know what's happening to it, first i need to figure out what is going on with it, i know is not wroken because it's almost new and until this, it was working like a charm.
I will never ever use again dd command to create an OS image
hope i can bring it back...
 
Old 11-30-2012, 05:42 PM   #6
jefro
Guru
 
Registered: Mar 2008
Posts: 12,084

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
Plug in flash drive and use lsusb command maybe?
 
Old 11-30-2012, 07:25 PM   #7
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 1,607

Rep: Reputation: 673Reputation: 673Reputation: 673Reputation: 673Reputation: 673Reputation: 673
What messages appear in /var/log/messages when you plug in the drive? Frankly, it sounds like the drive just decided to die. That wouldn't be due to any fault of dd -- that just happened to be what you were doing when the drive died.
 
Old 11-30-2012, 08:52 PM   #8
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,651
Blog Entries: 2

Rep: Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095
Quote:
Originally Posted by r@fitiiixxx View Post
i know is not wroken because it's almost new and until this, it was working like a charm.
New hardware is not a guarantee that it can't break and many electronic devices tend to break suddenly without any warnings.

Quote:
I will never ever use again dd command to create an OS image
I would consider that to be pure coincidence. I do things like that very often and never had a breakage that was caused by using dd. dd is doing nothing more than writing data to the device, there is no magical "break the device"-function.

Quote:
hope i can bring it back...
If not you can actually be happy that it was a new device and you still have warranty on it. Back to the vendor and get a new one.
 
Old 12-01-2012, 12:11 AM   #9
r@fitiiixxx
LQ Newbie
 
Registered: Aug 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by TobiSGD View Post
New hardware is not a guarantee that it can't break and many electronic devices tend to break suddenly without any warnings.
...
I would consider that to be pure coincidence. I do things like that very often and never had a breakage that was caused by using dd. dd is doing nothing more than writing data to the device, there is no magical "break the device"-function.
...
If not you can actually be happy that it was a new device and you still have warranty on it. Back to the vendor and get a new one.
True, new hardware could have factory faults, not this one! i just fixed!
it wasn't a coincidence, i wroke the whole mbr table, using dd did not the trick, problem was that Arch is a dual iso with 32 and 64 bit iso inside the same boot image, so in order to recover the partition tables (because of some weird stuff arch does to pendrives) i had to follow exact same steps in that wiki, which i did not, because i thought that gparted was more suitable for me. WRONG!
I couldn't be happy if the device was new, as in my country is really hard to make validation of my warranty, since all the products are imported and most vendors will try every excuse they get in order to invalidate warranties.

@jefro:
lsusb showed me a Verbatim hard disk connected to BUS 001 (usb 2.0) so it's ok.


@rknichols:
I can't check /var/log/messages because...
Code:
$ ls /var/log/
Xorg.0.log      Xorg.2.log      btmp     lastlog  pacman.log
Xorg.0.log.old  Xorg.2.log.old  faillog  libvirt  pm-powersave.log
Xorg.1.log      Xorg.3.log      gdm      ntp.log  wtmp
Xorg.1.log.old  Xorg.4.log      journal  old
._.

now i'm going to explain, how i fixed it.

[SOLUTION]
Quote:
Originally Posted by Hinnerk van Bruinehsen
use on terminal:
Code:
fdisk /dev/sdx
(x is the letter for the device).

Now at the interactive promt, you can check multiple options pressing 'm'.
Delete partition (press d), create a new partition (press n) - use the whole drive.
Write the changes (press w) and quit (press d).
Afterwards you should be able to use the whole drive again.
 
Old 12-01-2012, 03:29 PM   #10
jefro
Guru
 
Registered: Mar 2008
Posts: 12,084

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
Glad you fixed it and posted the results.


I sometimes post more like a man page. They are only good if you know the answer.
"can you see any info on the drive or select it at all in fdisk?"
 
  


Reply

Tags
dd, mbr, msdos, usb


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
USB pendrive opens only after booted w USB inserted mwaxenberg Linux - Hardware 2 04-17-2011 09:10 AM
[SOLVED] Recover USB pendrive several partitions (w/ fdisk results) gorkon Linux - Software 1 06-02-2010 09:20 PM
Live USB on a external HD instead of USB pendrive / NTLDR is missing Marrrriej Ubuntu 3 04-16-2010 03:24 AM
Problem with usb pendrive and usb modem ZTE ZXDSL 852 AM33N Linux - Hardware 3 12-10-2008 04:25 AM
Conflicting USB mouse & usb pendrive on Slackware 11.0 aruntom55 Slackware 3 08-26-2007 02:34 AM


All times are GMT -5. The time now is 01:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration