Renaming (with 'mv') very large files is SLOW

cygwin@kosowsky.org cygwin@kosowsky.org
Mon Jan 31 15:17:59 GMT 2022


Eliot Moss wrote at about 09:59:17 -0500 on Monday, January 31, 2022:
 > On 1/31/2022 9:52 AM, cygwin@kosowsky.org wrote:
 >  > I tried renaming some very large files (20-40 GB) using:
 >  >     mv <oldname> <newname>
 >  > without changing the directory of course.
 >  >
 >  > The process took about 10-20 minutes with Task Manager showing disk
 >  > activity of 100+ MB/s.
 >  >
 >  > Is there something about such large 'renaming' that actually results
 >  > in the file being really moved (aka copied) rather than just renamed?
 > 
 > The two places are probably on different volumes (loosely, different disks).
 > That requires a physical move, even under Linux.

No my point is I am just *renaming*, not physically moving the file!!
i.e., I am not changing the directory location of the file, let alone
the volume/disk location.
(I am well aware that 'mv' does a copy when changing volumes/disks).

I literally am typing something like:
  mv foo bar

In Linux, that just edits the file system table & inode...

UPDATE...
I just tried a second 'mv' and it was near instantaneous.
(and similarly with subsequent renaming of the same file)
So perhaps not a 'Cygwin' thing but something going on within Windows.

Could it be that the first 'mv' triggered an anti-virus read of the file since
perhaps it detects it as a new/changed file?

But if so, would 'mv' (under Task Manager) be showing the 100+ MB/s disk activity?


More information about the Cygwin mailing list