Manjaro can't detect external hard drive

After recent update, my system can’t detect one of my external hard drives. Two hard drives were connected during the update. One with NTFS format and the other one with ext4 LUKS-encrypted. System works correctly for the NTFS one but for the other drive, it’s quite other way around. When it’s connected, nothing happens but engaging CPU. I’ve tried to connect it to Ubuntu 20.04 and windows 10, unfortunately they can’t detect the hard drive too. Right now I don’t think, no system can detect the hard drive as a connected device.

Note: While updating, Dolphin file explorer was opened on the hard drive. I tried to close Dolphin but it didn’t close normally(it got into not responding mode), so I tried to close it by sending kill signal, it didn’t work either. So I ejected it physically from system. Before ejection, I pushed safely remove button but it said :

One or more file on this device are opened …

Updating took long. After ejection, update completed immediately and I rebooted the system.

When you physically plug in the drive (and ignore any popups from KDE/Plasma), wait 10 seconds, and then run,

sudo partprobe -s

Do you see your partition listed as something like this:
/dev/sdb: gpt partitions 1

If so, do you see the LUKS header information when you issue:

sudo cryptsetup luksDump /dev/sdb1

UPDATE:

Avoid plugging in a LUKS encrypted device into Windows 10, on the off-chance that you might accidentally tell Windows to “prepare,” “check,” or “format” the disk.

UPDATE AGAIN:

How on earth did you register the username “root” this late in the game? Did no one else try to snatch it up? :rofl:

1 Like

There isn’t any popup after 30 minutes.

Result of sudo partprobe -s while external hard drive is connected:

/dev/sda: gpt partitions 1 2 3
/dev/sdb: gpt partitions 1 2 3

I’ve two internal hard drives on my system(SSD and HDD).

sda and sdb are representing them.

From an unplugged state, plug in the USB drive, wait 15 seconds, then issue:

sudo dmesg | tail

Can you paste the output and see if there are any references to /dev/sdc (or whatever assigned latter to the external drive).

sudo dmesg | tail -n 100 | grep sd:

[12429.040752] sd 4:0:0:0: [sdc] Read Capacity(10) failed: Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
[12429.040754] sd 4:0:0:0: [sdc] Sense not available.
[12429.040758] sd 4:0:0:0: [sdc] 0 512-byte logical blocks: (0 B/0 B)
[12429.040759] sd 4:0:0:0: [sdc] 0-byte physical blocks
[12429.040763] sd 4:0:0:0: [sdc] Write Protect is off
[12429.040765] sd 4:0:0:0: [sdc] Mode Sense: 00 00 00 00
[12429.040768] sd 4:0:0:0: [sdc] Asking for cache data failed
[12429.040770] sd 4:0:0:0: [sdc] Assuming drive cache: write through
[12429.054350] sd 4:0:0:0: [sdc] Read Capacity(10) failed: Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
[12429.054355] sd 4:0:0:0: [sdc] Sense not available.
[12429.054367] sd 4:0:0:0: [sdc] Attached SCSI disk
[12435.125040] sd 4:0:0:0: Attached scsi generic sg2 type 0
[12445.152835] sd 4:0:0:0: [sdc] Spinning up disk...

With the USB drive still connected,

lsusb

Look for the entry that refers to the USB drive, such as for example:

Bus 002 Device 002: ID 1058:25fa Western Digital Technologies, Inc. easystore Portable 5TB (WDBKUZ0050)

Paste the entire line or at least the ID. The ID in my example is: 1058:25fa

This will be used to try to make a custom quirk for the drive in case it’s having issues with the UAS protocol, (USB-attached SCSI).

lsusb:

Bus 003 Device 010: ID 125f:a35a A-DATA Technology Co., Ltd. HD650

Okay, try disabling UAS for that drive and rebooting. Here’s how. Have your USB unplugged during this entire process…

First elevate yourself to “root”, as sudo won’t work for this step:

sudo su

Then create a single custom .conf file under /etc/modprobe.d/ which will be used to list all drives (in this case just one drive) that will use usb-storage instead of uas. Please review the command carefully. Every word, every symbol, every character counts.

echo “options usb-storage quirks=125f:a35a:u” >> /etc/modprobe.d/99-disable-uas.conf

I use 99- to denote my custom-made .conf files.

For safe measure, exit out of the root user’s shell with CTRL + D, then rebuild your initramfs:

sudo mkinitcpio -P

Finally, make a backup of this custom .conf file for safe-keeping if you ever need to use it again (and assuming this will work!)

cp -v /etc/modprobe.d/99-disable-uas.conf ~/

Reboot, plug in the USB drive, and see if it works, or if there’s any additional behaviour.


UPDATE:
I highly recommend you do NOT mount the EXT4 partition nor unlock the drive (via the KDE applet) even if it looks like it’s working.

Because of what happened during the Manjaro update process, I advise you only unlock the device temporarily, force a fsck, lock the device again, unplug it, and then you should be good to go.

If the drive is detected after doing the above steps to disable UAS. Force a full fsck on the underlying EXT4 file-system:

sudo cryptsetup luksOpen /dev/sdc1 crypt_fsck_me
sudo fsck.ext4 -v -f /dev/mapper/crypt_fsck_me

After it finishes,

sudo cryptsetup luksClose crypt_fsck_me
sudo eject /dev/sdc

Unplug the drive. You should be all clear now.

I created /etc/modprobe.d/99-disable-uas.conf, rebuilt initramfs and rebooted the system as you said. I don’t see any difference in system behavior.

sudo partprobe -s:

/dev/sda: gpt partitions 1 2 3
/dev/sdb: gpt partitions 1 2 3

sudo dmesg | tail -n 100 | grep sd:

[ 1079.336802] sd 4:0:0:0: Attached scsi generic sg2 type 0
[ 1089.364792] sd 4:0:0:0: [sdc] Spinning up disk...
[ 1118.129513]  sdb: sdb1 sdb2 sdb3
[ 1203.992082] sd 4:0:0:0: [sdc] Read Capacity(10) failed: Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 1203.992086] sd 4:0:0:0: [sdc] Sense Key : Not Ready [current] 
[ 1203.992088] sd 4:0:0:0: [sdc] Add. Sense: Logical unit is in process of becoming ready
[ 1203.992092] sd 4:0:0:0: [sdc] 0 512-byte logical blocks: (0 B/0 B)
[ 1203.992093] sd 4:0:0:0: [sdc] 0-byte physical blocks
[ 1205.997820] sd 4:0:0:0: [sdc] Test WP failed, assume Write Enabled
[ 1208.003340] sd 4:0:0:0: [sdc] Asking for cache data failed
[ 1208.003351] sd 4:0:0:0: [sdc] Assuming drive cache: write through
[ 1214.036096] sd 4:0:0:0: [sdc] Spinning up disk...
[ 1488.175885] sd 4:0:0:0: tag#0 timing out command, waited 180s
[ 1652.017796]  sdb: sdb1 sdb2 sdb3
[ 1668.189240] sd 4:0:0:0: tag#0 timing out command, waited 180s

cat /etc/modprobe.d/99-disable-uas.conf:

options usb-storage quirks=125f:a35a:u

What about after plugging it in, waiting 10 seconds, and then:

sudo dmesg | grep Quirks

(Capital Q in the grep)

sudo dmesg | grep Quirks:

[ 1078.313114] usb-storage 3-1:1.0: Quirks match for vid 125f pid a35a: 800000

You say it’s not detected even in another computer? This is worrying. Does it even receive SMART commands while plugged in?

sudo smartctl -a /dev/sdc

No it didn’t. I tried Ubuntu 20.04 live on another computer, it didn’t detect the hard drive.

sudo smartctl -a /dev/sdc:

smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.10.26-1-MANJARO] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

Read Device Identity failed: scsi error medium or hardware error (serious)

A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.

Was there a power surge or sudden outage around the time you had the drive plugged into the computer? This is looking much worse than I thought and it appears to be a nasty hardware failure.

Do you hear any “tiny gears” moving the read/write head when you first plug in the USB drive? Do you hear any clicking, even if only “soft”?

Do you have a backup of the data that was on this drive?

As a last ditch from what I can fathom, remove the custom .conf, rebuild initramfs, and reboot.

sudo rm -v /etc/modprobe.d/99-disable-uas.conf
sudo mkinitcpio -P

Then reboot, and try to issue the SMART query command again:

sudo smartctl -a /dev/sdc

No there wan’t any power surge or sudden outage; I have voltage protector.
Yes I can hear a tiny gear clicking when I unplug the hard drive. I don’t hear any other sound while it’s connected or when I try to plug it in.
I have partial backup and some of my data are really important to me which I don’t have backup of them.

Is there any hope? Do you have any recommendation how should I treat the hard drive since now?

This one is out of my league, but before I share some ideas, did you try the steps from above?

Here is the result.

sudo smartctl -a /dev/sdc:

smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.10.26-1-MANJARO] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

Smartctl open device: /dev/sdc failed: No such device

What about dmesg? There’s no reason why it doesn’t assign it sdc again, since you already have sda and sdb as internals.

After plugging it in:

sudo dmesg | tail -n 100 | grep sd