1

I'm currently experiencing strange behavior when using a new external usb hard drive that I believe that the behavior is related to a mount issue, a file system issue or actual hardware failure. It should help the community if I mention what I've done to correct the problem and what I've used to mount the usb hard drive.

File System

The USB hard drive was formatted in Ubuntu in a VM on my windows machine. It was then later moved to physical ubuntu server.

USB Mount

I installed USB Mount using sudo apt-get install usbmount after which I then was able to browse the hard drive and write to it via /media/usb.

All good until...

I got to around 20GB on the hard drive, there after I was getting failures via FTP when copying to the device. Now the strange problem is that when I use sudo cp filename and write to the device I get zero errors. The errors reported via Flashfxp are either disk full or error read/write input error.

Using Pmount

Removing USBMount and using Pmount does not resolve the issue other than I see /media/usb0 rather than just /usb/ Removing both pmount and usbmount I can still see /media/usb0/ which I found pretty odd.

Fdisk reports several problems

The below is a report from using fdisk as you can see it looks like I have no file system on sdb which is strange as I can view it. Using fdisk /dev/sdb/ I am unable to view any partitions nor can I delete them, even when creating one.

simon@Pluto2:/media/usb0$ sudo fdisk -l

Disk /dev/sda: 37.0 GB, 37019566080 bytes 255 heads, 63 sectors/track, 4500 cylinders, total 72303840 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: 0x000c5772

   Device Boot      Start         End      Blocks   Id  System /dev/sda1   *        2048      499711      248832   83  Linux /dev/sda2          501758    72302591    35900417    5  Extended /dev/sda5          501760    72302591    35900416   8e  Linux LVM Note: sector size is 4096 (not 512)

Disk /dev/sdb: 2000.4 GB, 2000398929920 bytes 255 heads, 63 sectors/track, 30400 cylinders, total 488378645 sectors Units = sectors of 1 * 4096 = 4096 bytes Sector size (logical/physical): 4096 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x0001b7d6

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/mapper/Pluto2--vg-root: 32.6 GB, 32635879424 bytes 255 heads, 63 sectors/track, 3967 cylinders, total 63741952 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: 0x00000000

Disk /dev/mapper/Pluto2--vg-root doesn't contain a valid partition table

Disk /dev/mapper/Pluto2--vg-swap_1: 4123 MB, 4123000832 bytes 255 heads, 63 sectors/track, 501 cylinders, total 8052736 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: 0x00000000

Disk /dev/mapper/Pluto2--vg-swap_1 doesn't contain a valid partition table

Running fsck

I found several guides online and one of them mentioned to run fsck... sadly this just makes the issue for me a lot more confusing.

simon@Pluto2:/media/usb0$ sudo fsck /dev/sdb
fsck from util-linux 2.20.1
e2fsck 1.42.9 (4-Feb-2014)
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 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>

Running e2fsck -b 8193 and -b 32768

simon@Pluto2:/media/usb0$ sudo e2fsck -b 32768 /dev/sdb
e2fsck 1.42.9 (4-Feb-2014)
e2fsck: Bad magic number in super-block 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>

Running smartctl -i

simon@Pluto2:/media/usb0$ sudo smartctl -d sat -i /dev/sdb
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.14 (AF)
Device Model:     ST2000DM001-1CH164
Serial Number:    XXXXXXXXXX
LU WWN Device Id: 5 000c50 06636209d
Firmware Version: CC49
User Capacity:    2,000,398,934,016 bytes [2.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2, ACS-3 T13/2161-D revision 3b
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Tue Dec  9 21:31:44 2014 GMT

==> WARNING: A firmware update for this drive is available,
see the following Seagate web pages:
http://knowledge.seagate.com/articles/en_US/FAQ/207931en
http://knowledge.seagate.com/articles/en_US/FAQ/223651en

SMART support is: Available - device has SMART capability.
SMART support is: Enabled

Running smartctl -d sat -t short /dev/sdb

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%       258

Under 20GB Mark

It's also worth mentioning that If I delete 5gb of data I can then write another 5gb to the device without problems.. its only when the drive gets used to a certain point which could indicate bad sectors but then I'd expect to be able to run various tools on the device.

  • Best advice from Fabby: If it doesn't start working at full capacity with no errors, Return the HD and get a new one (if able) – Xen2050 Dec 10 '14 at 15:19
  • Check dmesg for more information after getting an error, and check the output of mount. Are you sure it is ext4 and it is on /dev/sdb? – psusi Dec 10 '14 at 15:19
1

Your hard-disk itself has a problem on one of its sectors and the hard-disk problem needs to be fixed before you try to re-use it.

All that you've done until now is running file system repair tools which all assume they have a good hard drive to work with

If you really suspect hard drive failure, (which is what this looks like) you should run badblocks

In this case, I wouldn't run it on a partition, but on the entire drive and take a destructive test (if possible).

Before running the following command read man badblocks

badblocks is one level above low-level formatting a disk and one level below a FS format.

What I would do is move it to a physical machine (not a VM) and: umount /dev/usb0&&badblocks /dev/usb0 -s -v -w where usb0 is the device name of the drive.

The above command will kick-start your drive's SMART technology to swap out the bad sectors if possible (and if SMART doesn't do anything the output of badblocks can be used as an input to mke2fs)

Re-reading the entire conversation again:

It's a new drive: Return it and swap it out for another one!

  • Can badblocks be used to save the bad blocks to any FS other than ext2/3/4? Or is running it about the same as just trying to read every sector/block of a HD, like for example running photorec on the whole drive, or dd if=/dev/sdb of=/dev/null and watching logs for read errors? – Xen2050 Dec 10 '14 at 7:52
  • 1
    I don't know about the internal technology of photorec but my badblocks command is definitely superior to your dd command. (man badblocks for more info) – Fabby Dec 10 '14 at 13:28
  • Just read up on photorec. That's more like ddrescue. It doesn't allow you to re-use a disk that is going bad: it just allows you to recover data... – Fabby Dec 10 '14 at 13:41
  • But his problem is that fsck can't even see any ext filesystem, and without that how can badblocks do anything with the bad sectors it finds? – Xen2050 Dec 10 '14 at 13:50
  • 1
    I disconnected the hard drive and used seagate's hard drive tool. The hard drive passes on the smart test but fails on both short and long generic surface scans. Seagate has already sent out a replacement and I'm waiting for it to arrive. Thanks for your help! – Simon Hayter Dec 17 '14 at 19:43
1

Does the drive work normally on other computers or windows? Can you read & write to the entire drive?

I've used external usb drive "cases" before, where you plug in a HD or cd/dvd drive, Ubuntu (Linux Mint) usually sees the HD's as /dev/sdc (for example) like a regular drive. No need for usbmount or pmount, but maybe yours is newer or weird somehow. Are there any others with the exact same drive who can (or can't) use it with linux (Ubuntu, debian, any)?

Anyway, when it does get mounted, what is the format of the drive? Take a look with mount &/or lsblk.

Any MBR or GPT? Your running fsck on the "whole" device /dev/sdb and not a partition like /dev/sdb1 (but fdisk doesn't appear to see any partitions anyway), but it can't see any ext2/3/4 FS there. Does fsck still balk when used on /dev/sdb1? And in general, it's best to run fsck on unmounted partitions.

With a USB hard drive, it's hard to tell if it's a software/driver problem, or the HD itself, or the external "case", or the USB cord or hub or plug...


New info: I may have overlooked (almost TL;DR ;-) a potentially interesting piece of info:

The USB hard drive was formatted in Ubuntu in a VM on my windows machine

I haven't had good luck with VM's and usb (or any direct access to hardware) since everything goes through the VM program, that looks like a big suspect in the strange behaviour...

  • Good information I'm gonna go away and test the drive on a windows machine shortly. – Simon Hayter Dec 10 '14 at 11:53
  • I think all manufacturers test for windows compatibility, so if it works anywhere it'll be there. Unfortunately it seems like most of them can't even spell linux – Xen2050 Dec 10 '14 at 12:15
  • @both: That's what he's tried to do until now: FS checks. The drive itself needs to be tested. Or using the drive manufacturer's low level format utility, or the more portable badblocks or commercial software... – Fabby Dec 10 '14 at 13:33
0

As a good alternative to badblocks you can try diskscan ( from terminal:apt-get install diskscan). It measures the latency time of reading sectors and it also reports bad sectors. The longer the latency time the greater the probabilify of an error developing.

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.