2

I am running a Raspberry Pi with Raspbian (a Linux based on Debian Wheezy) as a NAS (Network Attached Storage) with an USB hard drive attached as the only USB device.

The issue I am confronted with is that the external USB hard drive is at /dev/sda but changes at runtime of the operating system spontaneously to /dev/sdb without any reason. Then while using it at /dev/sdb it jumps back to /dev/sda. It also happens while copying a big bunch of data resulting in I/O errors. Sometimes it takes hours but otherwise it takes minutes for this to happen. – This is really spooky!

Of course I considered the internet for clues before asking here for help. The only interesting thing I found was the following link: Linux: Remember path to USB Device – I followed the described steps and I am posting here the output of the commands,

Command 1: udevadm info -q all -p $(udevadm info -q path -n /dev/sda)

Output 1:

P: /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/host0/target0:0:0/0:0:0:0/block/sda
N: sda
S: disk/by-id/usb-WDC_WD25_00JS-40NGB2_8DC88D250088-0:0
S: disk/by-path/platform-bcm2708_usb-usb-0:1.3:1.0-scsi-0:0:0:0
E: DEVLINKS=/dev/disk/by-id/usb-WDC_WD25_00JS-40NGB2_8DC88D250088-0:0 /dev/disk/by-path/platform-bcm2708_usb-usb-0:1.3:1.0-scsi-0:0:0:0
E: DEVNAME=/dev/sda
E: DEVPATH=/devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/host0/target0:0:0/0:0:0:0/block/sda
E: DEVTYPE=disk
E: ID_BUS=usb
E: ID_INSTANCE=0:0
E: ID_MODEL=00JS-40NGB2
E: ID_MODEL_ENC=00JS-40NGB2\x20\x20\x20\x20\x20
E: ID_MODEL_ID=2336
E: ID_PART_TABLE_TYPE=dos
E: ID_PATH=platform-bcm2708_usb-usb-0:1.3:1.0-scsi-0:0:0:0
E: ID_PATH_TAG=platform-bcm2708_usb-usb-0_1_3_1_0-scsi-0_0_0_0
E: ID_REVISION=0100
E: ID_SERIAL=WDC_WD25_00JS-40NGB2_8DC88D250088-0:0
E: ID_SERIAL_SHORT=8DC88D250088
E: ID_TYPE=disk
E: ID_USB_DRIVER=usb-storage
E: ID_USB_INTERFACES=:080650:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=WDC_WD25
E: ID_VENDOR_ENC=WDC\x20WD25
E: ID_VENDOR_ID=152d
E: MAJOR=8
E: MINOR=0
E: SUBSYSTEM=block
E: UDEV_LOG=3
E: UDISKS_ATA_SMART_IS_AVAILABLE=1
E: UDISKS_PARTITION_TABLE=1
E: UDISKS_PARTITION_TABLE_COUNT=1
E: UDISKS_PARTITION_TABLE_SCHEME=mbr
E: UDISKS_PRESENTATION_NOPOLICY=0
E: USEC_INITIALIZED=7853442

Command 2: udevadm info -q all -p $(udevadm info -q path -n /dev/sdb)

Output 2:

P: /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/host2/target2:0:0/2:0:0:0/block/sdb
N: sdb
S: disk/by-id/usb-WDC_WD25_00JS-40NGB2_8DC88D250088-0:0
S: disk/by-path/platform-bcm2708_usb-usb-0:1.3:1.0-scsi-0:0:0:0
E: DEVLINKS=/dev/disk/by-id/usb-WDC_WD25_00JS-40NGB2_8DC88D250088-0:0 /dev/disk/by-path/platform-bcm2708_usb-usb-0:1.3:1.0-scsi-0:0:0:0
E: DEVNAME=/dev/sdb
E: DEVPATH=/devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/host2/target2:0:0/2:0:0:0/block/sdb
E: DEVTYPE=disk
E: ID_BUS=usb
E: ID_INSTANCE=0:0
E: ID_MODEL=00JS-40NGB2
E: ID_MODEL_ENC=00JS-40NGB2\x20\x20\x20\x20\x20
E: ID_MODEL_ID=2336
E: ID_PART_TABLE_TYPE=dos
E: ID_PATH=platform-bcm2708_usb-usb-0:1.3:1.0-scsi-0:0:0:0
E: ID_PATH_TAG=platform-bcm2708_usb-usb-0_1_3_1_0-scsi-0_0_0_0
E: ID_REVISION=0100
E: ID_SERIAL=WDC_WD25_00JS-40NGB2_8DC88D250088-0:0
E: ID_SERIAL_SHORT=8DC88D250088
E: ID_TYPE=disk
E: ID_USB_DRIVER=usb-storage
E: ID_USB_INTERFACES=:080650:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=WDC_WD25
E: ID_VENDOR_ENC=WDC\x20WD25
E: ID_VENDOR_ID=152d
E: MAJOR=8
E: MINOR=16
E: SUBSYSTEM=block
E: UDEV_LOG=3
E: UDISKS_ATA_SMART_IS_AVAILABLE=1
E: UDISKS_PARTITION_TABLE=1
E: UDISKS_PARTITION_TABLE_COUNT=1
E: UDISKS_PARTITION_TABLE_SCHEME=mbr
E: UDISKS_PRESENTATION_NOPOLICY=0
E: USEC_INITIALIZED=2425648913

So I tried the trick and added the line BUS=="usb", ATTR{serial}=="WDC_WD25_00JS-40NGB2_8DC88D250088-0:0", NAME="sda" to the file /etc/udev/rules.d/10-usb-serial but unfortunately this also did not solve the issue.

I do not know if this is important to mention but the used external USB storage consists of two identical Hard drives of 256 GB of size in a JBOD controlled case. That means that it looks like one hard drive of 512 GB of size for the operating system.

And now I am looking forward to get any help and/or suggestions. – Thanks in advance!

5
  • This is very weird. Where is your OS installed? The two outputs you show list different devices, are you sure the /dev name of your disk is changing?
    – terdon
    Jan 6, 2014 at 12:33
  • The OS is installed on a 4 GB SD card and the Raspberry Pi is booting from the SD card. But how do you see different devices in my output? Yes, I am very sure it is the same and only device attached to USB.
    – mrkskwsnck
    Jan 6, 2014 at 13:01
  • The DEVPATH and P: lines are different.
    – terdon
    Jan 6, 2014 at 13:03
  • Yes, that is true. But it is the same USB device. I did not touch anything for these both outputs.
    – mrkskwsnck
    Jan 6, 2014 at 15:18
  • I know, it's got 2 disks though and that seems to be the issue.
    – terdon
    Jan 6, 2014 at 15:19

2 Answers 2

1

Since I had no further ideas to solve this issue I simply used another USB cable to attach the external hard drive to the Raspberry Pi and now it is working properly O_o It seems that the previous used USB cable was defective somehow.

Obviously the external hard drive previously lost connectivity to the Raspberry Pi for a short time. The operating system then was thinking that another hard drive was attached. Otherwise I cannot imagine that issue.

So this issue is officially solved now!

0

Considering it's a USB attached drive, it switching between /dev/sda and /dev/sdb on boot is not surprising; it doing it during normal sessions would lead one to suspect a screwy usb configuration on either the RasPi side OR the physical HDD itself (more the firmware that controls the 2 HDD's in the enclosure). That being said, check out this link on UUID's, this pertains to Linux EXT3 partitions and judging from your output you have dos partitions (which is more likely FAT32 partitions) but you should be able to pull a UUID from the USB HDD using the blkid command as mentioned in the article. Here's some links if you have trouble getting the UUID of your DOS partition.

IMHO if you're using the RasPi as a NAS and the USB drives are not going to be moved (i.e. the USB drive stays plugged into the RasPi 24/7), I'd recommend pulling the HDD's out of the USB enclosure and directly connecting them to the RasPi (if you can), this will avoid those I/O issues and give you higher throughput to your disks (SATA speeds vs. USB2 speeds).

Hope that can help out.

You must log in to answer this question.

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