You are not logged in.

#1 2020-03-21 10:10:56

djipey
Member
Registered: 2011-07-30
Posts: 139

UB3 external hard drive became too slow overtime

Hi, I hope you guys are all safe with this corona virus situation.

In the past month I noticed that my external hard drive became slow. It wasn't the case before. I have had the drive for about 18 months now.

This is this drive: https://www.amazon.co.uk/gp/product/B01 … UTF8&psc=1

It's USB3, alimented through USB (no external power). My laptop has USB3 ports.
The hard drive has 3 partitions on it:

- A NTFS partition, ~1.5 TB
- Two ext4 partition, ~1.5 TB each

When I say it's slow, it means that I can't stream a 1080p video from the drive without buffering all the time. Writing or reading a file to/from the disk seems also slower than before. But the drive still "works".

I tried repairing all the partitions through gparted or other tools, but the partitions all seem intact. I also tried setting the vm.dirty_ratio and vm.dirty_background_ratio parameters as recommended in the wiki (https://wiki.archlinux.org/index.php/sysctl), but I'm still experiencing the problem.

Could you guys help diagnose/fix the problem? I ran out of ideas.

Cheers

Offline

#2 2020-03-21 12:22:09

seth
Member
Registered: 2012-09-03
Posts: 14,122

Re: UB3 external hard drive became too slow overtime

From what partition? NTFS, ext4 or both?

What's the performance output of

dd if=/dev/zero of=/path/to/disk/test_file bs=1M count=1k # that's a 1GB file
dd if=/path/to/disk/test_file of=/tmp/test_file # ensure you've enough RAM for the tmpfs to store the file!

Offline

#3 2020-03-21 13:40:56

djipey
Member
Registered: 2011-07-30
Posts: 139

Re: UB3 external hard drive became too slow overtime

Thanks for your answer. I definitely experience the problem from the ext4 partitions, and I think a bit from the NTFS partition, but now that I think of it, not really sure about the last one. I don't use the NTFS partition very often.

I did the tests (3 times per partition):

- On the NTFS partition:

❯ dd if=/dev/zero of=/var/run/media/djipey/media/test_file bs=1M count=1k     
1024+0 enregistrements lus
1024+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 7,85522 s, 137 MB/s

❯ dd if=/dev/zero of=/var/run/media/djipey/media/test_file bs=1M count=1k   
1024+0 enregistrements lus
1024+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 8,5216 s, 126 MB/s

❯ dd if=/dev/zero of=/var/run/media/djipey/media/test_file bs=1M count=1k
1024+0 enregistrements lus
1024+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 9,03528 s, 119 MB/s

- On the first ext4 partition:

❯ dd if=/dev/zero of=/var/run/media/djipey/Restore2/test_file bs=1M count=1k
1024+0 enregistrements lus
1024+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 53,977 s, 19,9 MB/s

❯ dd if=/dev/zero of=/var/run/media/djipey/Restore2/test_file bs=1M count=1k
1024+0 enregistrements lus
1024+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 21,0986 s, 50,9 MB/s

❯ dd if=/dev/zero of=/var/run/media/djipey/Restore2/test_file bs=1M count=1k
1024+0 enregistrements lus
1024+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 27,506 s, 39,0 MB/s

- On the second ext4 partition:

❯ dd if=/dev/zero of=/var/run/media/djipey/backup/test_file bs=1M count=1k  
1024+0 enregistrements lus
1024+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 18,6616 s, 57,5 MB/s

❯ dd if=/dev/zero of=/var/run/media/djipey/backup/test_file bs=1M count=1k
1024+0 enregistrements lus
1024+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 28,8206 s, 37,3 MB/s

❯ dd if=/dev/zero of=/var/run/media/djipey/backup/test_file bs=1M count=1k
1024+0 enregistrements lus
1024+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 23,1655 s, 46,4 MB/s

It seems the ext4 partitions are way slower. Is it expected?


And for the second command:

- NTFS partition:

❯ dd if=/var/run/media/djipey/media/test_file of=/tmp/test_file   
2097152+0 enregistrements lus
2097152+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 14,702 s, 73,0 MB/s

❯ dd if=/var/run/media/djipey/media/test_file of=/tmp/test_file
2097152+0 enregistrements lus
2097152+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 3,3563 s, 320 MB/s

❯ dd if=/var/run/media/djipey/media/test_file of=/tmp/test_file
2097152+0 enregistrements lus
2097152+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 3,28343 s, 327 MB/s

- First ext4 partition:

❯ dd if=/var/run/media/djipey/Restore2/test_file of=/tmp/test_file
2097152+0 enregistrements lus
2097152+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 27,7441 s, 38,7 MB/s

❯ dd if=/var/run/media/djipey/Restore2/test_file of=/tmp/test_file
2097152+0 enregistrements lus
2097152+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 6,7629 s, 159 MB/s

❯ dd if=/var/run/media/djipey/Restore2/test_file of=/tmp/test_file
2097152+0 enregistrements lus
2097152+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 3,2949 s, 326 MB/s

- second ext4 partition:

❯ dd if=/var/run/media/djipey/backup/test_file of=/tmp/test_file
2097152+0 enregistrements lus
2097152+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 7,24374 s, 148 MB/s

❯ dd if=/var/run/media/djipey/backup/test_file of=/tmp/test_file
2097152+0 enregistrements lus
2097152+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 34,3849 s, 31,2 MB/s

❯ dd if=/var/run/media/djipey/backup/test_file of=/tmp/test_file
2097152+0 enregistrements lus
2097152+0 enregistrements écrits
1073741824 octets (1,1 GB, 1,0 GiB) copiés, 3,33899 s, 322 MB/s

The reading speeds are all over the place so I can't really tell what's going on.

Since you mentioned tmpfs, I mount it in my fstab:

# /etc/fstab: static file system information
#
# <file system> <dir>   <type>  <options>       <dump>  <pass>
UUID=b418ab23-633e-43c1-beae-5359ee35a9a6 /             ext4            rw,relatime,data=ordered        0 1

UUID=911914f3-5645-4bc9-9a1d-e5575871f042 /home         ext4            rw,relatime,data=ordered        0 2

UUID=5e54fb1b-bb72-4f09-ae7e-644f46df3eb3 none          swap            defaults        0 0

tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0       0
UUID=d4fd13c4-c31c-459a-b351-0591131f8dae /run/media/djipey/data          ext4    defaults,noatime 0       3
UUID=4ab25f0a-8703-4d1f-916a-360c3c8f0437 /run/media/djipey/big-data      ext4    defaults,noatime 0       4

Offline

#4 2020-03-21 14:03:08

seth
Member
Registered: 2012-09-03
Posts: 14,122

Re: UB3 external hard drive became too slow overtime

You can read into /dev/null to rule out effects from eg. swapping.

Typically NTFS-3G is much slower (CPU intense) than ext4, while your tests systematically show the opposite.
a) check dmesg for IO errors
b) fsck (though I gather you already did that)
c) some tracker/indexer? (the ntfs partition isn't in your fstab?) - though that would not explain slow reads (movie playback)
d) usb autosuspend? https://wiki.archlinux.org/index.php/Po … utosuspend - "usbcore.autosuspend=-1" would turn it off, but be aware that power managing tools can alter this at runtime.

Offline

#5 2020-03-21 14:36:33

djipey
Member
Registered: 2011-07-30
Posts: 139

Re: UB3 external hard drive became too slow overtime

a) check dmesg for IO errors

[240215.626035] sd 4:0:0:0: [sdd] tag#0 uas_zap_pending 0 uas-tag 1 inflight: CMD 
[240215.626041] sd 4:0:0:0: [sdd] tag#0 CDB: Synchronize Cache(10) 35 00 00 00 00 00 00 00 00 00
[240215.626087] sd 4:0:0:0: [sdd] tag#0 FAILED Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK cmd_age=2s
[240215.626091] sd 4:0:0:0: [sdd] tag#0 CDB: Synchronize Cache(10) 35 00 00 00 00 00 00 00 00 00
[240215.626108] blk_update_request: I/O error, dev sdd, sector 0 op 0x1:(WRITE) flags 0x800 phys_seg 0 prio class 0
[240215.626263] blk_update_request: I/O error, dev sdd, sector 4096002048 op 0x0:(READ) flags 0x80700 phys_seg 4 prio class 0
[240215.626299] blk_update_request: I/O error, dev sdd, sector 4096002048 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[240215.626305] Buffer I/O error on dev sdd2, logical block 0, async page read
[240215.626340] blk_update_request: I/O error, dev sdd, sector 4096002048 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[240215.626343] Buffer I/O error on dev sdd2, logical block 0, async page read
[240215.800025] sd 4:0:0:0: [sdd] Synchronizing SCSI cache
[240215.998973] sd 4:0:0:0: [sdd] Synchronize Cache(10) failed: Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
[240233.446348] sd 4:0:0:0: [sdd] 9767541167 512-byte logical blocks: (5.00 TB/4.55 TiB)
[240233.446353] sd 4:0:0:0: [sdd] 4096-byte physical blocks
[240233.446620] sd 4:0:0:0: [sdd] Write Protect is off
[240233.446625] sd 4:0:0:0: [sdd] Mode Sense: 53 00 00 08
[240233.447035] sd 4:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[240233.447327] sd 4:0:0:0: [sdd] Optimal transfer size 33553920 bytes not a multiple of physical block size (4096 bytes)
[240233.618141]  sdd: sdd1 sdd2 sdd3
[240233.619885] sd 4:0:0:0: [sdd] Attached SCSI disk
[240235.504263] EXT4-fs (sdd3): mounted filesystem with ordered data mode. Opts: (null)
[240235.834280] EXT4-fs (sdd2): mounted filesystem with ordered data mode. Opts: (null)

b) fsck (though I gather you already did that)

Yes I did that before but I did it again just to be sure, and the tests show more or less the same results

c) some tracker/indexer? (the ntfs partition isn't in your fstab?) - though that would not explain slow reads (movie playback)

None of the partitions on this drive are in my fstab. This is an external hard drive and I can mount/unmount it anytime.


d) usb autosuspend?

But wouldn't that also affect the NTFS partition as well? All these partitions are on the same USB drive

Offline

#6 2020-03-21 15:03:44

seth
Member
Registered: 2012-09-03
Posts: 14,122

Re: UB3 external hard drive became too slow overtime

Is that the only error you got?

> But wouldn't that also affect the NTFS partition as well?
Depends on the suspend delay, the access pattern and the drives cache. Is there a difference when moving 100MB ("count=100")?

Offline

#7 2020-03-21 15:34:58

djipey
Member
Registered: 2011-07-30
Posts: 139

Re: UB3 external hard drive became too slow overtime

> Is that the only error you got?

Yes

> Depends on the suspend delay, the access pattern and the drives cache. Is there a difference when moving 100MB ("count=100")?

I put this in the file /etc/modprobe.d/usb-autosuspend.conf and rebooted:

options usbcore autosuspend=-1

But I still have movie playback issues, same as before. (did I do this right?)

I tried moving a 100MB file:

❯ dd if=/dev/zero of=/var/run/media/djipey/media/test_file bs=1M count=100     
100+0 enregistrements lus
100+0 enregistrements écrits
104857600 octets (105 MB, 100 MiB) copiés, 1,36535 s, 76,8 MB/s

❯ dd if=/dev/zero of=/var/run/media/djipey/backup/test_file bs=1M count=100     
100+0 enregistrements lus
100+0 enregistrements écrits
104857600 octets (105 MB, 100 MiB) copiés, 1,99435 s, 52,6 MB/s

❯ dd if=/dev/zero of=/var/run/media/djipey/Restore2/test_file bs=1M count=100     
100+0 enregistrements lus
100+0 enregistrements écrits
104857600 octets (105 MB, 100 MiB) copiés, 2,43888 s, 43,0 MB/

NTFS is still the fastest

Offline

#8 2020-03-21 17:39:15

seth
Member
Registered: 2012-09-03
Posts: 14,122

Re: UB3 external hard drive became too slow overtime

usbcore is likely in your initramfs, so passing the option to the kernel directly is the better way to test this. You can inspect

cat /sys/module/usbcore/parameters/autosuspend

However you pretty much underran any suspend times in the last test, so that's probably not the cause.

The movie playback is a bit weird - even the "slow" values are entirely sufficient to play a 4k h264 video.
Is there increased CPU load when reading from that disk (w/o actually playing it)?

Offline

#9 2020-03-21 19:52:41

djipey
Member
Registered: 2011-07-30
Posts: 139

Re: UB3 external hard drive became too slow overtime

Ok I put usbcore.autosuspend=-1 in my grub and rebooted, checked autosuspend was set -1 with your last command, and tried again, bus still the same issue.

> The movie playback is a bit weird - even the "slow" values are entirely sufficient to play a 4k h264 video.
> Is there increased CPU load when reading from that disk (w/o actually playing it)?

I did the following test:

- I tried to read a ~4.5 GB 1080p file from one of the ext4 partitions, with smplayer or VLC. While playing, I checked what was happening with Glances. CPU usage seems normal, but iowait regularly jumps to 25%, and that's when the video starts buffering. I can reproduce this result for the two players (no idea what iowait is exactly, but you get the idea).

- I tried reading a ~15 GB 1080p file from the NTFS partition, with the two players. The iowait rarely goes above 2% and the video never buffers.

Offline

#10 2020-03-21 22:46:05

seth
Member
Registered: 2012-09-03
Posts: 14,122

Re: UB3 external hard drive became too slow overtime

iowait simply means that the cpu is idling, waiting for the I/O - ie "your disk is slow" (and the cpu is not the bottle neck)

Try the lts kernel or maybe an even older iteration from some live distro.
Everything suggests that this is an issue w/ the ext4 implementation.

Offline

#11 2020-03-21 23:12:15

djipey
Member
Registered: 2011-07-30
Posts: 139

Re: UB3 external hard drive became too slow overtime

Sorry to disappoint, but the current LTS doesn't solve the issue either hmm

I did another test, I copied a video that I struggle to read from the ext4 partition on the NTFS partition. So I'm reading the exact same file from an ext4 or NTFS partition. Reading from the NTFS partition is smooth while reading from the est4 isn't. I truly don't understand what's happening.

Given the tests we did, it's at least conmforting to know it's not a hardware issue, but still it's annoying.

I'll take other ideas

Offline

#12 2020-03-21 23:25:58

seth
Member
Registered: 2012-09-03
Posts: 14,122

Re: UB3 external hard drive became too slow overtime

https://grml.org/ - 2018.12 has an old 4.19 kernel
Ensure this reads ext4 at decent speed.

Offline

#13 2020-03-22 08:11:07

djipey
Member
Registered: 2011-07-30
Posts: 139

Re: UB3 external hard drive became too slow overtime

Yeah that seems quite adventurous...

I attempted something else, out of despair. In Gparted I repaired the first ext4 partition. Then I tried to play a few videos. It works fine for the first 4-5 videos (no buffering), but after that the buffering is back again. After the video have been read, Gparted says there is ~75GB of free space on the partition, while there is actually only 2GB left.


Does it help?

Last edited by djipey (2020-03-22 08:19:01)

Offline

#14 2020-03-22 08:18:33

seth
Member
Registered: 2012-09-03
Posts: 14,122

Re: UB3 external hard drive became too slow overtime

It's not - you can download and dd the image onto some usb key, boot it from there and test your disk speed.

What exectly do you mean by "repaired"? What was "broken"?

Offline

#15 2020-03-22 08:30:01

djipey
Member
Registered: 2011-07-30
Posts: 139

Re: UB3 external hard drive became too slow overtime

I mean that I simply unmounted the partition, and then clicked on "Verify partition".

This is the log of what happened (sorry it's in french, let me know if you need help translating it)

https://www.dropbox.com/s/80fjph7uqq4vp … s.htm?dl=0

Offline

#16 2020-03-22 08:43:19

seth
Member
Registered: 2012-09-03
Posts: 14,122

Re: UB3 external hard drive became too slow overtime

That just ran an idempotent fsck :\

Is the ntfs partition equally stuffed? Is the other ext4 partition?
What do "lsblk -f" and "df -h" report about the usage?

Offline

Board footer

Powered by FluxBB