From FreeBSDwiki
Jump to: navigation, search
The Mediawiki system (the 'software' that runs this site) capitalises all articles. Please note that commands on most UNIX and Unix-like systems are entered in lower case. As an example the article documenting the Ln command would be issued from the command line as 'ln'.

The umount command is used to unlink a file system from the local host, usually a file system previously linked using the mount command.

Typically the umount command is used to release a CD or DVD-ROM drive so that it can be ejected, allow a USB memory key to be cleanly unmounted before unplugging it (Microsoft Windows has a similar function to safely remove devices) or any other file system linked to the local host.

Example use

An example pf the unmount command:

# umount /mnt/cdrom

This simply unlinks the CD-ROM drive (or rather the 'file system' stored on the physical media) from the local host.


The umount command will not unlink a file system that is in use. While this may sound obvious it can often catch-out even the best sysadmins. This could be caused by opening a file for editing or simply having the mount-point as the current directory, as per the following example:

# mount_cd9660 /dev/acd0 /mnt/cdrom/
# cd /mnt/cdrom/
# ls
.cshrc          INSTALL.HTM     boot.catalog    media           sys
.profile        INSTALL.TXT     cdrom.inf       mnt             tmp
6.3-RELEASE     README.HTM      dev             packages        tools
COPYRIGHT       README.TXT      docbook.css     proc            usr
ERRATA.HTM      RELNOTES.HTM    etc             rescue          var
ERRATA.TXT      RELNOTES.TXT    floppies        root
HARDWARE.HTM    bin             lib             sbin
HARDWARE.TXT    boot            libexec         stand
# umount /mnt/cdrom
umount: unmount of /mnt/cdrom failed: Device busy

This example shows how a user could mount a CD-ROM file system and enter into the '/mnt/cdrom' mount-point before trying to unlink it. This creates an error noting the device (in this case, the CD-ROM drive) is busy. To resolve this problem the user would simply need to do the following:

# cd ..
# umount /mnt/cdrom

Which returns the user to the '/mnt' directory and releases the file system from use.

Other possible causes is mounting and entering into a linked file system as a general user and then using the su command to operate as the root user then, while as root, trying the umount command. The file system remains locked under the general user's session. In this case the user must exit out of the root user session and release the file system before trying again.

The fstat command can be used to identify open, or active, files on the locally attached file systems.

See also

See also related articles: mount, etc/fstab and fstat.

Personal tools