cgjamj
Posts: 14
Joined: Fri Nov 25, 2016 3:49 pm

USB drive randomly auto-mounting

Fri Mar 03, 2017 10:38 pm

Hello all. I'm running Raspbian and have a USB drive that I could not get to properly auto-mount despite trying numerous ways from various sources/tutorials. I gave up and just manually mounted the drive via the below command...

Code: Select all

sudo mount -t ntfs-3g -o uid=pi,gid=pi /dev/sda1 mynetworkdrive
Which gave me the expected output from the df command...

Code: Select all

/dev/sda1      1953511420 716375380 1237136040  37% /home/pi/mynetworkdrive
I thought this was fine and would only require manual intervention whenever the Pi was rebooted. However, I would sometimes loose connection to my DLNA client. I ssh'd into the Pi and could see that Raspbian seemed to auto-mount the already mounted drive where I would see the following df output...

Code: Select all

/dev/sda1      1953511420 716375380 1237136040  37% /home/pi/mynetworkdrive
/dev/sdb1      1953511420 716375380 1237136040  37% /media/pi/Seagate Backup Plus Drive
I would umount them both and then manually remount the drive and all was well. The auto-mounting happens randomly and can happen within a few hours of mounting it or even several days later. I removed all auto-mounting commands from /etc/fstab once I could not get it to properly mount to the mynetworkdrive folder.

Is there any way to prevent it from auto-mounting or anything that will cause it to see that the drive has already been mounted and not auto-mount it?

Thanks!

k-pi
Posts: 930
Joined: Sun Feb 12, 2017 1:46 pm
Location: Upper Hale, Surrey, UK.

Re: USB drive randomly auto-mounting

Sat Mar 04, 2017 3:36 pm

The best way to mount USB drives is to use their disk ID, don't use the Linux descriptors, (sda1/sdb1), that way they should always mount to the directory you specify.

Also, errors=remount might work, check it out, man mount.

cgjamj
Posts: 14
Joined: Fri Nov 25, 2016 3:49 pm

Re: USB drive randomly auto-mounting

Sun Mar 05, 2017 12:26 pm

I've tried multiple ways of mounting, including using the disk id. The below line is commented out in my /etc/fstab after it did not work...

Code: Select all

UUID=6A202EBC202E8EDF mynetworkdrive ntfs-3g defaults,auto,users,rw,uid=pi,gid=pi,umask=007 0 0
Any suggestions on how to mount it using the disk id differently?

Thanks!

User avatar
DougieLawson
Posts: 37607
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: USB drive randomly auto-mounting

Sun Mar 05, 2017 12:44 pm

Get the output from blkid and we can help you code your /etc/fstab.

I've got four machines running with USB hard drives and all of them use UUID or PARTUUID in /etc/fstab and /boot/cmdline.txt.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

cgjamj
Posts: 14
Joined: Fri Nov 25, 2016 3:49 pm

Re: USB drive randomly auto-mounting

Mon Mar 06, 2017 11:40 am

Thanks very much, I appreciate the help! Can you tell me how to get the blkid output? I'm not familiar with that?

k-pi
Posts: 930
Joined: Sun Feb 12, 2017 1:46 pm
Location: Upper Hale, Surrey, UK.

Re: USB drive randomly auto-mounting

Mon Mar 06, 2017 12:33 pm

Type it into a terminal, & press return/enter key. :)

cgjamj
Posts: 14
Joined: Fri Nov 25, 2016 3:49 pm

Re: USB drive randomly auto-mounting

Mon Mar 06, 2017 2:05 pm

I had done that but was getting nothing...then I realized I needed to be in root. :shock:

Here's the blkid output for my drive...

Code: Select all

/dev/sda1: LABEL="Seagate Backup Plus Drive" UUID="6A202EBC202E8EDF" TYPE="ntfs" PARTUUID="aea1da1f-01"
Very much appreciate the help to get this auto-mounted properly!

User avatar
DougieLawson
Posts: 37607
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: USB drive randomly auto-mounting

Mon Mar 06, 2017 7:06 pm

Try adding this in /etc/fstab

Code: Select all

PARTUUID=aea1da1f-01 /media/ntfs ntfs-3g defaults 0 0
You'll need to make sure /media/ntfs (or whatever you use for your mountpoint) exists. You'll need to ensure the ntfs-3g driver is installed.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

cgjamj
Posts: 14
Joined: Fri Nov 25, 2016 3:49 pm

Re: USB drive randomly auto-mounting

Mon Mar 06, 2017 7:16 pm

My mount point is just the home/pi/mynetworkdrive folder, which exists. The ntfs-3g driver is installed as well. With that said, and the blkid info, can you advise on how I should edit /etc/fstab for auto-mounting?

Thanks!

cgjamj
Posts: 14
Joined: Fri Nov 25, 2016 3:49 pm

Re: USB drive randomly auto-mounting

Mon Mar 06, 2017 8:05 pm

I added the following to /etc/fstab and rebooted...

Code: Select all

PARTUUID=aea1da1f-01   mynetworkdrive ntfs-3g defaults 0 0
It didn't work until I did "sudo mount -a", but it's now mounted properly. Let's just see if this prevents the auto-mounting which conflicts and causes me to loose connection to my DLNA client.

Thanks for the help!

cgjamj
Posts: 14
Joined: Fri Nov 25, 2016 3:49 pm

Re: USB drive randomly auto-mounting

Tue Mar 07, 2017 1:03 am

It didn't work. :( After a couple of hours, it randomly auto-mounted the drive again...

Code: Select all

/dev/sdb1      1953511420 716375380 1237136040  37% /media/pi/Seagate Backup Plus Drive
Any other ideas to get that to stop?

User avatar
DougieLawson
Posts: 37607
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: USB drive randomly auto-mounting

Tue Mar 07, 2017 8:18 am

Disable automounting on PCManFM's settings. It's the GUI wot does it.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: USB drive randomly auto-mounting

Tue Mar 07, 2017 8:20 am

cgjamj wrote: I thought this was fine and would only require manual intervention whenever the Pi was rebooted. However, I would sometimes loose connection to my DLNA client. I ssh'd into the Pi and could see that Raspbian seemed to auto-mount the already mounted drive where I would see the following df output...

Code: Select all

/dev/sda1      1953511420 716375380 1237136040  37% /home/pi/mynetworkdrive
/dev/sdb1      1953511420 716375380 1237136040  37% /media/pi/Seagate Backup Plus Drive
I would umount them both and then manually remount the drive and all was well. The auto-mounting happens randomly and can happen within a few hours of mounting it or even several days later. I removed all auto-mounting commands from /etc/fstab once I could not get it to properly mount to the mynetworkdrive folder.

Is there any way to prevent it from auto-mounting or anything that will cause it to see that the drive has already been mounted and not auto-mount it?

Thanks!
I've seen something similar in the past where the drive disappears briefly for some reason and then re-appears before the OS has seen it go. This means it get's enumerated a 2nd time and appears as the newer device as well.

On the pi I would suspect this might be due to not having quite enough power for the drive during some operations.

It's possible you might find something useful in dmesg when this happens (try "dmesg -T" to get useful times rather than a timestamp value)

cgjamj
Posts: 14
Joined: Fri Nov 25, 2016 3:49 pm

Re: USB drive randomly auto-mounting

Fri Mar 10, 2017 4:10 pm

Hey, I haven't had much time to mess with it this week, but the issue is still happening and growing more frustrating as it seems to be happening at an increasing level. I tried the "dmesg -T" command and here is the output...

Code: Select all

[Fri Mar 10 15:50:06 2017] usb 1-1.2: USB disconnect, device number 57
[Fri Mar 10 15:50:06 2017] usb 1-1.2.3: USB disconnect, device number 58
[Fri Mar 10 15:50:06 2017] sd 15:0:0:0: [sda] Synchronizing SCSI cache
[Fri Mar 10 15:50:06 2017] sd 15:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=0x01 driverbyte=0x00
[Fri Mar 10 15:50:07 2017] usb 1-1.2: new high-speed USB device number 59 using dwc_otg
[Fri Mar 10 15:50:07 2017] usb 1-1.2: New USB device found, idVendor=0bda, idProduct=5401
[Fri Mar 10 15:50:07 2017] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[Fri Mar 10 15:50:07 2017] usb 1-1.2: Product: USB3.0 Hub
[Fri Mar 10 15:50:07 2017] usb 1-1.2: Manufacturer: Realtek
[Fri Mar 10 15:50:07 2017] hub 1-1.2:1.0: USB hub found
[Fri Mar 10 15:50:07 2017] hub 1-1.2:1.0: 4 ports detected
[Fri Mar 10 15:50:07 2017] usb 1-1.2.3: new high-speed USB device number 60 using dwc_otg
[Fri Mar 10 15:50:07 2017] usb 1-1.2.3: New USB device found, idVendor=0bc2, idProduct=ab24
[Fri Mar 10 15:50:07 2017] usb 1-1.2.3: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[Fri Mar 10 15:50:07 2017] usb 1-1.2.3: Product: BUP Slim BK
[Fri Mar 10 15:50:07 2017] usb 1-1.2.3: Manufacturer: Seagate
[Fri Mar 10 15:50:07 2017] usb 1-1.2.3: SerialNumber: NA7Y2E91
[Fri Mar 10 15:50:07 2017] usb-storage 1-1.2.3:1.0: USB Mass Storage device detected
[Fri Mar 10 15:50:07 2017] scsi host16: usb-storage 1-1.2.3:1.0
[Fri Mar 10 15:50:08 2017] scsi 16:0:0:0: Direct-Access     Seagate  BUP Slim BK      0304 PQ: 0 ANSI: 6
[Fri Mar 10 15:50:08 2017] sd 16:0:0:0: Attached scsi generic sg0 type 0
[Fri Mar 10 15:50:08 2017] sd 16:0:0:0: [sdb] 3907029167 512-byte logical blocks: (2.00 TB/1.82 TiB)
[Fri Mar 10 15:50:09 2017] sd 16:0:0:0: [sdb] Write Protect is off
[Fri Mar 10 15:50:09 2017] sd 16:0:0:0: [sdb] Mode Sense: 4f 00 00 00
[Fri Mar 10 15:50:09 2017] sd 16:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[Fri Mar 10 15:50:09 2017]  sdb: sdb1
[Fri Mar 10 15:50:09 2017] sd 16:0:0:0: [sdb] Attached SCSI disk
Any advice? This is getting to the point of making my RPi as a media server unusable.

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: USB drive randomly auto-mounting

Sun Mar 12, 2017 2:43 am

cgjamj wrote:Hey, I haven't had much time to mess with it this week, but the issue is still happening and growing more frustrating as it seems to be happening at an increasing level. I tried the "dmesg -T" command and here is the output...

Code: Select all

[Fri Mar 10 15:50:06 2017] usb 1-1.2: USB disconnect, device number 57
[Fri Mar 10 15:50:06 2017] usb 1-1.2.3: USB disconnect, device number 58
Any advice? This is getting to the point of making my RPi as a media server unusable.
That would seem to suggest it's getting disconnected from usb. The first thing I'd check is whether there's enough power for the drive.

Is the drive on a USB hub or direct into the pi?

If it's in a usb hub, is the hub powered ?
If it's direct into the pi do you get the lightening bolt icon on the screen or see the red led go off?
Which model of pi is it?

schadha
Posts: 7
Joined: Sun Dec 14, 2014 8:23 am

Re: USB drive randomly auto-mounting

Thu Nov 22, 2018 6:47 pm

> If it's direct into the pi do you get the lightening bolt icon on the screen or see the red led go off?

We see this "lightening bolt icon" on the screen all the time. What doe s this signify?

Return to “Troubleshooting”