# `Nerves.Runtime.MountInfo`
[🔗](https://github.com/nerves-project/nerves_runtime/blob/v0.13.12/lib/nerves_runtime/mount_info.ex#L5)

Utilities for getting information about mounted filesystems
Mount information is parsed from /proc/self/mountinfo. For complete field
descriptions, see the [Linux manual](https://man7.org/linux/man-pages/man5/proc_pid_mountinfo.5.html).

# `mount_info`

```elixir
@type mount_info() :: [mount_record()]
```

A list of mount records

# `mount_record`

```elixir
@type mount_record() :: %{
  mount_id: integer(),
  parent_id: integer(),
  major_minor: String.t(),
  root: String.t(),
  mount_point: String.t(),
  mount_options: [String.t()],
  optional_fields: [String.t()],
  fs_type: String.t(),
  mount_source: String.t(),
  super_options: [String.t()]
}
```

Information about a single mount point

Each mount record contains the following fields:

* `mount_id` - a unique identifier for the mount
* `parent_id` - the ID of the parent mount
* `major_minor` - the major:minor device number
* `root` - the pathname of the directory in the filesystem which forms the root of this mount
* `mount_point` -  the pathname of the mount point relative to the process's root directory
* `mount_options` - per-mount options
* `optional_fields` - zero or more fields of the form `tag[:value]`
* `fs_type` - the filesystem type in the form `type[.subtype]`
* `mount_source` - filesystem-specific information or `none`
* `super_options` - per-superblock options

# `find_by_mount_point`

```elixir
@spec find_by_mount_point(mount_info(), String.t()) :: mount_record() | nil
```

Find mount information by its mount point

# `get_mounts!`

```elixir
@spec get_mounts!() :: mount_info()
```

Returns information about all mounted filesystems

Raises an exception if /proc/self/mountinfo cannot be read, since this file
is guaranteed to exist on Nerves and Linux systems.

# `parse`

```elixir
@spec parse(String.t()) :: mount_info()
```

Parses mountinfo content into a list of mount_info structs.

# `read_only?`

```elixir
@spec read_only?(mount_record()) :: boolean()
```

Checks if a mount point is mounted read-only

This checks the mount options to see if the file system was mounted
read-only. It could have originally been mounted writable, but an
error caused Linux to automatically remount it read-only.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
