# Cannot mount external WD HDD with EXT4 filesystem

## ripper1340

Hi (sorry if this has been posted before, but I couldn't find a similar post) 

I recently bought a Western Digital MyBook Essential 1TB external hard drive, and it seemed to work pretty well, until I decided to format it with the EXT4 filesystem with:

```

 mkfs.ext4 -L mybook /dev/sdb1 

```

The ext4 partition was mounted fine, but only until I rebooted my computer. Now, every time I attempt a mount 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

```

dmesg then shows:

```

 [ 4923.202389] EXT4-fs (sdb1): bad geometry: block count 244018936 exceeds size of device (244017301 blocks)

```

When I connect the device, dmesg outputs this:

```

[ 7243.032202] ehci_hcd 0000:00:1d.7: GetStatus port 1 status 001803 POWER sig=j CSC CONNECT

[ 7243.032206] hub 2-0:1.0: port 1: status 0501 change 0001

[ 7243.133070] hub 2-0:1.0: state 7 ports 6 chg 0002 evt 0000

[ 7243.133078] hub 2-0:1.0: port 1, status 0501, change 0000, 480 Mb/s

[ 7243.184471] ehci_hcd 0000:00:1d.7: port 1 high speed

[ 7243.184476] ehci_hcd 0000:00:1d.7: GetStatus port 1 status 001005 POWER sig=se0 PE CONNECT

[ 7243.235283] usb 2-1: new high speed USB device using ehci_hcd and address 5

[ 7243.286222] ehci_hcd 0000:00:1d.7: port 1 high speed

[ 7243.286227] ehci_hcd 0000:00:1d.7: GetStatus port 1 status 001005 POWER sig=se0 PE CONNECT

[ 7243.349744] usb 2-1: default language 0x0409

[ 7243.350492] usb 2-1: udev 5, busnum 2, minor = 132

[ 7243.350495] usb 2-1: New USB device found, idVendor=1058, idProduct=1110

[ 7243.350497] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3

[ 7243.350499] usb 2-1: Product: My Book 1110

[ 7243.350501] usb 2-1: Manufacturer: Western Digital

[ 7243.350502] usb 2-1: SerialNumber: 574341553444333933303636

[ 7243.350568] usb 2-1: uevent

[ 7243.350581] usb 2-1: usb_probe_device

[ 7243.350584] usb 2-1: configuration #1 chosen from 1 choice

[ 7243.351402] usb 2-1: uevent

[ 7243.351568] usb 2-1: adding 2-1:1.0 (config #1, interface 0)

[ 7243.351588] usb 2-1:1.0: uevent

[ 7243.351603] usb-storage 2-1:1.0: usb_probe_interface

[ 7243.351607] usb-storage 2-1:1.0: usb_probe_interface - got id

[ 7243.351660] scsi9 : SCSI emulation for USB Mass Storage devices

[ 7243.351730] usb-storage: device found at 5

[ 7243.351732] usb-storage: waiting for device to settle before scanning

[ 7248.351995] scsi 9:0:0:0: Direct-Access     WD       My Book 1110     2003 PQ: 0 ANSI: 4

[ 7248.352145] sd 9:0:0:0: Attached scsi generic sg2 type 0

[ 7248.352845] sd 9:0:0:0: [sdb] 1952151552 512-byte logical blocks: (999 GB/930 GiB)

[ 7248.354678] sd 9:0:0:0: [sdb] Write Protect is off

[ 7248.354682] sd 9:0:0:0: [sdb] Mode Sense: 23 00 10 00

[ 7248.354684] sd 9:0:0:0: [sdb] Assuming drive cache: write through

[ 7248.356151] usb-storage: device scan complete

[ 7248.357935] sd 9:0:0:0: [sdb] Assuming drive cache: write through

[ 7248.357940]  sdb: sdb1

[ 7248.366117] usb 2-1:1.0: uevent

[ 7248.366199] usb 2-1: uevent

[ 7248.368604] sd 9:0:0:0: [sdb] Assuming drive cache: write through

[ 7248.368608] sd 9:0:0:0: [sdb] Attached SCSI disk

[ 7248.374565] usb 2-1:1.0: uevent

```

To detail things a little bit, I created a new partition table using cfdisk, using a single partition that was formatted to Ext4. fdisk tells me this:

```

 # fdisk -ul /dev/sdb

Disk /dev/sdb: 999.5 GB, 999501594624 bytes

255 heads, 63 sectors/track, 121515 cylinders, total 1952151552 sectors

Units = sectors of 1 * 512 = 512 bytes

Disk identifier: 0x000564d0

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1              63  1952138474   976069206   83  Linux

```

I've rebooted my computer using an Ubuntu 9.04 LiveCD and it mounts with no trouble at all. After a little research, I found this: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/479640. So I'm guessing it's related to some missing kernel configuration or version, however, I have a Seagate IDE 250gb HDD that was formatted to ext4 too  and it works fine. Also, creating a loop device with  the proper offset (32256) to the partition also works, so it's probably a problem with the partition table. 

I'm using an x86_64 system, with this kernel version: 

```

~ $ uname -a

Linux behemoth 2.6.31-gentoo-r10 #10 SMP PREEMPT Sat Apr 10 20:24:29 BRT 2010 x86_64 Intel(R) Core(TM)2 Duo CPU P8400 @ 2.26GHz GenuineIntel GNU/Linux

```

The worst part is that I cannot attempt a reformatting, because I've moved all my backups from one HDD to the 1TB HDD the first time it was mounted ok   :Rolling Eyes:   (REGRET). I could risk manipulating the partition table, but I'm a little scared to do that   :Crying or Very sad:  (these new drives comes with hidden partitions and I don't know if it's a 512 byte MBR anymore), and it is mounting ok on ubuntu 9.04. If there is no other way, I suppose I could boot on ubuntu and move all my backups back to the other HDD...

Thanks up ahead for any help, if you guys need any more info, I'll happily post as soon as I can!   :Smile: 

piccoli

EDIT: Just to clarify: both hard drives I mentioned in the post are external HDDs with a USB interface...

----------

## NeddySeagoon

ripper1340,

Putting together the pieces.

```
[sdb] 1952151552 512-byte logical blocks
```

gives a total of 244018944 4kB blocks on the volume.

subtracting 32kB as the first partition starts at sector 63, gives 244018936 4kB blocks in sdb1.

Which is the block the the system is asking for in.

```
block count 244018936 exceeds size of device (244017301 blocks) 
```

Now, fdisk rarely fills the drive as it still want to work in cylinders. and a Cylinder is 255 heads, 63 sectors/track and sector size of 512 bytes. 

Thats 8,225,280 Bytes or just over 8Mb.

Now, your filesystem has  999501561856 bytes allocated which is very odd as thats 121515.810021786 allocation units as used by fdisk and it should be an integer.

This suggests that the drive was orignially partitioned with another tool, the ext4 filesystem was made on it, then it was repartitioned with fdisk, which changed the end of the partition in line with the rules about partitions ending on a cylinder boundary. As a result, the filesystem extends off the ens of the partition.

Changing the partition table is safe but do not use fdisk - you need a tool that does not obey the outdated partitions must end on a cylinder boundary rule.

I think gparted can do that..

----------

