External HDD causes problems

Hello together!

I’ve been having a problem with my Dietpi installation since about yesterday.
For about two months the setup ran exactly as it should.

Suddenly, however, the attached USB hard drive was no longer recognized. It is a 5TB from Western Digital without external power supply (suboptimal, I know).

I have tried everything in the meantime. Backups, reinstalled Dietpi, backed up the entire disk and formatted it from NTFS to ext4 - nothing helps. When I plug the disk into my PC, it is recognized by both WIndows and Linux. A check of the hardware did not bring up any errors either. Also the SD card, from which the Raspberry boots, was checked and seems to be error free.
But when I attach the empty disk to my fresh Dietpi system and start the Device Manager, it loads the partitions of the SD card very fast and then nothing happens. For a long time the process seems to stand still until it eventually ends and the disk does not show up. I’m starting to get completely confused and hope some experienced users might be able to offer some advice.

I am using the latest version of Dietpi on a Raspberry 3b+ and the whole thing is running headless over Ethernet connectivity.

Edit: After waiting about 15 minutes, the disk was recognized this time, but supposedly needed to be formatted. This process has now apparently crashed as well. The “moving dots” are frozen and the process is listed in htop, but does not consume any resources.

Thanks in advance for your help!

Sunflex

I highly recommend to use an external PSU for your HDD. The power provided by the PRi is definitely not sufficient to operate a HDD savely. You could easily run into voltage issues on peak times.

You could have a look to kernel error messages once your HDD is failing.

dmesg -l err,crit,alert,emerg

Yes I know. The disk always ran great (as it did recently on the Pi) and I was a little too stingy to buy one with an external PSU anyway.

However, I have already ordered a new disk (this time with external PSU ;D).
After running the command you posted, I get the following output:

root@DietPi:~# dmesg -l err,crit,alert,emerg
[    7.804474] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    8.121537] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    8.130572] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    8.130725] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[    8.132043] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Oct 22 2019 01:59:28 version 7.45.98.94 (r723000 CY) FWID 01-3b33decd
[    9.092004] Under-voltage detected! (0x00050005)
[   72.684132] raspberrypi-firmware soc:firmware: Request 0x00048003 returned status 0x80000001
[   72.684160] bcm2708_fb soc:fb: Failed to allocate GPU framebuffer (-22)
[   72.684178] bcm2708_fb_pan_display(0,0) returns=-22
[   88.602214] raspberrypi-firmware soc:firmware: Request 0x00048003 returned status 0x80000001
[   88.602240] bcm2708_fb soc:fb: Failed to allocate GPU framebuffer (-22)
[   88.602258] bcm2708_fb_pan_display(0,0) returns=-22
[  593.740699] Under-voltage detected! (0x00050005)
[  601.804875] Under-voltage detected! (0x00050005)
[  628.013456] Under-voltage detected! (0x00050005)
[  734.706502] sd 0:0:0:0: [sda] No Caching mode page found
[  734.706525] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  967.668837] INFO: task kworker/u8:3:2408 blocked for more than 120 seconds.
[  967.668921]       Not tainted 5.10.63-v8+ #1459
[  967.668937] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1016.470887] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[ 1016.471114] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[ 1016.471155] Buffer I/O error on dev sda, logical block 0, async page read
[ 1069.195784] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[ 1069.195812] Buffer I/O error on dev sda, logical block 0, async page read
[ 1069.210995] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[ 1069.211034] Buffer I/O error on dev sda, logical block 0, async page read
[26915.205315] Under-voltage detected! (0x00050005)
[27022.218266] sd 0:0:0:0: [sda] No Caching mode page found
[27022.218290] sd 0:0:0:0: [sda] Assuming drive cache: write through
[27303.815858] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[27303.815996] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[27303.816023] Buffer I/O error on dev sda, logical block 0, async page read
[27430.448463] INFO: task kworker/u8:3:2408 blocked for more than 120 seconds.
[27430.448493]       Not tainted 5.10.63-v8+ #1459
[27430.448508] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[27430.449315] INFO: task blkid:5454 blocked for more than 120 seconds.
[27430.449332]       Not tainted 5.10.63-v8+ #1459
[27430.449347] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[27484.318080] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[27484.318303] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[27484.318342] Buffer I/O error on dev sda, logical block 0, async page read
[27551.283130] INFO: task blkid:5454 blocked for more than 241 seconds.
[27551.283154]       Not tainted 5.10.63-v8+ #1459
[27551.283180] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[27664.420317] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[27664.420539] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[27664.420591] Buffer I/O error on dev sda, logical block 0, async page read
[27844.572561] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[27844.572782] blk_update_request: I/O error, dev sda, sector 9767475072 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
[28025.974823] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[28025.975038] blk_update_request: I/O error, dev sda, sector 9767475072 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[28025.975091] Buffer I/O error on dev sda, logical block 1220934384, async page read
[28274.591327] sd 0:0:0:0: [sda] Asking for cache data failed
[28274.591349] sd 0:0:0:0: [sda] Assuming drive cache: write through
[28382.740969] sd 0:0:0:0: [sda] No Caching mode page found
[28382.740993] sd 0:0:0:0: [sda] Assuming drive cache: write through
[28638.794589] INFO: task kworker/u8:3:2408 blocked for more than 120 seconds.
[28638.794672]       Not tainted 5.10.63-v8+ #1459
[28638.794688] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[28663.898030] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[28663.898168] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[28663.898195] Buffer I/O error on dev sda, logical block 0, async page read
[28759.629196] INFO: task blkid:6452 blocked for more than 120 seconds.
[28759.629221]       Not tainted 5.10.63-v8+ #1459
[28759.629237] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[28844.050339] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[28844.050565] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[28844.050604] Buffer I/O error on dev sda, logical block 0, async page read
[28880.463831] INFO: task blkid:6452 blocked for more than 241 seconds.
[28880.463856]       Not tainted 5.10.63-v8+ #1459
[28880.463935] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[29001.298474] INFO: task kworker/u8:3:2408 blocked for more than 120 seconds.
[29001.298498]       Not tainted 5.10.63-v8+ #1459
[29001.298513] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[29001.299391] INFO: task blkid:6452 blocked for more than 362 seconds.
[29001.299408]       Not tainted 5.10.63-v8+ #1459
[29001.299422] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[29026.002594] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[29026.002831] blk_update_request: I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[29026.002871] Buffer I/O error on dev sda, logical block 0, async page read
[29206.254973] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[29206.255186] blk_update_request: I/O error, dev sda, sector 9767475072 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
[29386.507224] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[29386.507459] blk_update_request: I/O error, dev sda, sector 9767475072 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[29386.507499] Buffer I/O error on dev sda, logical block 1220934384, async page read
[29926.568051] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[29926.568205] blk_update_request: I/O error, dev sda, sector 0 op 0x1:(WRITE) flags 0x4800 phys_seg 30 prio class 0
[29926.568231] Buffer I/O error on dev sda, logical block 0, lost async page write
[29926.568289] Buffer I/O error on dev sda, logical block 1, lost async page write
[29926.568323] Buffer I/O error on dev sda, logical block 2, lost async page write
[29926.568355] Buffer I/O error on dev sda, logical block 3, lost async page write
[29926.568388] Buffer I/O error on dev sda, logical block 4, lost async page write
[29926.568420] Buffer I/O error on dev sda, logical block 5, lost async page write
[29926.568453] Buffer I/O error on dev sda, logical block 6, lost async page write
[29926.568485] Buffer I/O error on dev sda, logical block 7, lost async page write
[29926.568518] Buffer I/O error on dev sda, logical block 8, lost async page write
[29926.568550] Buffer I/O error on dev sda, logical block 9, lost async page write
[29967.975294] INFO: task kworker/u8:0:6578 blocked for more than 120 seconds.
[29967.975324]       Not tainted 5.10.63-v8+ #1459
[29967.975339] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[30108.370409] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[30108.370553] blk_update_request: I/O error, dev sda, sector 240 op 0x1:(WRITE) flags 0x4800 phys_seg 30 prio class 0
[30108.370586] Buffer I/O error on dev sda, logical block 30, lost async page write
[30108.370645] Buffer I/O error on dev sda, logical block 31, lost async page write
[30108.370691] Buffer I/O error on dev sda, logical block 32, lost async page write
[30108.370724] Buffer I/O error on dev sda, logical block 33, lost async page write
[30108.370757] Buffer I/O error on dev sda, logical block 34, lost async page write
[30108.370790] Buffer I/O error on dev sda, logical block 35, lost async page write
[30108.370822] Buffer I/O error on dev sda, logical block 36, lost async page write
[30108.370855] Buffer I/O error on dev sda, logical block 37, lost async page write
[30108.370888] Buffer I/O error on dev sda, logical block 38, lost async page write
[30108.370920] Buffer I/O error on dev sda, logical block 39, lost async page write
[30290.018887] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[30290.019035] blk_update_request: I/O error, dev sda, sector 480 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 0
[30290.019068] Buffer I/O error on dev sda, logical block 60, lost async page write
[30471.825105] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[30471.825242] blk_update_request: I/O error, dev sda, sector 488 op 0x1:(WRITE) flags 0x104000 phys_seg 30 prio class 0
[30471.825268] Buffer I/O error on dev sda, logical block 61, lost async page write
[30471.825327] Buffer I/O error on dev sda, logical block 62, lost async page write
[30471.825361] Buffer I/O error on dev sda, logical block 63, lost async page write
[30471.825394] Buffer I/O error on dev sda, logical block 64, lost async page write
[30471.825438] Buffer I/O error on dev sda, logical block 65, lost async page write
[30471.825471] Buffer I/O error on dev sda, logical block 66, lost async page write
[30471.825504] Buffer I/O error on dev sda, logical block 67, lost async page write
[30471.825536] Buffer I/O error on dev sda, logical block 68, lost async page write
[30471.825568] Buffer I/O error on dev sda, logical block 69, lost async page write
[30471.825601] Buffer I/O error on dev sda, logical block 70, lost async page write
[30652.673544] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[30652.673701] blk_update_request: I/O error, dev sda, sector 728 op 0x1:(WRITE) flags 0x100000 phys_seg 1 prio class 0
[30652.673734] Buffer I/O error on dev sda, logical block 91, lost async page write
[30833.629770] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[30833.630033] blk_update_request: I/O error, dev sda, sector 736 op 0x1:(WRITE) flags 0x4800 phys_seg 30 prio class 0
[30833.630071] Buffer I/O error on dev sda, logical block 92, lost async page write
[30833.630142] Buffer I/O error on dev sda, logical block 93, lost async page write
[30833.630202] Buffer I/O error on dev sda, logical block 94, lost async page write
[30833.630250] Buffer I/O error on dev sda, logical block 95, lost async page write
[30833.630296] Buffer I/O error on dev sda, logical block 96, lost async page write
[30833.630342] Buffer I/O error on dev sda, logical block 97, lost async page write
[30833.630389] Buffer I/O error on dev sda, logical block 98, lost async page write
[30833.630435] Buffer I/O error on dev sda, logical block 99, lost async page write
[30833.630481] Buffer I/O error on dev sda, logical block 100, lost async page write
[30833.630527] Buffer I/O error on dev sda, logical block 101, lost async page write
[31015.606154] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[31015.606374] blk_update_request: I/O error, dev sda, sector 976 op 0x1:(WRITE) flags 0x4800 phys_seg 30 prio class 0
[31015.606433] Buffer I/O error on dev sda, logical block 122, lost async page write
[31015.606503] Buffer I/O error on dev sda, logical block 123, lost async page write
[31015.606562] Buffer I/O error on dev sda, logical block 124, lost async page write
[31015.606610] Buffer I/O error on dev sda, logical block 125, lost async page write
[31015.606656] Buffer I/O error on dev sda, logical block 126, lost async page write
[31015.606703] Buffer I/O error on dev sda, logical block 127, lost async page write
[31015.606748] Buffer I/O error on dev sda, logical block 128, lost async page write
[31015.606795] Buffer I/O error on dev sda, logical block 129, lost async page write
[31015.606841] Buffer I/O error on dev sda, logical block 130, lost async page write
[31015.606887] Buffer I/O error on dev sda, logical block 131, lost async page write
[31197.384405] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[31197.384635] blk_update_request: I/O error, dev sda, sector 1216 op 0x1:(WRITE) flags 0x4800 phys_seg 30 prio class 0
[31197.384708] Buffer I/O error on dev sda, logical block 152, lost async page write
[31197.384784] Buffer I/O error on dev sda, logical block 153, lost async page write
[31197.384834] Buffer I/O error on dev sda, logical block 154, lost async page write
[31197.384883] Buffer I/O error on dev sda, logical block 155, lost async page write
[31197.384929] Buffer I/O error on dev sda, logical block 156, lost async page write
[31197.384976] Buffer I/O error on dev sda, logical block 157, lost async page write
[31197.385023] Buffer I/O error on dev sda, logical block 158, lost async page write
[31197.385070] Buffer I/O error on dev sda, logical block 159, lost async page write
[31197.385117] Buffer I/O error on dev sda, logical block 160, lost async page write
[31197.385164] Buffer I/O error on dev sda, logical block 161, lost async page write
[31379.032771] sd 0:0:0:0: [sda] tag#0 timing out command, waited 180s
[31379.033008] blk_update_request: I/O error, dev sda, sector 1456 op 0x1:(WRITE) flags 0x100000 phys_seg 1 prio class 0
[31379.033071] Buffer I/O error on dev sda, logical block 182, lost async page write

In the beginning it seems to have problems with undervoltage. However, I wonder where these problems should suddenly come from out of nowhere. Or can other problems be read from the log?

I guess this is not coming out of nowhere. Probably the under voltage issues are there all the time but sum up now to serious issues on your HDD.

As you can see, your system has quite some I/O issues and is not able to write things down to HDD. But it doesn’t mean it’s the HDD directly, it could be the cable you use to connect, leading to an unstable connection.

Yes - maybe it just went well until it just doesn’t go well now. The disk was in use for over a year in this condition. However, I guess that the I/O errors are also related to the power supply - otherwise they should actually occur on the PC as well (where I use the same cable).

I had the naive hope that there might be some software-side fixes. From this point of view, the problem SHOULD stop in any case when I connect the new disk (with external PSU and new wiring) to the system, right?

usually it does. What you could try as well is using different USB ports on the RPi, not sure if that might change anything.

Unfortunately, I’ve already been through that. The same problem on every port.

I guess I won’t have much choice but to wait for the new disk and see if it’s better then.

you could have tried a powered USB to SATA converter. Probably not that expensive compare to a new disk

Just an example from Amazon.
https://www.amazon.com/-/de/dp/B00MVRS38G/ref=sr_1_19?crid=QA71XRRB4MLG&currency=USD&ie=UTF8&keywords=usb%20sata%20adapter&language=en_US&qid=1637836462&sprefix=usb%20sa%2Caps%2C378&sr=8-19

I actually have a SATA connector here - but without power supply. I was reluctant to break the HDD’s shell. Since the new disk has 3TB more space (8TB total), it is also an upgrade at the same time. If the problem will continue to exist (which is unlikely, of course), I can still return it.

I just see it as a lesson to understand that the statement with the external PSU was not made up out of thin air :smiley:

And will of course let you know if the problem disappears or persists with the new disk! :slight_smile:

Thanks anyway for your help!

Hi!
As promised I report back now!
It turned out that actually not the harddisk itself was faulty, but the used power supply of the pi! Very strange. The power supply worked fine for much longer than the setup existed. A replacement ensured that the old disk worked again. The new one is still kept as an upgrade ;D

However, I am now encountering new errors when setting up the Pi, which I am unable to fix (due to lack of Linux skills).

The external HDD (this time WITH separate PSU ;D) was mounted via the drive-manager (ext4) and the userdata transferred to it. As filesystem I installed Samba (so far everything as before). I pointed the target directory to the HDD. But when I try to access the share via Explorer, Windows throws the error "Couldn’t connect to \192.168.0.167\dietpi - you have no permission to access \192.168.0.167\dietpi. Please contact a network administrator.

This message appeared without showing a login screen beforehand. I fixed it by enabling the option for “insecure guest logins” under gpedit.msc. Now a login mask appears. However, when I enter there as user “dietpi” and my set password, the message appears that the share cannot be accessed, there is a network error and I should make sure that there is no write error.

Unfortunately, since the initial setup of my first setup was so long ago, I can’t remember how I did it back then. Can we resolve this issue in this thread as well, or should I open a new one?

The content of the smb.conf is

[global]

        workgroup = WORKGROUP
        server string = %h server
        dns proxy = no
        log file = /var/log/samba/log.%m
        max log size = 1000
        syslog only = no
        syslog = 0

        panic action = /usr/share/samba/panic-action %d

        security = user
        encrypt passwords = true
        passdb backend = tdbsam
        obey pam restrictions = yes
        unix password sync = yes

        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        pam password change = yes
        map to guest = bad user

        load printers = no
        printcap name = /dev/null
        disable spoolss = yes

[dietpi]
        comment = DietPi Share
path = /mnt/Medien
        browseable = yes
        create mask = 0664
        directory mask = 0775
        valid users = dietpi
        writeable = yes
max connections = 8

The contents of my /etc/fstab:

# You can use "dietpi-drive_manager" to setup mounts.
# NB: It overwrites and re-creates physical drive mount entries on use.
#----------------------------------------------------------------
# NETWORK
#----------------------------------------------------------------


#----------------------------------------------------------------
# TMPFS
#----------------------------------------------------------------
tmpfs /tmp tmpfs size=1024M,noatime,lazytime,nodev,nosuid,mode=1777
tmpfs /var/log tmpfs size=50M,noatime,lazytime,nodev,nosuid,mode=1777

#----------------------------------------------------------------
# MISC: ecryptfs, vboxsf (VirtualBox shared folder), gluster, bind mounts
#----------------------------------------------------------------


#----------------------------------------------------------------
# SWAP SPACE
#----------------------------------------------------------------
/mnt/Medien/.swapfile none swap sw

#----------------------------------------------------------------
# PHYSICAL DRIVES
#----------------------------------------------------------------
PARTUUID=0140a7f0-02 / ext4 noatime,lazytime,rw 0 1
PARTUUID=0140a7f0-01 /boot vfat noatime,lazytime,rw 0 2
UUID=df197dd6-5e29-4d3c-8625-33b80ae054b6 /mnt/Medien ext4 noatime,lazytime,rw,nofail,noauto,x-systemd.automount



EDIT: Okay very strange. I booted Linux once to see if the error was with WIndows. From there I could access the SMB share. Then when I switched back to Windows to look further for the error, I was able to access the SMB share directly.
So I guess my problem has resolved itself for some reason.

Thanks for the time and help anyway! :slight_smile:



Kind regards!

ok good it is working now. Hope the connection will be stable as you still running without separate PSU. Keep that in mind :wink:

Haha from now on I play save (using a HDD with dedicated PSU!).
Thanks for your time and help!