What is the difference between `cp`, `mv` and `rename` at the inode level?
AdvancedConceptFilesystem Hierarchy, Inodes & Links
Answer
cp creates a new inode and copies the data. mv within the same filesystem is just a rename() syscall that changes the directory entry: same inode, instant, atomic. mv across filesystems is copy + delete, not atomic. That is why safe config deploys write to a temp file in the same directory and then mv it into place.
More on Filesystem Hierarchy, Inodes & Links
Explain the purpose of the main top-level directories in the FHS.BeginnerWhat is the "/usr merge"?IntermediateWhat are /proc and /sys?BeginnerWhat is an inode? What does it store and what does it NOT store?BeginnerA disk shows free space but you get "No space left on device". Why?IntermediateWhat is a hard link?Beginner