2

Ubuntu Studio 22.04.

Used rsync to try to copy about 47 GB from one NTFS volume to another. (Yes, I know I'm going to get scolded for using NTFS. Next time I get a HD I'll format it to fat something. But I'm stuck with this for now.)

Edit (add command):

rsync -a --progress /media/xxx/Elements\ SE/dir/dir/dir/ /media/xxx/T7/dir/dir/dir/

The entire UI locked up after about half of it was copied. Not even ctrl-alt-F2 helped.

This has happened multiple times.

There are some places in an OS where I'd expect some form of contention to knock out the system's responsiveness. File copying is not high on that list. So I wonder what I can do, apart from reserving these operations for Windows machines.

Thanks.

2 Answers2

2

Decrease of transfer rate when copying large amount of data

Decrease of transfer rate when copying large amount of data

Very slow copying files from ExFat to NTFS

Hardware Forum 11/22 https://ubuntuforums.org/showthread.php?t=2502523&page=2

The "slow copy" or "decrease of transfer rate when copying large amount of data" are known problems, with many askubuntu questions and launchpad bugs filed. Previous postings have covered most of the things to check, but to reiterate:
1 ) Check the specs on Your MB PCIE M.2 slots -- if different, use a fast one (PCIE5 vs PCIE4) for your target.

2)Ensure your partitions/filesystems are aligned properly -- 1MB or even 4MB.

3)System buffers fill up when writes are slower than reads, which is the usual case. Things slow down when buffers fill. Using the nocache command on a terminal copy will at least prevent the input stream from being buffered.

4)The "time" command is usless for determining write speeds, the copying process finishes minutes before the system buffers get flushed. Force the flush with a sync or watch the blinking lights for disk activity to determine the actual finish of the copy.

5)Some copy commands (tar, cpio,...)allow you to specify a buffer size -- this may help in limiting memory fragmentation, speeding things up a bit. The tar command -L size option will pause for user input after "size" kiB have been written. Separately monitor the available memory (free command), and only continue when enough available memory is present (disk buffers will be flushing).

6)There are tweaks that may help for specific cases -- different scheduler, altering dirty write bits or rations, but the filling of system buffers will eventually drag things to a crawl. Slowing the reads down to the write speeds is the goal of such alterations. Most of the suggestions for tweaks were for hard disks, SSDs are likely to have completely different optimizations.

Follow the previous suggestions for seeing what helps your situation the most. Understand, this is an unresolved problem that prevents some people from using Linux for their work -- they simply cannot back up their data sets in a timely manner. Good luck, and interested in seeing what you find helps you the most.


For some insight into the problem, the free command will show you swap space used, and the /proc/buddyinfo file has memory fragmentation information. The alt+sysreq (or echo m > /proc/sysrq-trigger) should cause memory info to be entered into /var/log/messages.

On a 16GB memory, 11gen I7 11800H cpu, USB3.2 gen1 with a two TB SSD as target, a 300 GB directory copy from an internal SSD (PCI4)took approx 30 min with the below command:

sudo nocache tar c --record-size=500M -f- . |(cd /mnt/a2; sudo tar -xpBf -)

No noticeable impact on system performance was noticed (cursor never froze etc.).

ubfan1
  • 19,049
1

The other answer mentions System buffers fill up when writes are slower than reads could be a cause of the issue.

Linux has the O_DIRECT option (see man 2 open) which can be used to make file writes or reads bypass the system buffers (file system cache).

On searching found direct-io.diff which is a patch to rsync with the description:

This patch adds the --direct-io option, which opens files with O_DIRECT.

Looking at rsync version 3.2.7, installed on a Ubuntu 24.04.2 LTS system, shows that version doesn't support the --direct-io option. That option isn't in the man page, nor output of rsync --help, and attempting to use it get:

$ rsync --direct-io
rsync: --direct-io: unknown option
rsync error: syntax or usage error (code 1) at main.c(1795) [client=3.2.7]

It you are able to build rsync from source, and use the patched version on both ends, you could try applying the patch referenced above on github and see if using the --direct-io option helps to avoid the system locking up.