mount - macOS
Overview
The mount
command in macOS allows users to connect a file system, such as a hard drive, optical disc, or network share, to the system so that it can be accessed and managed. It provides the ability to control how file systems are mounted, including their mount point, permissions, and other options.
Syntax
mount [-fuv] [-t type] [-o options] device mountpoint
Options/Flags
- -f: Force mount, even if the device is busy.
- -u: Unmount the device after the system restarts.
- -v: Verbose output, providing detailed information about the mounting process.
- -t type: Specify the file system type (e.g.,
hfs
,msdos
,ntfs
). If omitted,mount
will attempt to automatically detect the file system type. - -o options: Specify mount options, which can customize the mounting behavior. Common options include:
- rw: Mount the file system read-write (default).
- ro: Mount the file system read-only.
- nosuid, nodev: Disable setuid and setgid operations on the mounted file system.
- auto: Automatically mount the file system on system startup.
Examples
-
Mount a local disk partition:
mount /dev/disk0s3 /path/to/mountpoint
-
Mount a USB drive:
mount /dev/disk2 /mnt/usb
-
Mount a network share (SMB):
mount -t smbfs //server/share /path/to/mountpoint
-
Mount a network share (AFP):
mount -t afp afp://user:password@server/share /path/to/mountpoint
Common Issues
- Permission denied: Ensure that you have sufficient permissions to mount the device or file system.
- Device not found: Confirm that the device is properly connected and recognized by the system.
- Invalid file system type: Verify that the specified file system type is correct. Use
diskutil list
to identify the correct file system type for the device.
Integration
- diskutil: Can be used to manage disk partitions, including creating, resizing, and repairing file systems.
- fdisk: A command-line utility for partitioning disks.
- hdiutil: A command-line tool for mounting and unmounting disk images.
Related Commands
umount
: Unmounts a file system from the system.diskutil
: Manages disk partitions and file systems.hdiutil
: Mounts and unmounts disk images.