mount

Establish a connection between a physical device and a directory (mount point)

linux darwin/BSD
mount -a [-F][-fnrsvw] [-t fstype]
mount [-fnrsvw] [-o options] [-t fstype] device directory
mount [-fnrsvw] [-o options [,…]] device | directory
mount [-hV]

Temporaily attach the file system which exists on device overlaying directory and update /etc/mtab

device name of a  block special device, like: /dev/sda1
or
an NFS mount like knuth.cwi.nl:/sharedVolum
-a All filesystems set auto in /etc/fstab of the given -t fstypes.
-r read-only
-w read/write.
-n no writing to /etc/mtab. Useful when /etc/fstab is not writable.
-ffake the actual mount. useful in conjunction with -v to determine what the mount is trying to do.
Can be used to add entries for devices that were mounted earlier with -n.
-s sloppy mount options don't cause exit
-L label partition specified by label.
-U u-u-i-dpartition specified by u-u-i-d
-o other :
  • [a]sync I/O to the file system should be done [a]synchronously.
  • [no]atime access time updating. default noatime
  • auto |noauto will be mounted with -a .
  • ro | rw : read-only|read-write
  • suid Allow set-user-identifier or set-group-identifier bits to take effect.

-t fstype   MSDOS, e2fs, reiserfs, NTFS
-F Fork a process for each device and NFS servers in parallel.
NFS timeouts will be independent, i.e. if one server or device is unavailable it won't hold up the other mounts.
Mounts are done in undefined order.
Do not use this for both /usr and /usr/spool.
-h  
-V Version
-v verbos

File system specific types

ufs local UNIX
cifs
SMB
MS windows, NAS, Samba
msdos DOS compatible
nfs Sun Microsystems compatible Network File System
cd9660  CD-ROM (as per ISO 9660)
swap partition for swapping
tmpfs temporary ( may be cleaned at boot)
procfs process data
kernfs kernel parameters
fdesc /dev/fd
union translucent

The previous contents of directory are hidden.
It might be a good idea to touch "not mounted" at the mount point this will cause the file not mounted to be displayed if the mount point is retained and has no device mounted.

List all mounted file systems of type fstype

mount [-t fstype] 

The proc file system is not associated with a special device, proc can be used instead of a device specification.

cifs

Use the UNC name (exported network resource) //server/share

-o options

user=[workgroup/]uname[%pass
pass[word]=pppp
roread only
rwread-write
port=pppp
file-mode=mmm
dir_mode=mmm
domain=domain
guest
See mount_SMB Linux.die.net for more options.


mount - BSD/Apple darwin

mount [-adfruvw] [-t fstype ]
mount [ -dfruvw] special-device | rhost     mountPoint
mount [ -dfruvw] [-o options] [-t fstype ] special-device mount_point

Prepare and graft a special device or the remote node (rhost:path) to the file system tree at the directory mountDir

Without special-device and mount_point the information is obtained from getfsent(3)

rhost := //user@host/node/directory…

Without arguments, the currently mounted files systems are output with options.

> mount      minor edits for clarity
/dev/disk1s6s1 on /                         (apfs, sealed, local, read-only, journaled)
/dev/disk1s1   on /System/Volumes/Data      (apfs, local, journaled, nobrowse)
/dev/disk1s3   on /System/Volumes/Preboot   (apfs, local, journaled, nobrowse)
/dev/disk1s5   on /System/Volumes/VM        (apfs, local, noexec, journaled, noatime, nobrowse)
/dev/disk1s7   on /System/Volumes/Update    (apfs, local, journaled, nobrowse)
/dev/disk1s2   on /Volumes/DATA             (apfs, local, journaled)
map auto_home  on /System/Volumes/Data/home (autofs, automounted, nobrowse)
//com.apple.idms.appleid.prd.UUID@
  smac14._smb._tcp.local/dgerman on /Volumes/dgerman              (smbfs, nodev, nosuid, mounted by dgerman) by finder
//com.apple.idms.appleid.prd.UUID@
 smac14._smb._tcp.local/Macintosh%20HD on /Volumes/Macintosh HD-1 (smbfs, nodev, nosuid, mounted by dgerman) by finder
devfs          on /dev                      (devfs, local, nobrowse)


/dev/disk0s2 on / (hfs, local, journaled) /dev/disk0s4 on /Volumes/Photos (hfs, local, journaled) /dev/disk0s5 on /Volumes/DATA (hfs, local, journaled) /dev/disk0s6 on /Volumes/CACHE+MAIL (hfs, local, journaled) /dev/disk1 on /Volumes/Swift (hfs, local, nodev, nosuid, read-only, noowners, quarantine, mounted by jsmith) /dev/disk2s1 on /Volumes/07_jsmith (msdos, local, nodev, nosuid, read-only, noowners) map -hosts on /net (autofs, nosuid, automounted, nobrowse) map auto_home on /home (autofs, automounted, nobrowse) devfs on /dev (devfs, local, nobrowse) localhost:/Vp4V on /Volumes/MobileBackups (mtmfs, nosuid, read-only, nobrowse)

-aAll filesystems listed via getfsent
    Except
  • those marked as noauto
  • excluded by -t nofs
  • entries that are neither ro, rw, or rq
  • nfs entries that also have net as an option;
-t [no]fs[,fs,…] File System Type must be specified for a non-NFS filesystem.
Example: mount all nfs filesystems except HFS ones:
 mount -a -t nohfs

lsvfs outputs the types currently loaded of filesystems

 > lsvfs     # 10/18/23 sonoma
Filesystem Refs Flags               Filesystem Refs Flags
---------- ---- -------              ---------- ---- -------
nfs        0                         devfs      1 
nullfs     0                         bindfs     0 
lifs       0                         hfs        0 local
apfs       7 local                   lifs       0 
tmpfs      0                         autofs     1                         
smbfs      0
msdos      1    local

Types prefixed with no specify types for which action should not be taken.

-r Mount the file system read-only The same rdonly to -o .
-w Mount the file system read-write.
-f Force the revocation of write access when downgrading from read-write to read-only.
-u Update a mounted file system For example read-only to read-write .
An attempt to change from read-write to read-only will fail if files on the filesystem are currently open for writing unless -f is specified.
Any of the -o options may be changed.

The options are determined from the current ones, applying those specified by -o and finally applying -r or -w .

-o opt[,…] For options that take a value use -option=value.
Options specific to a filesystem type not internally known (see -t ) may be passed as a comma separated list; these options are distinguished by a leading - (dash).
For example:
mount -t hfs    -o nosuid,-w,-m=755 /dev/disk2s9 /tmp
is the equivalent of:
/sbin/mount_hfs -o nosuid -w -m 755 /dev/disk2s9 /tmp

NFS options are described in the mount_nfs(8)

update Change status of a mounted file system ( -u)
union Causes the namespace to appear as the union of directories of the mounted filesystem with corresponding directories in
[no]async I/O done asynchronously, default. dangerous with respect to losing data with power outages
sync I/O done synchronously.
force forces the revocation of write access when trying to downgrade a filesystem mount status from read-write to read-only. (-f)
noauto skip this mount when run with -a
noatime Do not update access times when reading from a file.
Useful performance is critical.
nodev Do not interpret character or block special devices on the file system. Useful for a server that has file systems containing special devices for architectures other than its own.
noexec Do not allow execution of binaries on the mounted file system. useful for a server that has file systems containing binaries for architectures other than its own.
noowners Ignore ownership field. Objects appear as owned by user ID 99 (current effective UID) and group ID 99 i.e. unknown. A security issue!
nosuid Ignore SUID and SGID
rdonly Mount the file system read-only (even super-user may not write it). same as -r; the underlying filesystem. Lookups will be done in the mounted filesystem first. If those operations fail due to a non-existent file the underlying directory is then accessed.
nobrowse Mount point not be visible via finder
-k kernel should not follow symlinks that in the mounton directory.
-d Debugging Causes everything to be done except for the system call.
Useful with -v to determine what the mount command will perform.
-v Verbose
struct fstab:

spec       /* block special device name */
file       /* file system path prefix */
vfstype    /* File system type, ufs, nfs */
mntops     /* Mount options ala -o */
type       /* FSTAB_* from fs_mntops */
freq       /* dump frequency, in days */
passno     /* pass number on parallel fsck */

File System types as per: ls -log /sbin/mount_*   ( as of 09/12/22 Monterey)

§ /System/Library/Filesystems/
®  /Contents/Resources/mount_

acfs    ->   §acfs.fs/Contents/bin/redirection.sh
afp
apfs    -> ..§apfs.fs®apfs       Mac OS  default 
cd9660  ->   §cd9660.fs®cd9660   CD-ROM (as per ISO 9660) 
cddafs  ->   §cddafs.fs®cddafs
devfs
exfat   ->   §exfat.fs®exfat
fdesc                           /dev/fd floppy 
ftp     ->   §ftp.fs®ftp
hfs     ->   §hfs.fs®hfs       HFS+ is the previous Mac OS  default 
lifs
msdos   ->   §msdos.fs®msdos
nfs                             Sun Microsystems compatible ``Network File System'' 
ntfs    ->   §ntfs.fs®ntfs
smbfs                            Mac to Mac
tmpfs   -> ..§tmpfs.fs®tmpfs
udf     ->   §udf.fs®udf
webdav
9p                              Plan 9 
union                           translucent 
dev/rdisk3s1: fsck_hfs started at Wed Feb 23 15:47:59 2022
/dev/rdisk3s1: /dev/rdisk3s1: ** /dev/rdisk3s1 (NO WRITE)
/dev/rdisk3s1:    Executing fsck_hfs (version hfs-583.100.9).
QUICKCHECK ONLY; FILESYSTEM CLEAN
/dev/rdisk3s1: fsck_hfs completed at Wed Feb 23 15:47:59 2022


/dev/rdisk2s2: fsck_hfs started at Thu Feb 24 19:50:15 2022
/dev/rdisk2s2: /dev/rdisk2s2: ** /dev/rdisk2s2 (NO WRITE)
/dev/rdisk2s2:    Executing fsck_hfs (version hfs-583.100.10).
QUICKCHECK ONLY; FILESYSTEM CLEAN
/dev/rdisk2s2: fsck_hfs completed at Thu Feb 24 19:50:15 2022

Errors


> /sbin/mount -v -t smbfs //mgerman@kitchen2023/data0 /Volumes/data0
mount_smbfs: mount error: /Volumes/data0: Unknown error: -1073741412
mount: /Volumes/data0 failed with 64

> mount -v -a
mount_apfs: volume could not be mounted: Operation not permitted
mount: / failed with 77
mount: /Volumes/s failed with 72

> sudo mount -a
mount_apfs: volume could not be mounted: Permission denied
mount: / failed with 66

mount_smbfs: server connection failed: No route to host
mount: /Volumes/mountDir failed with 68
    Not such host 
    Incorrect host spelling 

> sudo mount -t smbfs -v /Volumes/rn23
mount: /Volumes/dgerman23: invalid special file or file system.

mount: /Volumes/mountDir: invalid file system.     
    mountDir does not exist

mount_smbfs: server rejected the connection: Authentication error
mount: /Volumes/s failed with 77
    Wrong userID/Password


See

getfsent,
mount, mount_afp, mount_cd9660, mount_cddafs, mount_fdesc, mount_hfs, mount_msdos, mount_nfs, mount_smbfs, mount_udf, mount_webdav,
umount

df - Report filesystem disk space usage and device/mount_points
fdformat - Low-level format a floppy disk
fdisk - Partition table manipulator for Linux
ram - ram_disk
umount- detach/unmount a device
diskutil
OS X administrative utility