С некоторых пор (уже давно) наблюдаю проблемы при записи большого объема (20Гб и более) данных на внешние винчестеры USB.
Одно и тоже наблюдается
на разных компьютерах с разными винчестерами Seagate 2,5" USB3.
Проблемы состоят в следующем:
1) При копировании больших файлов или большого числа файлов скорость записи плавно падает до порядка 1,8Мб сек, а иногда и 100 кб/сек. Это наблюдается у всех имеющихся у меня комбинаций компьютер-контролер-винчестер при подключении как USB2, так и USB3. Т.е. запустив копирование терабайта файлов в mc через несколько часов увидим, что процесс еле-еле сдвинулся, винчестер тарахтит и щелкает, а скорость в лучшем случае 1 Мб/сек. Копирование 1-2 файлов общим объемом десяток-два Гб идет без проблем на скорости 40+ мб/сек на том же железе (c USB2 будет порядка 25 мб/сек).
2) При подключении к USB3 винчестеры спустя некоторое время начинают "щелкать". Слышен звук как при парковке головок. Сразу после этого они раскручиваются с характерным у-у-У-У, после чего следует новая парковка. Это происходит каждые 2 секунды и может начаться во время записи данных или после нескольких минут покоя.
Вот пример двух машин с разными контроллерами USB, на которых происходит одно и то же:
а) десктоп
Спойлер
System:
Host: alpha.localdomain Kernel: 4.19.59-std-def-alt1 x86_64 bits: 64
compiler: gcc v: 8.3.1 Desktop: Cinnamon 4.2.1
Distro: Sisyphus 20190624/unstable
Machine:
Type: Desktop System: ASUS product: All Series v: N/A serial: <filter>
Mobo: ASUSTeK model: Z97-A v: Rev 1.xx serial: <filter>
UEFI: American Megatrends v: 2801 date: 11/11/2015
CPU:
Topology: Quad Core model: Intel Core i7-5775C bits: 64 type: MT MCP
arch: Broadwell rev: 1 L2 cache: 6144 KiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
bogomips: 52803
Speed: 3131 MHz min/max: 800/3700 MHz Core speeds (MHz): 1: 1990 2: 2002
3: 1995 4: 1998 5: 1999 6: 2210 7: 1986 8: 2007
Graphics:
Device-1: AMD Turks XT [Radeon HD 6670/7670] vendor: PC Partner Limited
driver: radeon v: kernel bus ID: 01:00.0
Display: tty server: X.Org 1.20.5 driver: ati,radeon
unloaded: fbdev,modesetting,vesa tty: N/A
OpenGL: renderer: N/A v: N/A direct render: N/A
Audio:
Device-1: Intel 9 Series Family HD Audio vendor: ASUSTeK
driver: snd_hda_intel v: kernel bus ID: 00:1b.0
Device-2: AMD Turks HDMI Audio [Radeon HD 6500/6600 / 6700M Series]
vendor: PC Partner Limited driver: snd_hda_intel v: kernel bus ID: 01:00.1
Device-3: Philips s SAA7146 vendor: Technotrend Systemtechnik
Siemens/Technotrend/Hauppauge DVB card rev1.3 or rev1.5
driver: av7110 bus ID: 04:01.0
Sound Server: ALSA v: k4.19.59-std-def-alt1
Network:
Device-1: Intel Ethernet I218-V vendor: ASUSTeK driver: e1000e v: 3.2.6-k
port: f040 bus ID: 00:19.0
IF: eth0 state: up speed: 1000 Mbps duplex: full mac: <filter>
sh: line 1: 1750 Segmentation fault /usr/bin/sudo -n /usr/sbin/hddtemp -nq -u C /dev/sdb 2> /dev/null
sh: line 1: 1754 Segmentation fault /usr/bin/sudo -n /usr/sbin/hddtemp -nq -u C /dev/sdc 2> /dev/null
sh: line 1: 1758 Segmentation fault /usr/bin/sudo -n /usr/sbin/hddtemp -nq -u C /dev/sda 2> /dev/null
Drives:
Local Storage: total: 14.64 TiB used: 14.59 TiB (99.7%)
ID-1: /dev/sda vendor: OCZ model: VERTEX3 size: 83.85 GiB
ID-2: /dev/sdb vendor: Western Digital model: WD60EFRX-68L0BN1
size: 5.46 TiB
ID-3: /dev/sdc vendor: HGST (Hitachi) model: HUH721010ALE604
size: 9.10 TiB
Partition:
ID-1: / size: 18.75 GiB used: 16.99 GiB (90.6%) fs: reiserfs
dev: /dev/sda2
ID-2: /home size: 65.00 GiB used: 29.16 GiB (44.9%) fs: reiserfs
dev: /dev/sda3
Sensors:
System Temperatures: cpu: 33.0 C mobo: N/A gpu: radeon temp: 40 C
Fan Speeds (RPM): cpu: 0
Info:
Processes: 194 Uptime: 1m Memory: 15.60 GiB used: 363.2 MiB (2.3%)
Init: systemd runlevel: 5 Compilers: gcc: N/A Shell: bash v: 4.4.23
inxi: 3.0.35
$ sudo lshw -businfo
Bus info Device Class Description
====================================================
system All Series (All)
bus Z97-A
...
pci@0000:00:14.0 bus 9 Series Chipset Family USB xHCI Controller
usb@2 usb2 bus xHCI Host Controller
usb@2:e input USB Optical Mouse
usb@3 usb3 bus xHCI Host Controller
pci@0000:00:16.0 communication 9 Series Chipset Family ME Interface #1
pci@0000:00:19.0 eth0 network Ethernet Connection (2) I218-V
pci@0000:00:1a.0 bus 9 Series Chipset Family USB EHCI Controller #2
usb@1 usb1 bus EHCI Host Controller
usb@1:1 bus USB hub
pci@0000:00:1b.0 multimedia 9 Series Chipset Family HD Audio Controller
pci@0000:00:1c.0 bridge 9 Series Chipset Family PCI Express Root Port 1
pci@0000:00:1c.3 bridge 82801 PCI Bridge
pci@0000:03:00.0 bridge ASM1083/1085 PCIe to PCI Bridge
pci@0000:04:01.0 multimedia SAA7146
pci@0000:00:1d.0 bus 9 Series Chipset Family USB EHCI Controller #1
usb@4 usb4 bus EHCI Host Controller
usb@4:1 bus USB hub
pci@0000:00:1f.0 bridge Z97 Chipset LPC Controller
pci@0000:00:1f.2 storage 9 Series Chipset Family SATA Controller [AHCI Mode]
pci@0000:00:1f.3 bus 9 Series Chipset Family SMBus Controller
power To Be Filled By O.E.M.
$ lsusb -t
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/14p, 480M
|__ Port 14: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
б) ноутбук Macbook Pro 17" (USB2 + ExpressCard USB3)
Спойлер
Host: mac Kernel: 4.19.43-std-def-alt1 x86_64 bits: 64 compiler: gcc
v: 8.3.1 Desktop: Cinnamon 4.2.3 Distro: Sisyphus 20190624/unstable
Machine:
Type: Laptop System: Apple product: MacBookPro8,3 v: 1.0 serial: <filter>
Mobo: Apple model: Mac-942459F5819B171B v: MacBookPro8,3 serial: <filter>
UEFI: Apple v: MBP81.88Z.0047.B2C.1510261540 date: 10/26/15
Battery:
ID-1: BAT0 charge: 87.2 Wh condition: 88.4/92.1 Wh (96%)
model: DP bq20z451 status: Full
CPU:
Topology: Quad Core model: Intel Core i7-2720QM bits: 64 type: MT MCP
arch: Sandy Bridge rev: 7 L2 cache: 6144 KiB
flags: avx lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 35202
Speed: 1013 MHz min/max: 800/3300 MHz Core speeds (MHz): 1: 1013 2: 1087
3: 826 4: 869 5: 1598 6: 1991 7: 895 8: 869
Graphics:
Device-1: Intel 2nd Generation Core Processor Family Integrated Graphics
vendor: Apple driver: i915 v: kernel bus ID: 00:02.0
Device-2: AMD Whistler [Radeon HD 6630M/6650M/6750M/7670M/7690M]
vendor: Apple driver: radeon v: kernel bus ID: 01:00.0
Display: x11 server: X.Org 1.20.5 driver: ati,intel,radeon
unloaded: fbdev,modesetting,vesa resolution: 1920x1200~60Hz
OpenGL: renderer: AMD TURKS (DRM 2.50.0 / 4.19.43-std-def-alt1 LLVM 7.0.1)
v: 3.3 Mesa 19.1.3 direct render: Yes
Audio:
Device-1: Intel 6 Series/C200 Series Family High Definition Audio
driver: snd_hda_intel v: kernel bus ID: 00:1b.0
Device-2: AMD Turks HDMI Audio [Radeon HD 6500/6600 / 6700M Series]
driver: snd_hda_intel v: kernel bus ID: 01:00.1
Sound Server: ALSA v: k4.19.43-std-def-alt1
Network:
Device-1: Broadcom and subsidiaries NetXtreme BCM57765 Gigabit Ethernet
PCIe
driver: tg3 v: 3.137 port: 2000 bus ID: 02:00.0
IF: eth0 state: up speed: 100 Mbps duplex: full mac: <filter>
Device-2: Broadcom and subsidiaries BCM4331 802.11a/b/g/n
vendor: Apple AirPort Extreme driver: wl v: kernel port: 2000
bus ID: 03:00.0
IF: eth1 state: down mac: <filter>
Drives:
Local Storage: total: 8.64 TiB used: 2.36 TiB (27.3%)
ID-1: /dev/sda vendor: Samsung model: SSD 850 EVO 500GB size: 465.76 GiB
ID-2: /dev/sdb type: USB vendor: Seagate model: ST5000LM000-2AN170
size: 4.55 TiB temp: 28 C
ID-3: /dev/sdc type: USB vendor: Seagate model: BUP BK size: 3.64 TiB
Partition:
ID-1: / size: 441.66 GiB used: 306.94 GiB (69.5%) fs: reiserfs
dev: /dev/sda4
Sensors:
System Temperatures: cpu: 70.0 C mobo: N/A
Fan Speeds (RPM): N/A
Info:
Processes: 287 Uptime: 17h 12m Memory: 15.57 GiB used: 3.98 GiB (25.6%)
Init: systemd runlevel: 5 Compilers: gcc: N/A Shell: bash v: 4.4.23
inxi: 3.0.36
$ lsusb -t
/: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M
|__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=uas, 5000M
/: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/8p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/3p, 480M
|__ Port 1: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 3: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 4, If 0, Class=Hub, Driver=hub/3p, 12M
|__ Port 3: Dev 8, If 2, Class=Vendor Specific Class, Driver=btusb, 12M
|__ Port 3: Dev 8, If 0, Class=Vendor Specific Class, Driver=btusb, 12M
|__ Port 3: Dev 8, If 3, Class=Application Specific Interface, Driver=, 12M
|__ Port 3: Dev 8, If 1, Class=Wireless, Driver=btusb, 12M
|__ Port 2: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 2: Dev 5, If 2, Class=Human Interface Device, Driver=bcm5974, 12M
|__ Port 2: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 3: Dev 12, If 0, Class=Mass Storage, Driver=usb-storage, 480M
|__ Port 2: Dev 3, If 2, Class=Vendor Specific Class, Driver=, 480M
|__ Port 2: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 2: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
$ sudo lshw -businfo
Bus info Device Class Description
====================================================
system MacBookPro8,3 (System SKU#)
...
pci@0000:00:1a.0 bus 6 Series/C200 Series Chipset Family USB
usb@3 usb3 bus UHCI Host Controller
pci@0000:00:1a.7 bus 6 Series/C200 Series Chipset Family USB
usb@1 usb1 bus EHCI Host Controller
usb@1:1 bus USB 2.0 Hub
usb@1:1.1 bus BRCM2070 Hub
usb@1:1.1.3 communication Bluetooth USB Host Controller
usb@1:1.2 input Apple Internal Keyboard / Trackpad
usb@1:2 multimedia FaceTime HD Camera (Built-in)
pci@0000:00:1b.0 multimedia 6 Series/C200 Series Chipset Family Hig
pci@0000:00:1c.0 bridge 6 Series/C200 Series Chipset Family PCI
pci@0000:02:00.0 eth0 network NetXtreme BCM57765 Gigabit Ethernet PCI
pci@0000:00:1c.1 bridge 6 Series/C200 Series Chipset Family PCI
pci@0000:03:00.0 eth1 network BCM4331 802.11a/b/g/n
pci@0000:00:1c.2 bridge 6 Series/C200 Series Chipset Family PCI
pci@0000:04:00.0 bus FW643 [TrueFire] PCIe 1394b Controller
pci@0000:00:1c.3 bridge 6 Series/C200 Series Chipset Family PCI
pci@0000:9c:00.0 bus uPD720202 USB 3.0 Host Controller
usb@5 usb5 bus xHCI Host Controller
usb@6 usb6 bus xHCI Host Controller
pci@0000:00:1d.0 bus 6 Series/C200 Series Chipset Family USB
usb@4 usb4 bus UHCI Host Controller
pci@0000:00:1d.7 bus 6 Series/C200 Series Chipset Family USB
usb@2 usb2 bus EHCI Host Controller
usb@2:1 bus USB 2.0 Hub
usb@2:1.1 input IR Receiver
usb@2:1.3 input USB Mouse
pci@0000:00:1f.0 bridge HM65 Express Chipset LPC Controller
pci@0000:00:1f.2 storage 6 Series/C200 Series Chipset Family 6 p
pci@0000:00:1f.3 bus 6 Series/C200 Series Chipset Family SMB
power Unknown
Общее:
Везде установлен ALTlinux Sisyphus, ядро Linux 4.x.x-std-def-alt1).
Все винчестеры - исправные Seagate Backup Plus 2,5", 2, 4, 5Тб разных модификаций.
Чаще всего проблемы с STDR5000200 и STDR4000200.
Пытаясь найти решение я задействовал usb-quirks, но
это не помогает.
$ cat /etc/modprobe.d/usbquirks.conf
# Disable UAS for Seagate Backup Plus as it causes problems.
# Flag u means disable UAS
# Flag t - US_FL_NO_ATA_1X fix
# https://en.opensuse.org/SDB:USB_3.0_Hard_Drive_troubleshooting
options usb-storage quirks=0bc2:ab24:u
#options usb-storage quirks=0bc2:ab30:t
options usb-storage quirks=0bc2:ab30:u
options usb-storage quirks=0bc2:ab28:u
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1584557
options usbcore autosuspend=-1
Также бесполезно отключать кеширование
$ cat limit_write_cache.sh
#!/bin/sh
# 4 mb disk write cache
echo 4194304 > /proc/sys/vm/dirty_bytes
echo 4194304 > /proc/sys/vm/dirty_background_bytes
При замедлении записи dmesg содержит вот такие сообщения:
[ 8107.835162] INFO: task mc:2604 blocked for more than 120 seconds.
[ 8107.835165] Tainted: P O 4.19.43-std-def-alt1 #1
[ 8107.835165] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 8107.835167] mc D 0 2604 2602 0x00000000
[ 8107.835170] Call Trace:
[ 8107.835179] ? __schedule+0x2c5/0x880
[ 8107.835182] schedule+0x28/0x80
[ 8107.835185] schedule_preempt_disabled+0xa/0x10
[ 8107.835186] __mutex_lock.isra.7+0x313/0x500
[ 8107.835189] ? radix_tree_lookup_slot+0x1e/0x50
[ 8107.835199] flush_commit_list+0xa1/0x680 [reiserfs]
[ 8107.835206] get_list_bitmap+0x82/0xd0 [reiserfs]
[ 8107.835211] do_journal_end+0xaf5/0xd90 [reiserfs]
[ 8107.835217] reiserfs_end_persistent_transaction+0x1d/0x60 [reiserfs]
[ 8107.835222] reiserfs_write_end+0xe3/0x2d0 [reiserfs]
[ 8107.835227] generic_perform_write+0x138/0x1b0
[ 8107.835230] __generic_file_write_iter+0xfa/0x1c0
[ 8107.835232] generic_file_write_iter+0xe8/0x1f2
[ 8107.835235] new_sync_write+0xfb/0x160
[ 8107.835251] vfs_write+0xa5/0x1a0
[ 8107.835258] ksys_write+0x57/0xd0
[ 8107.835265] do_syscall_64+0x62/0x150
[ 8107.835271] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 8107.835277] RIP: 0033:0x7feab0618261
[ 8107.835290] Code: Bad RIP value.
[ 8107.835293] RSP: 002b:00007ffdcd5305b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[ 8107.835298] RAX: ffffffffffffffda RBX: 0000000000f15960 RCX: 00007feab0618261
[ 8107.835301] RDX: 0000000000020000 RSI: 0000000000f15960 RDI: 000000000000000b
[ 8107.835303] RBP: 0000000000020000 R08: 0000000000000000 R09: 0000000000000000
[ 8107.835305] R10: 000690b61c276f93 R11: 0000000000000246 R12: 000000000000000b
[ 8107.835308] R13: 0000000000f15960 R14: 00000001b7a40000 R15: 0000000000f07490
[46747.319091] perf: interrupt took too long (3162 > 3138), lowering kernel.perf_event_max_sample_rate to 63000
[51254.862506] perf: interrupt took too long (4007 > 3952), lowering kernel.perf_event_max_sample_rate to 49000
Команда sync отрабатывает, но отключить диск с помощью меню "Безопасно отключить носитель" в cinnamon не получается.
Отключение вручную
после команды sync, размонтирования и ожидания порядка 10 сек (вывод dmesg):
[14246.142836] usb 1-1.3: USB disconnect, device number 9
[14246.152294] sd 7:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
[14246.152311] sd 7:0:0:0: [sdb] tag#0 CDB: Write(16) 8a 00 00 00 00 00 00 00 72 a8 00 00 00 08 00 00
[14246.152313] print_req_error: I/O error, dev sdb, sector 29352
[14246.152316] Buffer I/O error on dev sdb1, logical block 3413, lost sync page write
Подключение диска (usbquirks задействованы):
[ 2275.482020] usb-storage 1-1.3:1.0: USB Mass Storage device detected
[ 2275.482192] usb-storage 1-1.3:1.0: Quirks match for vid 0bc2 pid ab28: 800000
[ 2275.482244] scsi host7: usb-storage 1-1.3:1.0
[ 2275.482346] usbcore: registered new interface driver usb-storage
[ 2275.484468] usbcore: registered new interface driver uas
[ 2276.493624] scsi 7:0:0:0: Direct-Access Seagate BUP BK 0304 PQ: 0 ANSI: 6
[ 2276.497920] sd 7:0:0:0: [sdb] Spinning up disk...
[ 2277.515886] ..........ready
[ 2286.728267] sd 7:0:0:0: [sdb] Very big device. Trying to use READ CAPACITY(16).
[ 2286.728616] sd 7:0:0:0: [sdb] 9767541167 512-byte logical blocks: (5.00 TB/4.55 TiB)
[ 2286.728618] sd 7:0:0:0: [sdb] 2048-byte physical blocks
[ 2287.197593] sd 7:0:0:0: [sdb] Write Protect is off
[ 2287.197597] sd 7:0:0:0: [sdb] Mode Sense: 4f 00 00 00
[ 2287.198765] sd 7:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 2287.324330] sdb: sdb1
[ 2287.327487] sd 7:0:0:0: [sdb] Attached SCSI disk
[ 2292.754216] REISERFS (device sdb1): found reiserfs format "3.6" with standard journal
[ 2292.754269] REISERFS (device sdb1): using ordered data mode
[ 2292.754270] reiserfs: using flush barriers
[ 2292.857261] REISERFS (device sdb1): journal params: device sdb1, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30