osdir.com


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

Does mv on a FAT filesystem actually rename or does it copy and delete?


>PPS: IOW I was mistaken, you seemingly ask, if the operation is atomic.
>Yes, "mv" within the same partition/directory does "rename", it does
>not copy and remove (delete).
>
>However, I might be mistaken, so use google, or much better run strace.
>
>[rocketmouse at archlinux ~]$ cd /tmp/dir_3/
>[rocketmouse at archlinux dir_3]$ ls -hAl
>total 0
>-rw-r--r-- 1 rocketmouse rocketmouse 0 Feb  3 11:46 test_new
>[rocketmouse at archlinux dir_3]$ strace mv -i test_new test_new_2
>[snip]
>rename("test_new", "test_new_2")        = 0
>[snip]
>+++ exited with 0 +++
>[rocketmouse at archlinux dir_3]$ ls -hAl
>total 0
>-rw-r--r-- 1 rocketmouse rocketmouse 0 Feb  3 11:46 test_new_2

My apologize for the confusion, sometimes it's not easy to understand
a novice's request at the first time ;). As already pointed out above,
it does change the directory entry, it does not copy and rename
(delete). It plausibly shouldn't work that way, when coping a dir or
file to another partition/mount point. Anyway, "strace" still is your
friend to verify or falsify my claim.