1

this has been bugging me since yesterday. I was using GNOME Files (Nautilus) to move a video file from the 'Downloads' folder to an NTFS drive. Now when I cut and pasted the file it instantly appeared in the target destination (Separate NTFS filesystem, using ntfs-3g on the same hard drive). I know when you move files from one filesystem to another it essentially copies and then removes the file (correct me if I'm wrong) But I 'shift+delete' the file in a hurry from source and moments later discovered that File manager was still moving the file to NTFS filesystem, even after I deleted the file from source and it disappeared. After the moving bar reached to 100% it gave me an error. But I checked the target destination and the file was still moved to the destination and it played fine.

So, what really happened here? Do the file operations on Linux work subsequently, to not interrupt the moving operation? Or the file that was moved to my target destination would be corrupt? or was the error due to the last copying operation while the file was moving because the moving operation would've deleted the file anyway?

2 Answers 2

3

Deleting a file does not scrub its data (contents) – it only removes the metadata saying that the file is there, and marks the corresponding disk space as "free for later use".

But more importantly, the OS will keep said metadata around for as long as it needs. Even after you unlink the file from its directory (or from all directories if it had multiple hardlinks), the OS will not delete the actual file as long as at least one process keeps it open. So the file is still there – just nameless (but still occupying its space) during the rest of the copy operation.

I did say "copy operation" because computers cannot physically move data between disks – first the file is copied to the destination, then the original file is deleted. That's actually why you received the error message: your file manager uses two separate operations (copy and delete); the copy succeeded, but the deletion failed (because you had already deleted it).

3

On Linux, you can delete opened files in most cases. That will make the file disappear from directory listings. The space the file occupied however will only be released after the file is no longer in use.

What failed in your case was only the last step of a move operation: Removing the source file/directory.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .