coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mv: move files across bind mounts using the rename syscall


From: Rob Landley
Subject: Re: mv: move files across bind mounts using the rename syscall
Date: Sat, 14 Dec 2024 07:39:55 -0600
User-agent: Mozilla Thunderbird

On 12/6/24 06:07, Milan Hauth wrote:
currently mv fails to detect an identical filesystem
of source and destination file across bind mounts

instead of using the rename syscall
mv copies the file (to the same filesystem)
and then deletes the source file

obviously, this is not ideal:

- slow
- waste of disk space
- change of inode number
- unnecessary disk write operations (destructive)

currently mv fails to detect an identical filesystem
of source and destination file across bind mounts

this is possible using /proc/self/mountinfo
proof of concept:
https://github.com/milahu/move-files-across-bind-mounts

Is there a downside to always trying rename() first and doing the copy if it fails? That's approximately what toybox's mv does...

Rob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]