Question:
How can I make the current terminal window give up all its file & dir locks so I can umount?
Setup:
I've written a PHP CLI script to mount or dismount my TC volumes.
I run the script from the terminal and wait a few seconds for it to finish.
(Just to be clear: The script does not keep running and it does not access anything inside the mounted volume. The problem occurs whether I use the PHP script or type the commands manually. Its just to automate the process of mounting and dismounting volumes.)
Steps to reproduce problem:
(I will just paste the relevant lines so you can see what commands I'm using, there are various validations before and after each command, so don't worry about the variable names)
* Mount a truecrypt volume with tcplay inside a terminal window using these commands
Quote:
sudo mkdir $mountpath
sudo losetup $firstloop $tcpath/$tcfile
sudo tcplay -m $tcmapname -d $loop
|
* Use the TC volume from other programs, close them all when done. (might be optional)
* Fiddle around with files and dirs inside the mounted volume.
* cd / (so I'm not *in* the mounted volume when I try umount)
* Try umount the TC volume from the same terminal window that I mounted it with.
it complains that the TC volume is in use.
Workaround:
* CLOSE the terminal window then open a NEW terminal window and give the umount command.
Interesting:
* In the past I tried some command to kill locking processes on that volume, it was really funny. it closed the terminal I entered the command in.
* If I just mount from terminal x, use other terminals or programs, then dismount from terminal x it dismounts cleanly without any error.
First prize:
Some command that makes the current terminal session give up any locks it's holding on any files/dirs. That would be awesome.
OS:
Linux Mint 15 x64 (based on Ubuntu 13.04), Mate 1.6, Main shell: zsh, scripts: PHP or Bash