Dazzathedrummer
Posts: 52
Joined: Sat Mar 26, 2016 9:04 am

Trouble with external drive

Tue Apr 07, 2020 9:44 am

Hi,

I have a 2TB WD Passport drive plugged into my 3B that I mainly use for ripping my CD collection to.

I used OMV for a few years but found it un-reliable when running Plex so now I simply use the Pi as a headless desktop with the external drive as a network share - it's been working fine for a while until I started to write/permission issue.
After reading around I found that I wasn't mounting the drive properly so I followed the instructions here...
https://www.raspberrypi.org/documentati ... storage.md
...to set up a proper mount.

This worked fine for a couple of days but now I'm getting error messages when trying to rip CDs from my Mac to the Pi's external drive.
On closer inspection of the Pi (via VNC), I can see the drives folder structure in \mtn\ but none of the album folders contain files except for the last two albums I ripped.

I read somewhere that this is because the drive isn't mounting properly and the folder structure is being replicated elsewhere (so the files are still on the external drive).

I've tried rebooting several times and also booting without the drive attached followed by manually mounting the drive, but I can't ever see the files in the folders.

When the drive is plugged in the led doesn't go out (which isn't normal) and if I try and 'umount' I get 'target is busy'.

I'm thinking I've either setup fstab wrong or the drive has failed - how can I check?

meesha
Posts: 7
Joined: Sat Mar 28, 2020 7:08 pm

Re: Trouble with external drive

Tue Apr 07, 2020 11:53 am

I'd check first if the drive is properly seen by the pi by typing:

Code: Select all

sudo fdisk -l
which will print out all the drives and their partitions - see if you can find it there.

Then, just type

Code: Select all

mount | grep /dev/sd
(where you can substitute /dev/sd by the drive designation you found earlier) and check if is mounted at all, and if yes, where.

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

Re: Trouble with external drive

Tue Apr 07, 2020 11:57 am

Dazzathedrummer wrote:
Tue Apr 07, 2020 9:44 am
I'm thinking I've either setup fstab wrong
What error messages are you getting?

Start by sharing your fstab with us.

Also post the output of

Code: Select all

mount|grep /mnt
Try looking fro errors in /var/syslog and/or the output from

Code: Select all

dmesg
If I had to guess, and at this stage it is only a guess, the mount has failed and your recent rips have been to the SD card.
Attempts to contact me outside of these forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

Dazzathedrummer
Posts: 52
Joined: Sat Mar 26, 2016 9:04 am

Re: Trouble with external drive

Tue Apr 07, 2020 1:57 pm

Weird - everything seems to be working now!! ...all the files are back.

Just incase there's an underlying problem - this is what I'm getting from those suggestions...

Code: Select all

mount|grep /mnt
gives me this...

Code: Select all

[email protected]:~ $ mount|grep /mnt
/dev/sda1 on /mnt/DazDrive2 type ext4 (rw,nosuid,nodev,noexec,relatime)

This is what I've got in fstab...

Code: Select all

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p6  /boot           vfat    defaults          0       2
/dev/mmcblk0p7  /               ext4    defaults,noatime  0       1
UUID=8981bfb4-7a81-412c-9ba4-f8232f1b0940 /mnt/DazDrive2 ext4 defaults,auto,users,rw,nofail 0 0
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
Among other stuff I've got the following in the output of dmesg...

Code: Select all

[    9.207768] sd 0:0:0:0: [sda] 3906963456 512-byte logical blocks: (2.00 TB/1.82 TiB)
[    9.208169] sd 0:0:0:0: [sda] Write Protect is off
[    9.208184] sd 0:0:0:0: [sda] Mode Sense: 47 00 10 08
[    9.208622] sd 0:0:0:0: [sda] No Caching mode page found
[    9.208635] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    9.266498]  sda: sda1
[    9.908967] EXT4-fs (sda1): warning: mounting fs with errors, running e2fsck is recommended
[   10.484356] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
I'm also seeing 'Under-voltage detected! (0x0050005)' - I can post the whole lot up if that would make more sense.

meesha
Posts: 7
Joined: Sat Mar 28, 2020 7:08 pm

Re: Trouble with external drive

Tue Apr 07, 2020 3:44 pm

Be sure that on the hub that you are connecting the drive to, the other socket is empty. If it is this way and undervoltage warnings still occur, you need an active usb hub to power the drive properly.

Dazzathedrummer
Posts: 52
Joined: Sat Mar 26, 2016 9:04 am

Re: Trouble with external drive

Tue Apr 07, 2020 3:54 pm

meesha wrote:
Tue Apr 07, 2020 3:44 pm
Be sure that on the hub that you are connecting the drive to, the other socket is empty. If it is this way and undervoltage warnings still occur, you need an active usb hub to power the drive properly.
That makes sense - but the external drive is plugged straight into the Rpi.

I double check that the Rpi power supply is the correct rating for a Pi3b.

meesha
Posts: 7
Joined: Sat Mar 28, 2020 7:08 pm

Re: Trouble with external drive

Tue Apr 07, 2020 4:16 pm

I meant the other thing. There you have four usb sockets in the pi - paired in two, vertical. In my pi b+, you can connect two ssds in usb enclosures, without additional power, only provided that they are connected to separate "hubs". In other words - drives connected horizontal side by side work, but not vertical. Otherwise none of the can be seen by the unit. Pi's are just so ***** regarding internal power distribution, and the actual power supply may be the best in the world, and the unit would still fail.

So, be sure that the drive is the only unit connected to a vertical "hub", and if the problem persists, I suggest using an active external hub.

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

Re: Trouble with external drive

Tue Apr 07, 2020 5:32 pm

meesha wrote:
Tue Apr 07, 2020 4:16 pm
I meant the other thing. There you have four usb sockets in the pi - paired in two, vertical. In my pi b+, you can connect two ssds in usb enclosures, without additional power, only provided that they are connected to separate "hubs". In other words - drives connected horizontal side by side work, but not vertical. Otherwise none of the can be seen by the unit. Pi's are just so ***** regarding internal power distribution, and the actual power supply may be the best in the world, and the unit would still fail.

So, be sure that the drive is the only unit connected to a vertical "hub", and if the problem persists, I suggest using an active external hub.
That's incorrect and irrelavent to a Pi.

On any Pi power is common between all USB ports no per port limiting is done.

Secondly, all 4 ports are connected to the same USB hub (not on the 4B, but we're talking about a 3B here). The physical ports are not USB hubs, they're just ports.

If you really have a B+ not a 2B/3B/3B+/4B, have you added the "max_usb_current=1" to your config.txt?

Your observed behaviour strikes me as odd. I'd expect things to work in any combination of ports, I doubt it's a power issue. It may be that your USB to SATA dongles/chipsets appear to the system as identical and it can't seperate them when in ports that are next to each other on the bus (e.g. ports 1.1 and 1.2) but can if there is a gap.

@Dazzathedrummer

What is the rating on your power supply?
Is it a PSU or is it a charger? Yes it makes a difference. Regulation is poorer on a charger so voltage will drop more as load increases.

It could be that the external drive doesn't spin up in time and because you've included "nofail" in your mount options the system just logs that it didn't mount and carries on. One possible indicator of this would be if the mount fails on a cold start (i.e. booting when power is first applied) but succeeds on a warm reboot.
Attempts to contact me outside of these forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

meesha
Posts: 7
Joined: Sat Mar 28, 2020 7:08 pm

Re: Trouble with external drive

Tue Apr 07, 2020 8:27 pm

thagrol wrote:
Tue Apr 07, 2020 5:32 pm
That's incorrect and irrelavent to a Pi.

On any Pi power is common between all USB ports no per port limiting is done.

Secondly, all 4 ports are connected to the same USB hub (not on the 4B, but we're talking about a 3B here). The physical ports are not USB hubs, they're just ports.

If you really have a B+ not a 2B/3B/3B+/4B, have you added the "max_usb_current=1" to your config.txt?

Your observed behaviour strikes me as odd. I'd expect things to work in any combination of ports, I doubt it's a power issue. It may be that your USB to SATA dongles/chipsets appear to the system as identical and it can't seperate them when in ports that are next to each other on the bus (e.g. ports 1.1 and 1.2) but can if there is a gap.
I do wish it was incorrect. And there's a reason I used the term hub in quotes. Ok, it is a separate double section then, but both have separate power rails. Otherwise it is not electrically explainable. I own my rpi for over 5 years, have a plethora of different usb enclosures, and know how it behaves in certain scenarios.

The suggestion for max usb current was the first one to be tried out by me back then, but it doesn't really make a difference. At least it is overrated for what it should do. And I was never going cheap in terms of power supply. Heck, even the latest rpi 4b has some power quirks - some of them were addressed, some still persist. It is not even funny anymore.

Regarding the OP - we have here a WD Passport, probably with hdd inside, with unknown rotation speed. Sometimes it works, sometimes it doesn't, the power it draws from the pi is borderline for the unit. I can risk a statement that better PSU for the pi won't do much better - what would help is additional power via active hub.

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

Re: Trouble with external drive

Tue Apr 07, 2020 10:45 pm

meesha wrote:
Tue Apr 07, 2020 8:27 pm
thagrol wrote:
Tue Apr 07, 2020 5:32 pm
That's incorrect and irrelavent to a Pi.

On any Pi power is common between all USB ports no per port limiting is done.

Secondly, all 4 ports are connected to the same USB hub (not on the 4B, but we're talking about a 3B here). The physical ports are not USB hubs, they're just ports.

If you really have a B+ not a 2B/3B/3B+/4B, have you added the "max_usb_current=1" to your config.txt?

Your observed behaviour strikes me as odd. I'd expect things to work in any combination of ports, I doubt it's a power issue. It may be that your USB to SATA dongles/chipsets appear to the system as identical and it can't seperate them when in ports that are next to each other on the bus (e.g. ports 1.1 and 1.2) but can if there is a gap.
I do wish it was incorrect. And there's a reason I used the term hub in quotes. Ok, it is a separate double section then, but both have separate power rails. Otherwise it is not electrically explainable.
Your usage of the term hub, quoted or not, is likely to cause confusion.

As I said it may not solely be electrical. It may be. It may be specific to the board you have. Given that there is no per port limitation on any Pi, I'd be surprised if the traces couldn't handle the full 1.2A. It could also be related to the quality of wring in your USB to SATA dongles. I don't have a schematic to check. Even if I did I've no idea if the trace widths would be specified on it.
I own my rpi for over 5 years, have a plethora of different usb enclosures, and know how it behaves in certain scenarios.
I've been using Pi since shortly after launch so eight years. But lets not start comparing genitailia.

I guess your experience has been different to mine.
The suggestion for max usb current was the first one to be tried out by me back then, but it doesn't really make a difference. At least it is overrated for what it should do. And I was never going cheap in terms of power supply. Heck, even the latest rpi 4b has some power quirks - some of them were addressed, some still persist. It is not even funny anymore.

Regarding the OP - we have here a WD Passport, probably with hdd inside, with unknown rotation speed.
A web search for "2TB WD Passport" returns several options. They're all HDD (not SSD), 5400rpm, and bus powered.
Sometimes it works, sometimes it doesn't, the power it draws from the pi is borderline for the unit. I can risk a statement that better PSU for the pi won't do much better - what would help is additional power via active hub.
The fact that it's been described as an intermittant issue is why I asked the OP about warm vs cold start behaviour. HDD draw most current when first spinning up.

It's been my experience that a single 2.5" HDD is fine when used directly with a Pi. Provided the PSU is well regulated and provides sufficient current.

First I'd try better quality cables. Both between the PSU and the Pi and between Pi and HDD. Next I'd try the official PSU. Only then would I try a self powered (I assume that's what you meant by "active". All USB hubs are active devices) USB hub. And I'd make sure it was one from a reputable manufacturer.
Attempts to contact me outside of these forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

Dazzathedrummer
Posts: 52
Joined: Sat Mar 26, 2016 9:04 am

Re: Trouble with external drive

Wed Apr 08, 2020 10:25 am

Ok, so I've checked the PSU for the Pi - It's not a charger its a 5v 2500mA PSU (I think it's from Pi Hut).

I've now plugged in a powered USB hub (the black seven port one from Pi Hut) - there's nothing else plugged into it or the other USB's on the Pi (there never was anyone else plugged in).

I've powered up the USB hub before plugging it into the Pi so it's already fired up.

Seems to be working fine - but I'll monitor it to see how it goes.
If you really have a B+ not a 2B/3B/3B+/4B, have you added the "max_usb_current=1" to your config.txt?
Its a Pi3 model B rev 1.2
It could be that the external drive doesn't spin up in time and because you've included "nofail" in your mount options the system just logs that it didn't mount and carries on. One possible indicator of this would be if the mount fails on a cold start (i.e. booting when power is first applied) but succeeds on a warm reboot.
This is as per the suggestion on the RPi documentation page - is there a better option?

Return to “Troubleshooting”