Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have been trying to mount an ext2 hard drive in ubuntu server, but when i run sudo mount /dev/sdb /media/mynewdrive -t ext2 I get

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 also ran fsck /dev/sdb and got

fsck from util-linux 2.20.1
e2fsck 1.42.5 (29-Jul-2012)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdb

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
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>

Not sure where to go from here! Anyone have any ideas?

share|improve this question

3 Answers 3

First I would double check that the disk is structured as you think it is from a partitions perspective. Typically the command:

$ fdisk -l /dev/sdb

For example:

$ sudo fdisk -l /dev/sda

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xebc57757

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2459647     1228800    7  HPFS/NTFS
/dev/sda2         2459648   317224959   157382656    7  HPFS/NTFS
/dev/sda3       956291072   976771071    10240000    7  HPFS/NTFS
/dev/sda4       317224960   956291071   319533056    5  Extended
/dev/sda5       317227008   318251007      512000   83  Linux
/dev/sda6       318253056   956291071   319019008   8e  Linux LVM

Partition table entries are not in disk order

That should show you some details about the partitions. I would suspect that your drive probably contains partitions so you're probably meaning to mount a partition that's identified as "Linux". So your command should be directed to a specific partition and not the entire HDD.

For me I would do:

$ sudo mount /dev/sda5 /media/mynewdrive -t ext2

to mount the 5th partition if I knew it had an ext2 filesystem on it.

share|improve this answer

If you created an ext2 file-system on the entire disk, then

sudo mount /dev/sdb  /media/mynewdrive -t ext2

should be correct, but if you created an ext2 file-system on a partition then the command should be like:

sudo mount /dev/sdb1 /media/mynewdrive -t ext2

(or s/sdb1/sdbN/ for the Nth partition). The fsck utility also applies to file-systems (which can be on partitions or on entire disks). Try:

sfdisk -l /dev/sdb

(or fdisk -l /dev/sdb) to see what the disk layout is (no partitions, xor how many partitions and of what type).

(edit to clarify whole disk confusion)

A file-system can be created on many kinds of block device: whole disks, partitions, logical volumes, raid arrays.

It may be unusual to create an FS on an entire disk, but it is possible. The typical all-Linux situation is a partitioned disk with /boot on one partition, and at least one more partition, which might contain an ext{2,3,4} FS, or a LUKS-encrypted volume, or an LVM stack of PV/VG/LV which then contains 1 or more filesystems.

Multi-disk systems might allocate an entire disk to LUKS or LVM. Dual-boot system might have more partitions. YMMV. Here's mine:

# mke2fs -t ext4 /dev/sdf
mke2fs 1.42.3 (14-May-2012)
/dev/sdf is entire device, not just one partition!
Proceed anyway? (y,n) y

mke2fs & mount output not shown

share|improve this answer

/dev/sdb is a ENTIRE disk, including MBR headers and such. This is NOT what you want.

Filesystems are created as a sub-division of an ENTIRE disk, these are partitions and created via the program fdisk. You can find out the current partitioning of a disk using the fdisk command. The partitions are numbered, and referenced by appending the partition number to the ENTIRE disk device name. Thus a filesystem is never found on /dev/sdb, but on something like /dev/sdb2. This partition device can then be used to mount, fsck, newfs, and mkfs for filesystems.

You'll have to determine using fdisk what the specific partition is.

Then do an fsck on that partition SPECIFYING the fileystem type (read the man page).

Then if that passes you can mount the partitionn specifying the filesystem type as the root user. Read the man page on the mount command.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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