Skip to main content

Command Palette

Search for a command to run...

Cheat Sheet #day69 - umount

Published
2 min read
Cheat Sheet #day69 - umount

umount Command Cheatsheet

The umount command in Unix-like systems is used to unmount filesystems and network shares from the directory tree. It is essential for safely detaching storage devices and network mounts. Here’s a quick reference guide:

Basic Syntax

umount [OPTION]... [DIRECTORY | DEVICE]

Common Options

  • -f, --force: Force unmount (terminate processes using the mounted filesystem).

      umount -f /mnt/data
    
  • -l, --lazy: Detach filesystem immediately, but clean up later (often used with NFS mounts).

      umount -l /mnt/nfs
    
  • -r, --read-only: Unmount the filesystem as read-only.

      umount -r /mnt/data
    
  • -v, --verbose: Verbose mode, print detailed information during the unmount operation.

      umount -v /mnt/data
    

Examples

  1. Unmount a directory:

     umount /mnt/data
    
  2. Force unmount a directory (terminate processes using it):

     umount -f /mnt/data
    
  3. Lazy unmount (detach immediately, clean up later):

     umount -l /mnt/nfs
    
  4. Unmount a read-only filesystem:

     umount -r /mnt/data
    

Additional Information

  • List mounted filesystems:

      mount
    
  • Help option:

      umount --help
    
  • View manual page for umount:

      man umount
    

The umount command is essential for safely unmounting filesystems and network shares in Unix-like systems. It ensures that all data is flushed to disk and processes using the mounted filesystem are gracefully terminated. For more detailed options and usage scenarios, refer to the man page or use umount --help.

Cheat Sheets

Part 1 of 50

These cheat sheets are designed to be quick reference materials, offering condensed information, tips, and best practices in a easy to understand format.

More from this blog

Cloud Tuned

629 posts

Your starting point for anything cloud: AWS, Azure, GCP, Serverless, Architecture, Hybrid Cloud, Systems Design and other Information Technology topics.