Filesystems Mount OSX – How to Prevent FS from Unmounting

filesystemsmountosxunmounting

I'm trying to back up a disk that has been acting very strangely lately, but my back-up attempts fail after a few minutes, because the disk's file system (at /dev/disk4) "spontaneously" unmounts. (I doubt this unmounting is literally "spontaneous", but to my ignorance it looks that way.)

I would like to "lock" the mount, so that no other process can unmount it (other than something like umount /dev/disk4 issued by me). Is there a way to achieve such a lock?

(The flavor of Unix I'm dealing with happens to be OS X, but I am interested in, say Linux-specific solutions too, since they may provide useful keyword for further Googling. Also solutions for any other BSD-ish flavor of Unix would be welcome.)

(It goes without saying that I am interested only in locking schemes that do not prevent me from backing up the disk!)

If there is no way to "lock the mount"
or how can I determine why the unmounting is happening?

Best Answer

If the mount is busy it shouldn't be able to unmount*.

An easy way to make a mount busy is to have at least one process with its CWD (Current Working Directory) under the mount point.


*Lazy unmounts will still return but it shouldn't actually unmount until the filesystem is no longer busy.

Related Question