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.
吃着吃着饭,饭碗被人抢了,能不出事儿吗?
同一分区没有问题,linux 用的是 inode,只要还有一个进程使用文件,你删掉文件都可以继续读写。有时候误删文件都是根据这个道理去挽救的。
不同分区就会造成不同的 inode,会有奇怪的现象发生。