4

Recently (perhaps due to an update?) my hard drives no longer automatically mount. I have a USB hub attached to the Pi, with a wifi card and some hard drives attached to the hub. The hard drives are no longer mounted automatically.

I tried restarting, but that failed. I tried connecting a hard drive directly to the Pi, but that also failed. lsusb and dmesg seem normal.

$ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 018: ID 1058:1021 Western Digital Technologies, Inc. Elements 2TB
Bus 001 Device 015: ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
Bus 001 Device 016: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter

$ dmesg
[ 2608.743531] usb 1-1.2: USB disconnect, device number 18
[ 2624.087365] usb 1-1.2: new high-speed USB device number 19 using dwc_otg
[ 2624.188989] usb 1-1.2: New USB device found, idVendor=1058, idProduct=1021
[ 2624.189026] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2624.189045] usb 1-1.2: Product: Ext HDD 1021
[ 2624.189062] usb 1-1.2: Manufacturer: Western Digital
[ 2624.189080] usb 1-1.2: SerialNumber: 574D43315434323538323934
[ 2624.199624] usb-storage 1-1.2:1.0: USB Mass Storage device detected
[ 2624.208417] scsi7 : usb-storage 1-1.2:1.0
[ 2625.210184] scsi 7:0:0:0: Direct-Access     WD       Ext HDD 1021     2021 PQ: 0 ANSI: 4
[ 2625.216840] sd 7:0:0:0: [sda] 732566016 4096-byte logical blocks: (3.00 TB/2.72 TiB)
[ 2625.218969] sd 7:0:0:0: [sda] Write Protect is off
[ 2625.219013] sd 7:0:0:0: [sda] Mode Sense: 17 00 10 08
[ 2625.221082] sd 7:0:0:0: [sda] No Caching mode page found
[ 2625.221121] sd 7:0:0:0: [sda] Assuming drive cache: write through
[ 2625.223100] sd 7:0:0:0: [sda] 732566016 4096-byte logical blocks: (3.00 TB/2.72 TiB)
[ 2625.227313] sd 7:0:0:0: [sda] No Caching mode page found
[ 2625.227350] sd 7:0:0:0: [sda] Assuming drive cache: write through
[ 2625.296944]  sda: sda1
[ 2625.301114] sd 7:0:0:0: [sda] 732566016 4096-byte logical blocks: (3.00 TB/2.72 TiB)
[ 2625.305220] sd 7:0:0:0: [sda] No Caching mode page found
[ 2625.305259] sd 7:0:0:0: [sda] Assuming drive cache: write through
[ 2625.305290] sd 7:0:0:0: [sda] Attached SCSI disk

I cannot see the hard drive in /media/ nor via mount or df.

I'm not sure if important, but my recent updates were:

Start-Date: 2014-01-20  10:47:41
Commandline: apt-get upgrade -y
Upgrade: libdpkg-perl:armhf (1.16.12, 1.16.12+rpi1), dpkg:armhf (1.16.12, 1.16.12+rpi1), dpkg-dev:armhf (1.16.12, 1.16.12+rpi1)
End-Date: 2014-01-20  10:49:44

Start-Date: 2014-01-26  10:42:48
Commandline: apt-get upgrade -y
Upgrade: mysql-common:armhf (5.5.33+dfsg-0+wheezy1, 5.5.35+dfsg-0+wheezy1), libmysqlclient18:armhf (5.5.33+dfsg-0+wheezy1, 5.5.35+dfsg-0+wheezy1)
End-Date: 2014-01-26  10:43:01

EDIT

Manually mounting the HD seems to work. In the past this was not necessary.

mkdir /path/to/mntdir
sudo mount /dev/sda1 /path/to/mntdir

EDIT 2

The important function that I wish to retain of the previous behaviour is that attached drives should mount at a consistent location, i.e. based on the volume's label name. This will allow me to use predictable paths in various configurations, as well as allowing me to quickly identify newly mounted drives.

  • The system sees only 1 hard drive. Is there another one on the hub? – M Noit Jan 27 '14 at 13:43
  • @MNoit At the time of lsusb above there was only one hard drive connected (directly to the Pi). – Sparhawk Jan 27 '14 at 14:06
  • @MNoit I've troubleshooted more and edited the question. – Sparhawk Jan 27 '14 at 14:41
  • (directly to the Pi): a powered hub is a must for a hard drive. At least for troubleshooting: just consider your power supply might be ageing, and could not deliver enough current anymore (or you could get a voltage drop, but that should bring the Pi down too). Anyway: check if usbmount is (still?) installed. – M Noit Jan 27 '14 at 22:25
  • @MNoit I think in this case, it's not a hardware problem, since I can mount it fine manually. usbmount isn't installed. I'll install it and try tonight. – Sparhawk Jan 28 '14 at 0:49
1

Under /etc/udev/rules.d, create a file named like 80-usb-mount.rules, with the following content:

ACTION=="add", SUBSYSTEMS=="usb", ATTRS{serial}=="574D43315434323538323934", SYMLINK+="wd%n"
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{serial}=="574D43315434323538323934", RUN+="/bin/mkdir /media/wd"
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{serial}=="574D43315434323538323934", RUN+="/bin/mount -t auto -o defaults /dev/wd1 /media/wd", OPTIONS="last_rule"
ACTION=="remove", SUBSYSTEMS=="usb", ATTRS{serial}=="574D43315434323538323934", RUN+="/bin/umount /media/wd"
ACTION=="remove", SUBSYSTEMS=="usb", ATTRS{serial}=="574D43315434323538323934", RUN+="/bin/rmdir /media/wd", OPTIONS="last_rule"

And after that restart udev service:

sudo /etc/init.d/udev restart
  • Thanks for the reply Igor. However, I can see a few potential problems with this. /dev/sda1 is likely to change. Also, this udev rule only work for one specific HD. For similar functionality (simpler and more robust), I could just use an fstab rule. I'm more interested in getting back the functionality pre-update, where all attached USB storage is automatically mounted. – Sparhawk Jan 28 '14 at 0:46
1

This depends a little bit on what the rest of your system does and how it is setup, but I use usbmount and I am very happy with it.

Get it with

sudo apt-get install usbmount
  • this was already mentioned in the comments above, but had associated problems (as mentioned above). – Sparhawk Feb 27 '14 at 9:34
1

I had a similar problem. I fixed mine in following way,

Get the UUID of the external hard drive with following command

sudo blkid

Add the entry into fstab so that when you restart the raspberry device it is auto mounted every time

First open the file using an editor:

sudo nano /etc/fstab

Then add the following line:

UUID=0A423D084xxxxxx    /mnt/data    ntfs    defaults,noatime,auto    0    0

Some explanation for above command:

I mounted it to /mnt/data directory (If it does not exist, create it using sudo mkdir /mnt/data). Mine was in NTFS format. You might try only the defaults option. I added noatime and auto to experiment with a few things. You can check more details about it online.

Some Raspberry devices (including mine) needs one more addition (optional, try only if above doesn't work), after modifying fstab, add a 5 seconds delay to loading the device as sometimes Raspbian finishes booting before the external hard drive is ready. In this case the external drive isn't auto mounted and it is skipped with an error at the start.

Add the following property/value to the end of /boot/cmdline.txt:

rootdelay=5

Hope it helps!

  • Thanks for the answer. However, there are a few problems with using fstab, as mentioned previously in my comments (and this approach has already been suggested). I've edited these concerns into the main question, since they were a bit lost before. In brief, newly attached hard drives will not mount. – Sparhawk Jan 6 '16 at 10:22
  • @Sparhawk USB disconnect, device number 18 on OP's log might have indicated a power problem. – Gene Dela Rosa Jan 6 '16 at 10:43
  • @PandaLion98 I can mount it manually, so I'm not sure about that. – Sparhawk Jan 6 '16 at 13:02
1

It is possible that you previously had Thunar (the XFCE file manager) which has a thunar-volman extension that handles automounting. In Thunar settings there in an option Mount removable media when inserted. If you had Nautilus then it has its own gnome-based automounting. Apparently, both XFCE and Gnome rely on udisks for automounting.

If after the upgrade you used raspi-config and configured xorg to not start at boot then that would explain why automount stopped working for you.

If you have xorg running at all times then you can install the packages with sudo apt install thunar thunar-volman and then in Thunar settings enable automounting.

For me relying on a xorg desktop for USB mounting is not feasible, since I don't want to have an xorg session always running, therefore, I looked at existing headless options, which included systemd mount/automount units, udev rules, but finally settled on usbmount which works with the downside that instead of partition labels the mount points are created as /media/usb1|usb2|usb3.. etc. In current raspbian jessy an edit was needed in order to make usbmount work as described here: in short, in /lib/systemd/system/systemd-udevd.service replace "MountFlags=slave" with "MountFlages=shared"

This is what I finally ended up using:

udev+systemd automounting

https://github.com/six-k/automount-usb

To set up run sudo CONFIGURE.sh.

  • Thanks for the answer, but my Pi doesn't have X installed. One of the other answers mentions usbmount, but as per my comments on the question, it's not an ideal solution. – Sparhawk Nov 5 '17 at 21:55
  • @Sparhawk: I updated the answer with a new option — automount-usb. I removed usbmount, ran the configure.sh script and voila! – ccpizza Nov 6 '17 at 21:58
  • Thank you for updating your solution (+1). Unfortunately I don't have systemd installed, but hopefully this is helpful for someone else! – Sparhawk Nov 19 '17 at 7:15
0

This is only a partial answer so far, but udisks-glue looks promising.

Detective work

I recently bought another Raspberry Pi and installed Raspbmc on it. I was pleasantly surprised to notice that inserted media were automatically mounted at /media/<label>. I checked out what packages were installed on Raspbmc and not my Raspbian.

On each system, get list of installed packages.

sudo dpkg -l | awk '{print $2}' > dpkg_list

Then see what is unique to raspbmc

diff dpkg_list_raspbian dpkg_list_raspbmc \
  --unchanged-group-format="" --changed-group-format='%>' > dpkg_list_raspbmc_uniq

There were about 100 packages, but the one that stood out was udisks-glue.

Installation

sudo apt-get install udisks-glue

Unfortunately, I haven't worked out how to properly run it at boot yet. I followed the instructions here, but they cause the media to be mounted with root permissions (drwx------). I've asked here to see if it can mount devices with user pi owning them.

UPDATE

And now this totally fails for me, since I cannot install policykit-1 with system V.

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.