Public bug reported:

Description:
I have a problem with very slow data writing to external USB drives (flash 
drive, SSD) on Ubuntu. The problem manifests itself by quickly reaching 100% 
copy progress in the file manager (e.g. Dolphin), but in reality the data is 
stored in buffer memory for a long time, which causes the device to lock up 
until the write to the disk is complete.

Steps to reproduce the problem:
- Format a flash drive or external USB drive to the FAT32, NTFS or ext4 file 
system.
- Copy a large file (several hundred MB to several GB) to this device using a 
file manager (such as Dolphin).
- Observe the result in /proc/meminfo (Dirty field), where you can see large 
write buffers even after the copy is completed according to the file manager.
- Note that the “safe disconnect device” operation takes a very long time.

Expected behavior:
Copying should be more predictable and consistent, with minimal delay after the 
copy is completed in the file manager. The disconnect operation should be 
immediate or much faster.

Additional information:
- File systems tested: FAT32, NTFS, ext4.
- The problem occurs regardless of the use of the UAS driver (tested no UAS).
- grep Dirty /proc/meminfo shows large write buffers, e.g. over 500-700 MB, 
despite completion of copy operation.
- I tested various settings:
  * Changing parameters in /sys/block/sdX/queue/ (e.g. nr_requests, scheduler) 
- no effect.
  * Temporary use of sysctl vm.dirty_bytes=.... helps, but is suboptimal as a 
permanent solution.

Comments:
I believe the problem is related to memory management in Linux, as the write 
buffer is stored too long in RAM. This may be an oversight in the default 
configuration of the Linux kernel, especially for USB devices.

Please advise if this is a Linux kernel bug or if some other permanent
solution is possible.

Operating System: Kubuntu 24.10
KDE Plasma Version: 6.1.5
KDE Frameworks Version: 6.6.0
Qt Version: 6.6.2
Kernel Version: 6.11.0-9-generic (64-bit)
Graphics Platform: Wayland
Processors: 12 × 11th Gen Intel® Core™ i5-11600 @ 2.80GHz
Memory: 31.2 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7D18
System Version: 1.0

ProblemType: Bug
DistroRelease: Ubuntu 24.10
Package: linux-image-6.11.0-9-generic 6.11.0-9.9
ProcVersionSignature: Ubuntu 6.11.0-9.9-generic 6.11.0
Uname: Linux 6.11.0-9-generic x86_64
ApportVersion: 2.30.0-0ubuntu4
Architecture: amd64
AudioDevicesInUse:
 USER        PID ACCESS COMMAND
 /dev/snd/seq:        norbert    1969 F.... pipewire
 /dev/snd/controlC0:  norbert    1971 F.... wireplumber
CasperMD5CheckResult: unknown
CurrentDesktop: KDE
Date: Tue Nov 19 21:08:05 2024
InstallationDate: Installed on 2023-11-01 (384 days ago)
InstallationMedia: Kubuntu 23.04 "Lunar Lobster" - Release amd64 (20230414.1)
IwConfig: Error: [Errno 2] Nie ma takiego pliku ani katalogu: 'iwconfig'
MachineType: Micro-Star International Co., Ltd. MS-7D18
ProcFB: 0 i915drmfb
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-6.11.0-9-generic 
root=UUID=f081704b-dad4-47c8-bc4b-28a38205a750 ro quiet loglevel=3 splash 
nvme_core.default_ps_max_latency_us=0 vt.handoff=7
PulseList: Error: command ['pacmd', 'list'] failed with exit code 1: No 
PulseAudio daemon running, or not running as session daemon.
RelatedPackageVersions:
 linux-restricted-modules-6.11.0-9-generic N/A
 linux-backports-modules-6.11.0-9-generic  N/A
 linux-firmware                            20240913.gita34e7a5f-0ubuntu2
SourcePackage: linux
UpgradeStatus: Upgraded to oracular on 2024-10-11 (39 days ago)
dmi.bios.date: 07/06/2024
dmi.bios.release: 5.19
dmi.bios.vendor: American Megatrends International, LLC.
dmi.bios.version: 1.90
dmi.board.asset.tag: Default string
dmi.board.name: B560M PRO-VDH (MS-7D18)
dmi.board.vendor: Micro-Star International Co., Ltd.
dmi.board.version: 1.0
dmi.chassis.asset.tag: Default string
dmi.chassis.type: 3
dmi.chassis.vendor: Micro-Star International Co., Ltd.
dmi.chassis.version: 1.0
dmi.modalias: 
dmi:bvnAmericanMegatrendsInternational,LLC.:bvr1.90:bd07/06/2024:br5.19:svnMicro-StarInternationalCo.,Ltd.:pnMS-7D18:pvr1.0:rvnMicro-StarInternationalCo.,Ltd.:rnB560MPRO-VDH(MS-7D18):rvr1.0:cvnMicro-StarInternationalCo.,Ltd.:ct3:cvr1.0:skuDefaultstring:
dmi.product.family: Default string
dmi.product.name: MS-7D18
dmi.product.sku: Default string
dmi.product.version: 1.0
dmi.sys.vendor: Micro-Star International Co., Ltd.

** Affects: linux (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug oracular wayland-session

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2089058

Title:
  Problems with caching and write performance on USB devices on Linux
  (FAT32, NTFS, ext4)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2089058/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to