56

I added a new hard drive (/dev/sdb) to Ubuntu Server 16, ran parted /dev/sdb mklabel gpt and sudo parted /dev/sdb mkpart primary ext4 0G 1074GB. All went fine. Then I tried to mount the drive

mkdir /mnt/storage2
mount /dev/sdb1 /mnt/storage2

It resulted in

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 mount -t ext4 /dev/sdb1 /mnt/storage2 with identical outcome. I've done this stuff many times before and have never ran into anything like this. I've already read this mount: wrong fs type, bad option, bad superblock on /dev/sdb on CentOS 6.0 to no avail.

fdisk output regarding the drive

Disk /dev/sdb: 1000 GiB, 1073741824000 bytes, 2097152000 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
Disklabel type: gpt
Disk identifier: 0E136427-03AF-48E2-B56B-A467E991629F

Device     Start        End    Sectors  Size Type
/dev/sdb1   2048 2097149951 2097147904 1000G Linux filesystem 
  • 1
    Hint for anyone else coming across this: run dmesg, it may give you more information on what your problem actually is. – Winston Ewert Oct 1 '19 at 15:53
84

You still need to create a (new) file system (Double-check that you really want to overwrite current content of the specified partition!)

mkfs.ext4 /dev/sdb1

Parted User's manual https://www.gnu.org/software/parted/manual/html_node/mkpart.html:

2.4.5 mkpart

Command: mkpart [part-type fs-type name] start end

Creates a new partition, without creating a new file system on that partition.

| improve this answer | |
  • 52
    This will wipe out your current drive !! – SudarP Jan 26 '19 at 2:03
  • In doing this, I get a permission denied error. Have you encountered this before? – NoVa Apr 22 '19 at 5:36
  • 1
    @Kosta you must run the command as a superuser (i.e. sudo) – Eli Korvigo May 13 '19 at 12:54
  • 3
    @SudarP it wipes out the /dev/sdb1 device. Not your current. Just execute if you are sure of what you are doing (linux.die.net/man/8/mkfs.ext4) – tremendows Aug 2 '19 at 7:56
  • You could also be trying to mount say sda instead of sda2 (or whichever number your ext4 partition is on). As was my case today... I'm half asleep – Mint Oct 19 '19 at 10:05
13

I had this problem with /dev/sda on Ubuntu 16.04 I solved it by booting into a live usb and doing the following:

To see your disks use lsblk

If you can see your drive thats good, run fdisk -l to see if the system can use it.

Run this command to attempt to repair bad superblocks on the drive.

fsck /dev/sda1 (replace /dev/sda1 with the drive you want to fix).

When it asks to repair blocks select yes by pressing 'y'

Allow fsck to repair all bad blocks.

Then I was able to mount the device using

sudo mount /dev/sda /media/ubuntu

This solved it for me.

| improve this answer | |
  • Trying this, I get a permission denied error for both fdisk -l and the fsck command. Is there a workaround? – NoVa Apr 22 '19 at 5:37
  • @NoVa This may be out of date, but in generaly permission denied means you must precede the command with sudo such that you have root permisions. – CtrlAltF2 May 17 at 19:06
3

In my case, the solution was install nfs-utils on the client side.

CentOS/Red Hat:

yum install nfs-utils

Ubuntu/Debian:

apt update
apt install nfs-kernel-server
| improve this answer | |
2

I have a different process for this that replaced the bad superblock with one of the alternatives. FSCK can be a "lossy" process because FSCK may want to remove too much data or to remove data from a sensitive location (e.g. data directory for a data base) so there are times when I don't want to use it or it doesn't work.

You can sudo yourself silly or just become root for the process. Just remember that when you are root, Linux assumes that you know what you're doing when you issue commands. If so directed, it will speedily delivery Mr. Bullet to Mr. Foot. Like many other things, with great power comes great responsibility. That concludes my warning on running your system as root.

sudo -s

fdisk -l

Figure out which device - assuming /dev/sdc1 for this example along with EXT4 as its the most common for this explanation.

fsck -N /dev/sdc1

Your device and your file system (ZFS, UFS, XFS, etc.) may vary so know what you have first. Do not assume it's EXT4. Ignoring this step can cause you problems later if it's NOT an EXT4 file system.

fsck.ext4 -v /dev/sdc1

Get your error message which says the superblock is bad. You don't want to do this if your superblock is OK.

mke2fs -n /dev/sdc1

This will output the alternate superblocks stored on your partition.

*Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208*

Pick an alternate superblock - keep in mind that the first one is the default and its bad so let's not use that one. You will also want to pick one from the list you get from your partition. Do not use the example. Your superblocks may be stored elsewhere.

e2fsck -b 98304 /dev/sdc1

Reboot and see if this worked. If not try the next superblock on the list. I've had to go the third or fourth one a couple of times.

e2fsck -b 163840 /dev/sdc1

Now try the command to validate the disk again. See if you get the same messabout about bad superblocks.

fsck.ext4 -v /dev/sdc1

Keep trying until you either run out of superblocks or it works. If you run out, you likely have bigger issues and I hope you have good backups. You can try running FSCK at that point.

| improve this answer | |
  • 3
    I urge people to wait for 1 day or 2 for accepting answers. – Israr Nov 8 '19 at 6:45
1
# create mount dir
sudo mkdir /hdd6T

# new file system
sudo mkfs.ext4 /dev/sdc

# mount drive
sudo mount /dev/sdc /hdd6T/

# change ownership to specified user
sudo chown your-user /hdd6T/
| improve this answer | |
  • 6
    The question already says mkdir and mount, and the accepted answer says mkfs.ext4.  You’ve added chown, which has nothing to do with the question, so you aren’t really contributing any useful new information. – G-Man Says 'Reinstate Monica' Apr 7 '19 at 4:18
1

I know this is an old question but in case this helps anyone that stumbles across this.

I was attempting to connect and NFS mount but was failing and getting the same error as OP.

After installing the dependencies I was good to go:

sudo apt install nfs-common

| improve this answer | |
0

For me, there was some mysterious file causing this issue.

I had to clear the directory using the following command:

sudo mkfs -t ext3 /dev/sdf

Warning: this might delete files you have saved. So you can run ls to make sure you don't lose important saved files and backup these files before execution.

| improve this answer | |
0

If you are trying to mount image file in any folder present in /home in ubuntu then try these Commands:

Generalized :

>>mkdir <name of your directory>
>>sudo mount -o ro <name of image file with extension> <name of your directory>/

Specified: name of your directory = system , name of image file with extension = system.img

>>mkdir system                                
>>sudo mount -o ro system.img system/
| improve this answer | |
0

I had to install ntfs-3g.

The message appeared in dolphin. With installing ntfs-3g, dolphin can mount it properly.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.