1) What will happen if you use the mv command to remove the file being read in the Linux system?
For example, file 1.txt is being read by process A. If I use the mv command to move 1.txt to another directory, will process A make an error?
2) What will happen if mv removes the file being written?
For example, file 2.txt is being written to data by process B. If you use the mv command to move 2.txt to another directory, will process B make an error?
There are two situations for mv to move files to other directories:
1) Move to a different directory in the same partition
2) Move to a different directory in a different partition
Will there be different results for mv movement in the above two situations?
Please give me some advice.
滿天的星座2017-05-18 10:53:33
There is no problem with the same partition. Linux uses inode. As long as there is another process using the file, you can continue to read and write if you delete the file. Sometimes accidentally deleted files are saved based on this principle.
Different partitions will cause different inodes, and strange phenomena will occur.