mount
Synopsis
mount <device> <target> [name: value]...
Description
mount mounts a device or volume with mount on Linux and macOS and mountvol on Windows (drive letters and folder mounts). The mount point is read first: the same device already mounted there is unchanged, another device is E_IN_USE. With persistent: true on Linux the line of /etc/fstab for the mount point is written or replaced; the edit is a file change of the journal. macOS does not support persistent.
Rights: the command accepts privilege; write privilege: elevated when the account that runs Nurt is not the administrator. A program that fails for lack of rights ends the command with E_PERMISSION, and privilege: auto repeats it once elevated. An elevated entry is undone by the same elevated process.
undo runs unmount; the journal restores /etc/fstab.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
device |
text |
required | Device, volume or source of the mount. |
target |
text |
required | Mount point: a directory, or a drive letter or folder on Windows. |
type |
text |
none | File system type; detected by the system when omitted. |
options |
list<text> |
none | Mount options. |
persistent |
bool |
false |
Also write the mount to /etc/fstab (Linux); the file is journaled. |
Input and output
| Form | Input | Output |
|---|---|---|
| default | none |
effect |
Effect
| Property | Value |
|---|---|
| Category | change |
| Effect | external |
| Reversibility | reversible_if_preserved |
| Implementation | system_program |
| Reversibility conditions | Undo unmounts the target; the edit of /etc/fstab is restored by the journal. |
| External use | system_program: mount, mountvol; Mounts use mount on Linux and macOS and mountvol on Windows. |
Examples
Mount a device.
mount "/dev/sdb1" "/srv/data" type: "ext4" privilege: elevated
Mount read-only and keep the mount after a restart.
mount "/dev/sdb1" "/srv/data" type: "ext4" options: ["ro", "noatime"] persistent: true privilege: elevated
Mount a USB stick for one account.
mount "/dev/sdc1" "/mnt/usb" type: "vfat" options: ["uid=1000"] privilege: elevated
Errors
| Code | Meaning | Typical fix |
|---|---|---|
E_IN_USE |
Another device is mounted at the mount point. | Unmount it first. |
E_UNSUPPORTED |
persistent on macOS. |
Omit persistent. |
E_PERMISSION |
The account lacks the rights of the administrator. | Add privilege: elevated. |
E_EXTERNAL_MISSING |
The system program of the command is not installed. | Install the program named in the message. |
E_STAGE_FAILED |
The system program ended with an error. | Read the end of the error output in the message. |
Related
unmount, disks, disks.format.