I know that rsync
with --remove-source-files
(which I use instead of mv
so I can merge directory hierarchies) creates new inodes:
stat 2021_07_30_20_18_17.pdf~
rsync --remove-source-files 2021_07_30_20_18_17.pdf~ 2021_07_30_20_18_17.pdf~.moved
stat 2021_07_30_20_18_17.pdf~.moved
Device: 805h/2053d Inode: 4850411 Links: 1
Device: 805h/2053d Inode: 4849693 Links: 1
Since it's allocating a new inode, does that mean it allocates new space for the target file? Or does --remove-source-files
just make the new inode point to the memory locations of the original file?
Background
The reason I'm asking is because I've got a drive that is very slow due to huge directory hierarchies with big and small files mixed together) and I'm guessing this makes fragmentation worse. Since most Linux file systems don't experience fragmentation, there isn't a simple tool to defragment like on Windows.
I know I can rsync to a new drive to reduce fragmentation, but what about to the same drive? Does moving of files work the same way from a memory allocation perspective?