1

I bought a brand new WD Passport off Newegg. I couldn't copy anything to it (copy operations hung indefinitely then ended with IO error), so I tried reformatting it via the GUI. It now appears to be formatted as EXT4. Unfortunately, I still couldn't copy things to it. It formatted suspiciously fast (a few seconds; it's a 1TB drive). So I figured maybe it formatted wrong. So I tried:

$ sudo fdisk /dev/sdb1   

and got:

fdisk: unable to read /dev/sdb1: Input/output error

What do I do?! I'm in Ubuntu 12.10 in case it matters.

2 Answers 2

1

fdisk works on disks, not partitions. On Linux, a disk is referred to as e.g. /dev/sdb, whereas the partitions on it are referred to as /dev/sdb1, /dev/sdb2 etc. Note that old-style (/dev/[hs]d?, /dev/[hs]d??) partition specifiers always end with a digit, whereas disk specifiers always end with a letter.

If you just format the disk (no bad blocks checking etc.), then a format time of a few seconds is not entirely unreasonable. All you did was write the initial file system metadata structures to disk, and while I don't have any exact numbers to cite, those are fairly small, and USB is pretty fast for writing such relatively small amounts of data. If you didn't get any errors, the format process probably did its thing.

The first thing you should do is run fdisk on the proper device. In your case, it sounds like that will be sudo fdisk /dev/sdb, but note that in some cases the device name can change with time. I recommend using one of the entries in /dev/disk/by-id instead, as those will not change. You can see what the disk shows up with there by running, immediately before you connect the disk:

diff <(ls /dev/disk/by-id) <(sleep 15; ls /dev/disk/by-id)

This will show the differences in directory content between the two executions of ls, which will be spaced 15 seconds apart thanks to the sleep invocation in the second input pipe. 15 seconds should give the kernel enough time to identify the disk and let udev create the appropriate device nodes. If it doesn't show any differences (empty output), unplug the disk and try it again increasing the delay. You will see both partition devices (ending with -part followed by a number and possibly @) and disk devices (without the -part part). If the file names do end with @, disregard that character; it's a ls output artefact.

Once you have partition(s) properly in place, you can make a file system on it/them. For example, sudo mkfs.ext4 -v /dev/disk/by-id/xxxxx-Passport-XXXXXXX-part1. The -v turns on extra output ("v" for verbose) which will give you an idea of whether the file system is created successfully.

After that, the disk should be perfectly usable.

3
  • I should have pointed out that I actually also tried /dev/sdb: fdisk: unable to read /dev/sdb: Input/output error
    – Hut8
    Commented Jul 5, 2013 at 16:12
  • @LaceCard fdisk or sudo fdisk? Access to raw devices is usually locked down pretty tightly, so you can't even read from them as an ordinary user (doing so would allow you to bypass file system permissions by interpreting the on-disk structures directly).
    – user
    Commented Jul 6, 2013 at 12:44
  • sudo fdisk! I was surprised.
    – Hut8
    Commented Jul 6, 2013 at 17:03
1

First of all you need to make sure that Ubuntu see your new disk:

$ sudo fdisk -l

For example, your new disk might be /dev/sdb. Adjust as needed below.

Create partition(s) on it with fdisk:

$ sudo fdisk /dev/sdb

and then format all partitions with mkfs.

Here is example for first partition:

$ sudo mkfs.ext4 /dev/sdb1

See more details in this instruction and here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .