Solaris: Unmounting a Filesystem with umount

Most filesystem mounting or unmounting is automated for a system at boot or shutdown, but there are times during system maintenance and working with NFS shares, for example, when manually unmounting a filesystem is important.


A filesystem in Solaris can be referenced by its device name (e.g., /dev/dsk/c0t0d0s0) or by the mount point in the filesystem (e.g., /usr or /export/home). The umount command can accept either reference as the target to unmount. Given the device /dev/dsk/c1t2d3s4 mounted on /mnt, umount could be called in two ways as seen below:

umount /dev/dsk/c1t2d3s4
umount /mnt

The latter usage is generally simpler to use and less prone to errors (i.e., typos or not knowing which device is mounted where).

The umount command, by default, will not unmount a filesytem that is busy (i.e., a program with an open file or a user’s current working directory in the mounted filesystem). If a filesystem fails to unmount, the best course of action is to use fuser to determine the processes using the filesystem and to safely end them. If you are certain that nothing important is running and, particularly, that no important files are open, you can try to forcibly unmount the filesystem with the -f option:

umount -f /mnt

 

About Quinn McHenry

Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
View more articles by Quinn McHenry

The Conversation

Follow the reactions below and share your own thoughts.