LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-17-2015, 03:39 PM   #1
remn
Member
 
Registered: Jun 2015
Posts: 37

Rep: Reputation: Disabled
unable to mount a usb flash drive and an SD card after changing mount directory name


I'm not sure exactly what I did, but after messing with some directory names I'm unable to mount both a usb drive and an SD card. When I try to mount them I get this error:

* wrong fs type, bad option, bad superblock on /dev/sdb1,
missing codepage or helper program, or other error
*
I tried mounting them in Windows and it said the drive needs to be formatted. I didn't mess with the partition table or try to format these devices. I think what I did was change the name of the directory it was mounted to while it was mounted, then I started having this problem. One more thing: when I run *lsblk -f* I notice that these devices no longer have UUIDs. All the other devices have UUIDs listed but the field is blank on these devices. I have some data on these drives I don't want to loose so I'd appreciate any help getting these devices to mount without having to re-format.
 
Old 10-17-2015, 04:39 PM   #2
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,842

Rep: Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148
You haven't told us which file system was in use, but since you mentioned windows, are we to assume vfat or ntfs?

How is it reported by the following?
Code:
fdisk -l
Report back with the output so that others can offer advice.

Before attempting any further possible corruption during any data recovery exercise, it is a good idea to back the devicde up completely using 'dd' to low-level (bit-by-bit) copy eg
Code:
dd if=/dev/sdb1 of=backup.img
This will work regardless of file system.

Last edited by ferrari; 10-17-2015 at 04:41 PM.
 
Old 10-17-2015, 04:49 PM   #3
dutchy013
Member
 
Registered: Sep 2015
Location: Tilburg, NL
Distribution: Slackware current
Posts: 34

Rep: Reputation: Disabled
Quote:
Originally Posted by remn View Post
I'm not sure exactly what I did, but after messing with some directory names I'm unable to mount both a usb drive and an SD card. When I try to mount them I get this error:
looks like you changed a directory name in /mnt and now fstab doesn't know where to mount a mass storage device. my fstab says:

Code:
jan@oxygen ~/Data/Dox/2015$ cat /etc/fstab 
/dev/sda1        swap             swap        defaults         0   0
/dev/sda5        /                ext4        defaults         1   1
/dev/sda6        /home            ext4        defaults         1   2
/dev/sda7        /home/data       ext4        defaults         1   2
/dev/cdrom       /mnt/cdrom       auto        noauto,owner,ro,comment=x-gvfs-show 0   0
/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       defaults         0   0
if I were to change the name of /mnt/cdrom into /mnt/dvd, fstab would have no mountpoint anymore for /dev/cdrom so either change back the directory names to the default ones or change fstab and that should do the trick.

if you insert a usb stick that is formatted in ext4 in a windows machine, windows will reformat the disk to help you.
 
Old 10-17-2015, 04:52 PM   #4
remn
Member
 
Registered: Jun 2015
Posts: 37

Original Poster
Rep: Reputation: Disabled
Thanks for the reply. Yes I believe it was formatted ntfs. Here's the output from fdisk -l:

Device Boot Start End Sectors Size Id Type
/dev/sdb1 63 15240575 15240513 7.3G 83 Linux


I'll be sure to back up the drive before trying anything.
 
Old 10-17-2015, 05:22 PM   #5
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,573

Rep: Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499Reputation: 2499
Quote:
I'm not sure exactly what I did, but after messing with some directory names I'm unable to mount both a usb drive and an SD card.
It would be useful to know exactly how you tried to mount the partition. Were you using a terminal? If so, what exact command did you use?

Quote:
I tried mounting them in Windows and it said the drive needs to be formatted
Windows doesn't recognize Linux filesystems so that's it's response to something unknown. It will suggest re-formatting to a windows filesystem.

Did you or do you actually have an entry for sdb1 in /etc/fstab? If you do or did, you would not need to mount it as it should mount on boot.

Your fdisk output for that partition shows it as a Linux filesystem.
 
Old 10-17-2015, 05:36 PM   #6
remn
Member
 
Registered: Jun 2015
Posts: 37

Original Poster
Rep: Reputation: Disabled
I looked at my fstab file and it doesn't have an entry for sdb1. But when I plug in another usb drive it shows as sdb1 and it mounts without issues. Do I need to add a line to fstab?

I may have mispoke when I said it was ntfs. Maybe I re-formatted it to ext4 awhile ago and forgot.

I was trying to mount it from terminal, using the mount command.
 
Old 10-17-2015, 06:01 PM   #7
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,842

Rep: Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148
No, you don't need an en entry in /etc/fstab. Typically, removable media with a valid system are handled by udev and UDisks2. The fact that a bad super block is reported suggests an ext3/ext4 file system. You could execute following (eg assuming ext3) to get a bit more info about

Code:
sudo fsck.ext3 -v /dev/sdb1
or maybe
Code:
sudo fsck-v /dev/sb1
I assuming this will confirm a bad/corrupted superblock. There are additional superblock copies kept thankfully. Locate them with
Code:
sudo mke2fs -n /dev/sb1
and report back with the output.

Hopefully, it should be possible to use a superblock copy to repair using something like

Code:
sudo e2fsck -b super_block_copy_location /dev/sdb1
*replace super_block_copy_location with actual block number
 
Old 10-17-2015, 06:05 PM   #8
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,842

Rep: Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148
If you're certain it was ext4, then check status with
Code:
sudo fsck.ext4 -v /dev/sdb1
 
Old 10-17-2015, 06:10 PM   #9
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,842

Rep: Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148
If you can't recover the file system, all hope is not lost. You can work with the device or backup you created to try to recover the files using a utility like foremost.

Read this excellent data recovery guide
https://help.ubuntu.com/community/DataRecovery

This might help too
http://www.levlafayette.com/node/20
 
Old 10-17-2015, 06:25 PM   #10
remn
Member
 
Registered: Jun 2015
Posts: 37

Original Poster
Rep: Reputation: Disabled
ext2fs_open2: Bad magic number in super-block
fsck.ext3: Superblock invalid, trying backup blocks...
fsck.ext3: Bad magic number in super-block while trying to open /dev/sdb1

Ran *sudo fsck.ext3 -v /dev/sdb1*, here's the output:

***************************************************************************************

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>

********************************************************************************

When I ran *sudo mke2fs -n /dev/sb1* to find superblock copies, I got this:

"The file /dev/sb1 does not exist and no size was specified."
 
Old 10-17-2015, 06:35 PM   #11
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,842

Rep: Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148
Sorry, that was a typo. It should have been
Code:
sudo mke2fs -n /dev/sdb1
 
Old 10-17-2015, 06:56 PM   #12
remn
Member
 
Registered: Jun 2015
Posts: 37

Original Poster
Rep: Reputation: Disabled
Haha, I didn't catch the typo, just copied and pasted. It worked this time, here's the output:

Creating filesystem with 1905064 4k blocks and 476720 inodes
Filesystem UUID: 5a3dd860-724f-45a2-8ebc-351b25f9321c
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
 
Old 10-17-2015, 07:08 PM   #13
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,842

Rep: Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148
Okay, now try the following to use the backup superblock
Code:
sudo e2fsck -b 98304 /dev/sdb1
or perhaps you could try mounting using the backup superblock with
Code:
sudo mkdir -p /mnt/data
Code:
sudo mount -o sb=98304 /dev/sdb1 /mnt/data
 
Old 10-17-2015, 07:25 PM   #14
remn
Member
 
Registered: Jun 2015
Posts: 37

Original Poster
Rep: Reputation: Disabled
Neither of those worked. For the first command I get:

*****************************************************************************

e2fsck: Bad magic number in super-block while trying to open /dev/sdb1

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>


******************************************************************************

For the second one I get:

********************************************************************************

mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
missing codepage or helper program, or other error

In some cases useful info is found in syslog - try
dmesg | tail or so.


********************************************************************************

I tried each command with a a few different blocks from those listed in the output from *sudo mke2fs -n /dev/sdb1*, none of them worked. I'm looking over the data recover tutorial you linked to. I'll try some of those methods.
 
Old 10-17-2015, 07:28 PM   #15
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,842

Rep: Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148
Review the data recovery suggestions in post #9
 
  


Reply



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
[SOLVED] Usb flash drive error: Unable to read mount point hewjr1000 Linux - Newbie 4 11-18-2010 05:59 PM
Unable to mount USB flash drive in SuSE 10.1 David Gaguine SUSE / openSUSE 5 11-20-2007 11:54 AM
when i mount my USB Flash Drive A Messenge has come that mount: can't find /dev/sda/h feda82 Red Hat 2 12-24-2005 07:16 AM
when i mount my USB Flash Drive A Messenge has come that mount: can't find /dev/sda/h feda82 Red Hat 1 12-24-2005 04:25 AM
when i mount my USB Flash Drive A Messenge has come that mount: can't find /dev/sda/h feda82 Red Hat 2 12-24-2005 02:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:34 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