LinuxQuestions.org
Help answer threads with 0 replies.
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 09-02-2021, 02:15 PM   #1
nachtan
LQ Newbie
 
Registered: Sep 2010
Posts: 7

Rep: Reputation: 0
Question Howto recover non-mounting USB memory drive?


How do I recover a non-mounting ext2 USB drive? I´m using Ubuntu 5.11.0-27-generic

The ext2 file system was working fine before the device crash. It was damaged when the machine it was on lost power while it was being written to (rsync).

Ideally, I like to recover the data on it, but if that´s not possible, I´m happy to re-partition it, even to its original filesystem if need be.

Another USB memory does work in this port, so the USB port is OK.

´ls /media/<my_name>´ shows no device, though it´s plugged in.
Nor does the Ubuntu ¨Files¨ GUI.
I do get an audible click when I insert or remove the device.

´lsusb´ shows it as:
Bus 002 Device 021: ID 0951:1666 Kingston Technology DataTraveler 100 G3/G4/SE9 G2

´lsblk´ shows it as:
sdb 8:16 1 57.6G 0 disk (but no sdb1)

´sudo parted -l´ gives this:
Error: /dev/sdb: unrecognised disk label
Model: Kingston DataTraveler 3.0 (scsi)
Disk /dev/sdb: 61.9GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:

´sudo gparted &´ shows:
GParted 1.0.0
configuration --enable-libparted-dmraid --enable-online-resize
libparted 3.3
Input/output error during read on /dev/sdb

´sudo e2fsck -b 98304 /dev/sdb´ shows:
e2fsck 1.45.5 (07-Jan-2020)
e2fsck: Input/output error while trying to open /dev/sdb

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>

Using the advice found in the e2fsck man page, I ran
´sudo mke2fs -n /dev/sdb´. It showed:
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 15104000 4k blocks and 3776512 inodes
Filesystem UUID: 9a6d67b6-240e-4273-83eb-30a44d18de9a
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424

´cat /proc/partitions´ gives:
major minor #blocks name:
... ... ... ...
8 16 60416000 sdb

Here are a few of the last lines from dmesg.
[14230.556171] blk_update_request: I/O error, dev sdb, sector 0 op 0x0READ) flags 0x0 phys_seg 1 prio class 0
[14230.556173] Buffer I/O error on dev sdb, logical block 0, async page read
[14230.556412] sd 1:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[14230.556414] sd 1:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current]
[14230.556416] sd 1:0:0:0: [sdb] tag#0 Add. Sense: Medium not present
[14230.556417] sd 1:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 18 00 00 08 00
[14230.556418] blk_update_request: I/O error, dev sdb, sector 24 op 0x0READ) flags 0x0 phys_seg 1 prio class 0
[14230.556420] Buffer I/O error on dev sdb, logical block 3, async page read
[14230.556975] sdb: unable to read partition table

Ideas?
 
Old 09-02-2021, 06:47 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,340

Rep: Reputation: 4176Reputation: 4176Reputation: 4176Reputation: 4176Reputation: 4176Reputation: 4176Reputation: 4176Reputation: 4176Reputation: 4176Reputation: 4176Reputation: 4176
Do you know how the stick was partitioned ?. If just one, or your data was in the first partition, the first step would be to create a partition table, and one partition to cover the entire device. If the filesystem is undamaged, you should be able to access your data simply by mounting it. Creating a partition table doesn't impact the user data area - if done from the command line; parted or fdisk is fine.
If that doesn't work, have a look at photorec for individual file scanning. I don't recall using it on a stick, but should work.
 
1 members found this post helpful.
Old 09-02-2021, 11:17 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,291

Rep: Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672
See what testdisk shows.
 
1 members found this post helpful.
Old 09-03-2021, 04:54 AM   #4
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: One main distro, & some smaller ones casually.
Posts: 5,782

Rep: Reputation: Disabled
If all else fails
Code:
dd if=/dev/zero of=/dev/<whatever> bs=512 count=1
That will clear the boot block, then, using fdisk (or similar), give it a new MBR, partition it, & put a new filesystem on it.
 
Old 09-03-2021, 07:54 AM   #5
zeebra
Senior Member
 
Registered: Dec 2011
Distribution: Slackware
Posts: 1,834
Blog Entries: 17

Rep: Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644
Quote:
Originally Posted by nachtan View Post
Ideas?
You can use that superblock info to use another superblock of the partition using this:
Code:
e2fsck -b 123456 /dev/sdx
Quote:
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
You might have to try several of them.

It might be better to use a journalling filesystem if you can.

Last edited by zeebra; 09-03-2021 at 08:02 AM.
 
Old 09-04-2021, 09:35 AM   #6
nachtan
LQ Newbie
 
Registered: Sep 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
Do you know how the stick was partitioned ?. If just one, or your data was in the first partition, the first step would be to create a partition table, and one partition to cover the entire device.

... /snip/

If that doesn't work, have a look at photorec for individual file scanning. I don't recall using it on a stick, but should work.
The stick was partitioned using ´mkfs.ext2 /dev/sdb1´. There was a single partition. The data used up 54.8GB of the 64GB device.

´sudo parted /dev/sdb mkpart fs-type=¨ext2¨
returns: Error: /dev/sdb: unrecognised disk label

´sudo parted /dev/sdb1 mkpart fs-type=¨ext2¨
returns (unsurprisingly): Error: Could not stat device /dev/sdb1 - No such file or directory.

Photorec shows the partition as ¨Unknown¨ with a Start and End of 0 and 58999, respectively.
 
Old 09-04-2021, 09:46 AM   #7
nachtan
LQ Newbie
 
Registered: Sep 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jefro View Post
See what testdisk shows.
W/respect to /dev/sdb, testdisk reported:
ext2fs lib: 1.45.5, ntfs lib: libntfs-3g, reiserfs lib: none, ewf lib: none, curses lib: ncurses 6.1

Disk /dev/sdb - 61 GB / 57 GiB - CHS 59000 64 32, sector size=512 - Kingston DataTraveler 3.0, FW:1100

...

Partition table type defaults to Intel
Disk /dev/sdb - 61 GB / 57 GiB - Kingston DataTraveler 3.0
Partition table type: Intel

TestDisk exited normally.
 
Old 09-04-2021, 09:52 AM   #8
nachtan
LQ Newbie
 
Registered: Sep 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jefro View Post
See what testdisk shows.
Quote:
Originally Posted by zeebra View Post
You can use that superblock info to use another superblock of the partition using this:
Code:
e2fsck -b 123456 /dev/sdx


You might have to try several of them.

Thanks Jefro. I tried all of them. No joy with any.
 
Old 09-04-2021, 02:38 PM   #9
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
Did you try "fdisk /dev/sdx" and have it open up for creating a partition?

If it did not open up then there is a real hardware issue.
If it opened up then using the fdisk menu options, "p" will display the current partitioning, an "o" will create a new dos partition table, "n" will create a new partition, "w" will write the changes.

Once that is done then using mke2fs or one of its variants (mkfs.xxxx) will allow formatting the partition to the file system of choice and you should be back in business with partition /dev/sdX1 available.

Last edited by computersavvy; 09-04-2021 at 02:54 PM.
 
Old 09-04-2021, 04:28 PM   #10
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,291

Rep: Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672Reputation: 3672
testdisk usually has a few steps to access all the files that it can recover. I'd try to recover the files first then play with any sort of repair second.
 
Old 09-04-2021, 06:27 PM   #11
nachtan
LQ Newbie
 
Registered: Sep 2010
Posts: 7

Original Poster
Rep: Reputation: 0
@computersavvy
Quote:
Originally Posted by computersavvy View Post
Did you try "fdisk /dev/sdx" and have it open up for creating a partition?
´sudo fdisk /dev/sdb´ returns:

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

fdisk: cannot open /dev/sdb: Input/output error


@jefro
testdisk -> analyze returns:
Disk /dev/sdb - 61 GB / 57 GiB - CHS 59000 64 32
Current partition structure:
Partition Start End Size in sectors

Partition: Read error

When running through the cylinders, shows a read error for all of them:

Maybe a hardware issue then? If yes, Iĺl try to ´dd´ it and at least try to save the device for reuse.
 
  


Reply


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 hard disk formated by accident - howto recover the files guldan27 Linux - Desktop 3 01-22-2007 07:35 AM
Monitoring traffic tool/web based(non-cgi?)/non-SNMP/low CPU usage/non-real time pe2338 Linux - Networking 3 05-04-2006 02:00 PM
LXer: HOWTO Recover Files from a Non-Bootable Windows PC using Ubuntu Live LXer Syndicated Linux News 0 02-13-2006 12:01 PM
mounting hardrive via non-root and using it via non-root Paridoth Mandriva 1 11-03-2004 06:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 09:58 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
Open Source Consulting | Domain Registration