Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the umount command in Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to use the umount command in Linux". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn how to use the umount command in Linux.

The Linux common command umount command is used to unmount a file system that has already been mounted. You can umount the file system using either the device name or the mount point, but it is best to unmount it through the mount point to avoid confusion when using a bind mount (one device, multiple mount points).

Umount is used to unmount a file system that has been loaded

Syntax umount (options) (parameters) option-a: dismount all file systems recorded in / etc/mtab;-h: show help;-n: do not store information in / etc/mtab file when dismounting;-r: if it cannot be dismounted successfully, try to mount the file system read-only;-t: dismount only the file system specified in the option;-v: display detailed information during execution -V: displays version information. Parameter file system: specify the file system to unmount or its corresponding device file name.

For example, the following two commands unmount the file system through the device name and mount point, respectively, and output details:

Uninstall by device name

Umount-v / dev/sda1 / dev/sda1 umounted is unloaded through the mount point

Umount-v / mnt/mymount/ / tmp/diskboot.img umounted Uninstall fails if the device is busy. A common reason for uninstallation failure is that the current directory of an open shell is a directory in the mount point:

Umount-v / mnt/mymount/ umount: / mnt/mymount: device is busy umount: / mnt/mymount: device is busy sometimes, the reason why the device is busy is not easy to find. When you encounter this situation, you can use lsof to list the open files, and then search the list to find the mount points to uninstall:

Lsof | grep mymount finds the open file bash 9341 francois cwd DIR 8 in mymount partition 1 1024 2 / mnt/mymount. From the output above, we can see that the reason why mymount partition cannot be uninstalled is that francois is running a bash process with PID 9341.

Another way to deal with busy system files is to perform a delayed uninstall:

Umount-vl / mnt/mymount/ performing a delayed unmount (lazy unmount) unmounts the file system in the directory tree immediately and does not clean up all related resources until the device is no longer busy. You can also use the eject command to uninstall removable storage media. The following command uninstalls cd and pops up CD:

Eject / dev/cdrom uninstall and pop up CD above is all the contents of the article "how to use umount commands in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report