Imagine a bunch of processes using a
/home/user/logs directory. They have some logs open for a longer time.
Yes, under certain conditions. The inodes of the files won't change if you move their parent directory, so the open file handles will still be valid. The conditions are:
- You don't move the directory across filesystems. That'd change the inode numbers of the files, of course.
- The processes actually do keep the files open, and don't close them on occasion (if so, you'll have to reconfigure the applications to make them aware of the new parent directory)
- You're using ext2/3/4 or one of the various versions of ufs out there. I can't honestly speak about other fileystems because I'm not sure how they're organised internally.
Processes usually do not keep files open in logs for long.
Yes, you can move / delete any directory or file which is in use by any process at any time. Heck, you can delete the process' executable while it is running and it will continue to run.
However, prepare for some possible scenarios:
- when processes will reopen for writing log files they will recreate them.
- processes will continue to write to the old location not the new one
- if you delete the executable of a process, you will not be able to start it again
Files will be physically cleared on delete when no process will use their descriptors. You will see the files moved / deleted immediately.