treuz
Posts: 7
Joined: Thu Oct 30, 2014 12:13 am

issue with usb hdd device naming

Thu Oct 30, 2014 12:28 am

Hello,

i'm facing a weird problem. I have an external USB disk (with independent AC power) attached to a Raspberry B model. I'm using this disk with Minidlna and Torrent.

In normal conditions external disk is mapped to /dev/sda and i have a static entry in /etc/fstab to mount the disk at boot time:

/dev/sda1 /media/share ext3 defaults 0 0

With "parted -l" i have this output:

Code: Select all

> root@raspberrypi ~ # parted -l
> Model: WDC WD10 EARS-00Y5B1 (scsi)
> Disk /dev/sda: 1000GB
> Sector size (logical/physical): 512B/512B
> Partition Table: msdos
> 
> Number  Start   End     Size    Type     File system  Flags
>  1      1049kB  1000GB  1000GB  primary  ext3
> 
> 
> Model: SD SD16G (sd/mmc)
> Disk /dev/mmcblk0: 16.0GB
> Sector size (logical/physical): 512B/512B
> Partition Table: msdos
> 
> Number  Start   End     Size    Type     File system  Flags
>  1      4194kB  62.9MB  58.7MB  primary  fat16        lba
>  2      62.9MB  16.0GB  15.9GB  primary  ext4
Now if i connect another usb disk on the other port, the system reboots, the 1TB disk is mapped to /dev/sdb and the other disk is mapped to /dev/sda.

Code: Select all

root@raspberrypi ~ # parted -l
Model: WD My Passport 0820 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name                  Flags
 1      20.5kB  210MB   210MB   fat32        EFI System Partition  boot
 2      211MB   1500GB  1500GB               exFAT
 3      1500GB  2000GB  500GB   hfsx         TimeMachine


Model: WDC WD10 EARS-00Y5B1 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  1000GB  1000GB  primary  ext3

Model: SD SD16G (sd/mmc)
Disk /dev/mmcblk0: 16.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      4194kB  62.9MB  58.7MB  primary  fat16        lba
 2      62.9MB  16.0GB  15.9GB  primary  ext4
And i have to manually mount both disk.

Is there a way to fix this behaviour?

Thank you

User avatar
default_user8
Posts: 680
Joined: Mon Nov 18, 2013 3:11 am

Re: issue with usb hdd device naming

Thu Oct 30, 2014 1:04 am

You need to identify the usb drives in your fstab. Some prefer to identify by drive label, some by uuid. I prefer by drive label because the uuid is unique to each drive so if that drive goes bad you have to enter the new drives uuid in your fstab file. If you use label just give the new drive the same name when you format it and plug it in, your fstab should look similar to this if you decide to use label.

LABEL=usbhdd2 /media/usbhdd2 ext4 defaults 0 0
And like this if you use the uuid.
UUID=f49fd266-cdc0-43ef-a7e4-8706e16405bf /media/usbhdd2 ext4 defaults 0 0

If your drive isn't labeled you can label them with gparted. And to find the uuid enter blkid in terminal.
Two heads are better than one, unless one's a goat head.

treuz
Posts: 7
Joined: Thu Oct 30, 2014 12:13 am

Re: issue with usb hdd device naming

Thu Oct 30, 2014 9:28 am

Thanks for your answer.

I had this setup until a few days ago, i was using UUID in order to "label" my external drive but unfortunately the behaviour was still the same. Even with UUID mapping in /etc/fstab, when i connect a new hard drive, the system reboots and does not mount any device.

DirkS
Posts: 10371
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: issue with usb hdd device naming

Thu Oct 30, 2014 10:38 am

treuz wrote:Thanks for your answer.

I had this setup until a few days ago, i was using UUID in order to "label" my external drive but unfortunately the behaviour was still the same. Even with UUID mapping in /etc/fstab, when i connect a new hard drive, the system reboots and does not mount any device.
Are you plugging a hard drive directly into the Pi while it's running? Your Pi cannot deal with sudden increase in power taken by the drive, gives up and reboots.
You probably need to use a powered USB hub.

Gr.
Dirk.

User avatar
default_user8
Posts: 680
Joined: Mon Nov 18, 2013 3:11 am

Re: issue with usb hdd device naming

Thu Oct 30, 2014 10:39 am

That sounds like a power issue, when you plug in your second drive it's dragging your power supply down and causing your pi to reboot. With 2 Usb drives you will absolutely need a powered hub. If you are already using a powered hub you may just need a more robust power supply.
Two heads are better than one, unless one's a goat head.

treuz
Posts: 7
Joined: Thu Oct 30, 2014 12:13 am

Re: issue with usb hdd device naming

Thu Oct 30, 2014 10:57 am

Thanks for the clarification, probably it's a power issue: the second hard drive that i'm plugging in doesn't have independent AC power while the first one have it.

I experienced the same issue even with 850mA and 2A power supply (for raspberry i mean, not hdd)

Return to “Troubleshooting”