3 ms·
There are different things that "move" can mean. rename(2) can "move" in a safe way, but not across devices. > Atomic file system changes are simply a nice sid
by jstimpfle 11y ago
There are different things that "move" can mean. rename(2) can "move" in a safe way, but not across devices.
> Atomic file system changes are simply a nice side effect.
Disagree.
Also, my article was to show how mv's task is so complex that it can fail and eat your data even if atomicity is not a requirement.
- erikb 11y agoOkay, haven't got that so far. Maybe I'm missing some skillset to understand.
- washadjeffmad 11y agoYou've understood the general use description of mv (copy-rename-delete), but what OP demonstrates is a situation in which it does something unexpected (and inappropriate) when dealing with mounted directories. See the part where he creates file 'bar' in mounted directory /mnt, attempts to move /mnt within itself to /mnt/foo, then asks to show the directories containing /mnt. The result is that the mv fails (so it shouldn't do anything, right?), but still creates an additional directory (/mnt/foo) that now contains 'bar' and has (destructively) altered the fs hierarchy. However, when he tries it again after unmounting /mnt, the behavior is completely normal for any other file-- mv fails, nothing happens, /mnt/bar hierarchy is preserved, no /mnt/foo created.
- erikb 11y agoThanks, now I understand what's going on! Great explanation!