mount — Attach a filesystem to a directory in the tree across all 5 shells
Equivalents in every shell
sudo mount /dev/sdb1 /mnt/dataBacked by `util-linux`. Auto-detects most filesystems via libblkid; pass `-t <fs>` (e.g. `-t ext4`, `-t ntfs`, `-t cifs`) when probing fails. The common option triplet `-o ro,noatime,nofail` covers read-only durable mounts that should not break boot if the device is absent.
sudo mount /dev/sdb1 /mnt/dataIdentical `/sbin/mount` binary as bash on Linux. On macOS the binary is BSD `mount(8)` instead — flag set differs (no `-o nofail`); the canonical macOS path is `diskutil mount /dev/disk2s1` for removable media and `hdiutil attach` for `.dmg` / `.iso` images.
sudo mount /dev/sdb1 /mnt/dataSame external binary — fish never reinterprets the arguments. Spaces in mountpoints still need quoting: `sudo mount /dev/sdb1 "/mnt/My Backup"`. To run with sudo non-interactively in scripts, configure `NOPASSWD` for the specific mount line in `/etc/sudoers.d/`.
New-PSDrive -Name D -PSProvider FileSystem -Root \\server\share -PersistTwo distinct patterns. `New-PSDrive` maps a drive letter (session-only by default; `-Persist` writes through to the Windows MUP mount table so File Explorer sees it). `Mount-DiskImage -ImagePath disk.iso` mounts ISO / VHD / VHDX files as virtual drives. `Mount-WindowsImage` mounts WIM images for offline servicing.
mountvol C:\Mount \\?\Volume{guid}\cmd has no Unix-style `mount`. `mountvol` attaches a volume GUID to an empty NTFS folder (Windows volume mount points). For drive letters: `subst X: C:\some\path` (session-scoped, not persisted across reboots). Network shares: `net use Z: \\server\share /persistent:yes`.
Worked examples
Mount an ISO file (read-only)
sudo mount -o loop,ro disk.iso /mnt/isoMount-DiskImage -ImagePath C:\path\to\disk.isopowershell -Command "Mount-DiskImage -ImagePath C:\path\to\disk.iso"Mount an SMB / CIFS network share
sudo mount -t cifs //server/share /mnt/share -o username=alice,uid=$(id -u)New-PSDrive -Name Z -PSProvider FileSystem -Root \\server\share -Persistnet use Z: \\server\share /persistent:yesList current mounts in a readable form
mount | column -tGet-PSDrive -PSProvider FileSystemmountvolGotchas
- `mount` requires root on Linux unless `/etc/fstab` lists the entry with the `user` (or `users`) option, which lets a non-root user mount and unmount that exact device. Without the flag the typical "must be superuser" failure appears even when the user owns the mountpoint.
- On macOS `/etc/fstab` is honored but the canonical way to attach removable / image media is `diskutil mountDisk` or `hdiutil attach`. Plain BSD `mount(8)` only speaks filesystems the kernel ships natively (HFS+, APFS, exFAT, FAT32, read-only NTFS). For writeable NTFS or ext4 on macOS, you need a userspace driver (macFUSE + ntfs-3g / fuse-ext2).
- PowerShell `New-PSDrive` WITHOUT `-Persist` is **session-only** — the drive vanishes the moment the PowerShell session closes. `-Persist` requires `-Root` to be a UNC path AND the drive name to be a single letter; it then writes through `net use` so File Explorer sees the mapping. `-Persist` cannot persist non-UNC roots (e.g. a local folder).
- `Mount-DiskImage` returns immediately with the ImageObject, but the assigned drive letter is NOT in the return value. Discover it via `Get-DiskImage -ImagePath ... | Get-Volume | Select DriveLetter` (or pre-assign with `Set-Partition -AccessPath`). Scripts that `Start-Sleep 1` before reading the letter are racy on slow disks.
- CIFS / SMB on Linux: `uid=` and `gid=` mount options are how the logged-in user gets write access — the server typically does not preserve POSIX ownership, and without those the kernel reports every file as owned by root. Pair with `iocharset=utf8,vers=3.1.1` for Unicode filenames against modern Windows / Samba servers.