umount — Detach a mounted filesystem, flushing pending writes first across all 5 shells
Equivalents in every shell
sudo umount /mnt/dataPOSIX spelling is `umount` (one "n"). Either the source device or the mountpoint may be passed. `-l` (lazy) detaches the filesystem from the namespace immediately but defers the actual unmount until no process holds a reference — useful for hung NFS but DANGEROUS in scripts because `umount -l` always exits 0.
sudo umount /mnt/dataSame external. macOS has `umount` and also a higher-level `diskutil unmount /Volumes/Foo` (and `diskutil unmountDisk /dev/disk2` to unmount every slice on a physical disk). `diskutil` returns better diagnostics when the unmount is blocked by an open file.
sudo umount /mnt/dataSame external binary. To find which process is keeping the mount busy: `lsof +D /mnt/data` (or `fuser -vm /mnt/data` from `psmisc`). Killing the holder usually lets `umount` succeed without resorting to the lazy / force flags.
Remove-PSDrive -Name DFor `New-PSDrive` mappings: `Remove-PSDrive -Name D -Force` (with `-Force` if it is currently the location of the session). For `Mount-DiskImage` mounts: `Dismount-DiskImage -ImagePath disk.iso` (must pass the same path used to mount). The two are NOT interchangeable — calling the wrong one returns a misleading "drive not found".
mountvol C:\Mount /D`mountvol /D` removes a volume mount point. For drive-letter unmounts: `subst X: /D` (matching the original `subst`), `net use Z: /delete` (matching the original `net use`), or `mountvol X: /D` for `mountvol`-created drive letters. Each command only undoes mounts it created — they are not interchangeable.
Worked examples
Unmount and dismount an ISO image
sudo umount /mnt/isoDismount-DiskImage -ImagePath C:\path\to\disk.isopowershell -Command "Dismount-DiskImage -ImagePath C:\path\to\disk.iso"Disconnect a mapped network share
sudo umount /mnt/shareRemove-PSDrive -Name Znet use Z: /deleteForce-unmount a hung filesystem (only as a last resort)
sudo umount -f /mnt/nfssudo umount -f /mnt/nfsGotchas
- The spelling is `umount`, NOT `unmount`. Typing `unmount` on Linux returns "command not found"; on macOS it returns the same. (`diskutil unmount` is the only common command that uses the full "unmount" spelling.)
- `umount -l` (lazy) detaches the filesystem from the namespace but lets in-flight writes complete in the background. It ALWAYS returns 0 — even if the underlying device dies mid-flush. Production scripts should NEVER use `-l` and then assume the data is durable; pair with `sync` and an explicit `lsof` check.
- `umount -f` (force) is for NETWORK filesystems only — it kicks the kernel into discarding pending writes and returning errors to processes still holding the mount. For local ext4 / xfs it accomplishes nothing because the kernel needs to flush dirty pages before unmount; `-f` won't skip that step.
- `Remove-PSDrive -Persist`-ed drives need `Remove-PSDrive -Name Z` AND a separate `net use Z: /delete` if the drive was persisted via `net use` outside the current pwsh session — `Remove-PSDrive` only knows about session-scoped or pwsh-`-Persist`ed mappings. Using `net use Z: /delete` is the universal disconnect because it talks to the same MUP that File Explorer uses.
- Windows volume-mount-point removal via `mountvol /D` only removes the access path — the volume is still mounted, just unreachable from that folder. To take an entire volume offline use `Set-Disk -Number N -IsOffline $true` (PowerShell) or `diskpart` `offline volume`.