#Is it bad practice to run umount -a instead of specifying the directory to unmount? I’ve always run umount -a to unmount my drive but i notice it unmounts a lot of other things. Is this bad?

  • Max-P@lemmy.max-p.me
    link
    fedilink
    English
    arrow-up
    11
    ·
    edit-2
    2 months ago

    On my computer that’d unmount my home directory, my external storage, my scratch space and my backup storage, and my NAS.

    It would also unmount /sys and /proc and /tmp and /run. Things can get weird fast without those, for example that’s where the Xorg/Wayland socket is located.

    If all you have is home and root on the same partition I guess it’s not too bad because it’s guaranteed to be in use so it won’t let you, but still, I wouldn’t do that to save like 5 keystrokes in a terminal.

    • billbasher@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      2 months ago

      It shouldn’t unmount those system dirs unless you have a really weird setup or specify with —types.

      From the man page:

      -a, --all All of the filesystems described in /proc/self/mountinfo (or

      in deprecated /etc/mtab) are unmounted, except the proc,

      devfs, devpts, sysfs, rpc_pipefs and nfsd filesystems. This

      list of the filesystems may be replaced by --types umount

      option.

      https://www.man7.org/linux/man-pages/man8/umount.8.html

      If you are using a system with snap like Ubuntu, it will unmount those since they are technically mounts. It will fail if an app is using the snap but subsequent opens of closed snaps will fail.

      Edit: Formatting

      • Max-P@lemmy.max-p.me
        link
        fedilink
        English
        arrow-up
        4
        ·
        2 months ago

        Fair enough, TIL. I’ve used mount -a a fair bit, but unmounting the world is not something that crossed my mind to even attempt. It would still unmount a good dozen ZFS datasets for me.

        Good example with the Snaps! Corrected my post.