bolsen27
Posts: 6
Joined: Thu Jan 12, 2017 4:26 am

Mounting External Hard Drive

Fri Jan 20, 2017 1:59 pm

Good morning all. Sorry to bother you all with what I am sure is the same question being asked for the 1000th time. But I'm having some serious issues trying to mount my external hard drive to my pie.

I have my plex server up and running on it and now I just need the hard drive part done.. the problem I'm having is the when I connect the hard drive to the Pi it auto mounts in /media/pi and not in /mnt folder.. nothing I've tried has worked to get it to the right folder.

My goal is to get it mounted then set it up so it can be seen across my network so I can add files to it from my laptop.

The hard drive is a Toshiba canvio desktop 3tb and it is formatted as ntfs.

Any ideas?

SurferTim
Posts: 1772
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Mounting External Hard Drive

Fri Jan 20, 2017 2:09 pm

Use a text editor to open /etc/usbmount/usbmount.conf. Check out MOUNTPOINTS.

bolsen27
Posts: 6
Joined: Thu Jan 12, 2017 4:26 am

Re: Mounting External Hard Drive

Fri Jan 20, 2017 5:50 pm

No go with that. Nothing shows up.

SurferTim
Posts: 1772
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Mounting External Hard Drive

Fri Jan 20, 2017 9:29 pm

I got my 2TB usb drive to mount in /mnt with this.

Code: Select all

$ sudo mount /dev/sda1 /mnt
edit: I got it to mount and allow access with this. Set up the directory to mount it to:

Code: Select all

sudo mkdir /mnt/usb
sudo chown -R pi:pi /mnt/usb
sudo chmod -R 775 /mnt/usb
sudo setfacl -Rdm g:pi:rwx /mnt/usb
sudo setfacl -Rm g:pi:rwx /mnt/usb
Them mount it.

Code: Select all

sudo mount -o uid=pi,gid=pi /dev/sda1 /mnt/usb

peterlite
Posts: 720
Joined: Sun Apr 17, 2016 4:00 am

Re: Mounting External Hard Drive

Fri Jan 20, 2017 11:10 pm

The problem may be the USB chip. Use a different enclosure for the disk or debug the USB. Use lsusb to see what device is attached. if using lsusb for the first time, run lsusb before plugging the disk in then again after you plug in the disk. There should be an extra line for the disk. You cab then search for problems with USB disks using the device model or USB id.

User avatar
thagrol
Posts: 3496
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Mounting External Hard Drive

Fri Jan 20, 2017 11:54 pm

Add a suitable entry in /etc/fstab and (re)boot with the drive attached.

Is your pi running headless or is it booting into a graphical desktop? From what you describe, I suspect you're getting the behaviour expected from the desktop's auto mounter.

Putting an entry in /etc/fstab and having the drive connected at boot time should see it mounted before the desktop gets started.

I'm mounting a 3TB hdd on debian with this entry in /etc/fstab:

Code: Select all

UUID=46061E60061E50F3   /media/shared   ntfs    defaults        0       0
SATA rather than USB but that shouldn't make a difference.

Edit: You'll need to substitute appropriate values for UUID and the mount point to match your requirements.

Code: Select all

sudo blkid
with the HDD connected should give you the UUID.
Arguing with strangers on the internet since 1993.

deep86
Posts: 4
Joined: Thu Feb 16, 2017 6:58 pm

Re: Mounting External Hard Drive

Fri Feb 17, 2017 3:49 am

Hello folks. I'm actually having the same problem as the OP. I've run my Pi with the same hard drive before with no trouble, but due to a configuration snafu, I've had to start from scratch with everything. I actually reformatted the hard drive (separate power source) just to make sure everything was clean, but once I plugged it into the Pi, it auto mounted to /media/Pi/[the UUID]. When I run:
sudo blkid
I get this: https://www.dropbox.com/s/lkcagg1nc1o36 ... 8.jpg?dl=0

Then when I unmount and run (the dir name is 'cause I'm running a music server):
sudo mount -t vfat -o uid=pi,gid=pi /dev/sda1 /media/funkhub
I get this: https://www.dropbox.com/s/4hn3hkq16gmjl ... 2.jpg?dl=0

I tried @thagrol's suggestion, and while that avoided the auto booting to /media/pi, the drive didn't show up at that point, though running sudo blkid showed that sda1 was in use.

Any help you could provide at all would be good. I'm halfway thinking that it might be an issue of permissions, but I'm totally unsure and it's frustrating as all hell.

User avatar
thagrol
Posts: 3496
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Mounting External Hard Drive

Fri Feb 17, 2017 10:45 am

Couple of things:

Your blkid output doesn't show a /dev/sda1 it does show a /dev/sdb1

Your blkid output shows /dev/sdb1 as ntfs but you're trying to mount it as vfat.

Try

Code: Select all

sudo mount -t ntfs -o uid=pi,gid=pi /dev/sdb1 /media/funkhub
instead.
Arguing with strangers on the internet since 1993.

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

Re: Mounting External Hard Drive

Fri Feb 17, 2017 12:26 pm

Linux assigns disk designators as it finds the disks, so a disk will not always show up as the same sda or sdb as it did the last time you plugged it in.
It is one of Linux's little quirks. That is why you should use the disk id in your fstab file. :)

deep86
Posts: 4
Joined: Thu Feb 16, 2017 6:58 pm

Re: Mounting External Hard Drive

Fri Feb 17, 2017 3:40 pm

@thagrol

Thank you for the reply. The screen grabs were from a few tries prior to my last attempt, when it was showing sda1 rather than sdb1, I used the appropriate line, but uploaded the wrong pics. As for the file format, when I attempt to use ntfs in the line, I get an invalid file system error.

deep86
Posts: 4
Joined: Thu Feb 16, 2017 6:58 pm

Re: Mounting External Hard Drive

Fri Feb 17, 2017 5:18 pm

Alright, found my error. Apparently, ntfs-3g wasn't installed. For anyone else running into an issue, if you're getting:

Code: Select all

mount: unknown filesystem type 'ntfs-3g'
Install ntfs-3g by running:

Code: Select all

sudo apt-get install ntfs-3g
The first time I set my Pi up just running the initial upgrades seemingly took care of that I thought, but maybe it slipped my mind.

In any case, thanks for jumping in and listening. :)

RichHaynes
Posts: 45
Joined: Sat Jul 16, 2016 12:23 pm
Location: Stoke-On-Trent

Re: Mounting External Hard Drive

Sat Feb 18, 2017 9:19 pm

Hi everyone,

I know the OP has done what he wants to do but I think some further information might help others with this.

Now the OP has mounted the drive in /mnt this stops the auto mounting from occuring as it recognises the drive as already being mounted. This is the same result if you add an entry in fstab. The boot mount prevents any automount.

But, the reason the auto mount occurs, and which hasnt been explained here, is down to the file manager PCManFM. The file manager is the program causing the automount in /media/pi. To prevent automounts, do the following:
  1. Open the filemanager. Easiest way is click Menu, Accessories, File Manager
  2. Click on Edit, then click Preferences
  3. In the menu on the left, select Volume Management
  4. Untick the option Mount removable media automatically when they are inserted
This will prevent any further autmounts but note that from now on, ALL hard drives, pen drives, card readers etc. will need to be manually mounted (sudo mount) or using fstab to mount on boot (ALWAYS use UUIDs for this to prevent issues with drives designations).

Hope that helps someone out there!
Main Computer: RPi3
BOINC Server: RPi2
Torrent Box: RPi2 + 2TB WD Green HDD via USB Dock
Web + Email Server: RPi2
Home Automation Server: RPi2 + Edimax EW-7811Un
Decomissioned: 2 x RPi Model B

deep86
Posts: 4
Joined: Thu Feb 16, 2017 6:58 pm

Re: Mounting External Hard Drive

Sat Feb 18, 2017 11:16 pm

Thanks for chiming in! I know in my case, I was definitely looking for a setting to keep that from happening to begin with. Don't know why I didn't think to check the file manager, heh. I'll certainly keep it in mind for the future.

RichHaynes
Posts: 45
Joined: Sat Jul 16, 2016 12:23 pm
Location: Stoke-On-Trent

Re: Mounting External Hard Drive

Sat Feb 18, 2017 11:34 pm

deep86 wrote:Thanks for chiming in! I know in my case, I was definitely looking for a setting to keep that from happening to begin with. Don't know why I didn't think to check the file manager, heh. I'll certainly keep it in mind for the future.
When it first happened to me, I just assumed automount would be a kernal thing. I ignored it for a while and as I was changin some preferences, I found the volume management section in file manager and my prayers were answered! Im lucky I remembered it though as Ive set that once about two years ago and never thought about it until today. every additional Pi ive had since has been headless so no file manager, no automounts :)
Main Computer: RPi3
BOINC Server: RPi2
Torrent Box: RPi2 + 2TB WD Green HDD via USB Dock
Web + Email Server: RPi2
Home Automation Server: RPi2 + Edimax EW-7811Un
Decomissioned: 2 x RPi Model B

bweaver2021
Posts: 1
Joined: Wed Oct 17, 2018 12:37 am

Re: Mounting External Hard Drive

Wed Oct 17, 2018 1:13 am

I get this error when tying to use a USB Storage device. Any guidance is appreciated. I get a similar error with an external hard drive.

Error mounting /dev/sda1 at /media/pi/76E8-CACF: Command-line `mount -t "exfat" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,iocharset=utf8,namecase=0,errors=remount-ro" "/dev/sda1" "/media/pi/76E8-CACF"' exited with non-zero exit status 32: mount: unknown filesystem type 'exfat'

Return to “Troubleshooting”