[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?

Definitive answer: I created a loopback FAT32 filesystem, mounted it, 
and did a "strace mv file file2":
rename("file", "file2")               = 0


On 2018-02-03 07:29, Chris Green wrote:
> On Sat, Feb 03, 2018 at 09:50:31AM +0000, Chris Green wrote:
>> I want to rename some picture files on a mounted digital camera
>> filesystem.  It is a VFAT filesystem.
>> If I rename one of the files using 'mv <xxxx.yyy>' will the file
> Typo of course, I meant 'mv file1 file2'.
>> *actually* be renamed by changing the directory entry only or will
>> mv copy the file to one with the new name and then delete the old one?
> Thanks for the answers so far but to re-emphasise why I asked the
> question:-
>     I know that mv of a file in a directory on a Linux type filesystem
>     will just write the new name of a file in the directory without
>     moving the data/contents of the file.
>     However in different circumstances (e.g. across filesystems) it
>     *can't* do this and has to copy/delete.  I was just asking if
>     anyone knows if 'mv file1 file2' on a VFAT (i.e. not native Linux)
>     filesystem does the 'easy' thing (copy/delete) or not.
> --
> Chris Green