Nerves.Runtime.MountInfo (nerves_runtime v0.13.9)
View SourceUtilities for getting information about mounted filesystems Mount information is parsed from /proc/self/mountinfo. For complete field descriptions, see the Linux manual.
Summary
Functions
Find mount information by its mount point
Returns information about all mounted filesystems
Parses mountinfo content into a list of mount_info structs.
Checks if a mount point is mounted read-only
Types
@type mount_info() :: [mount_record()]
A list of mount records
@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 mountparent_id- the ID of the parent mountmajor_minor- the major:minor device numberroot- the pathname of the directory in the filesystem which forms the root of this mountmount_point- the pathname of the mount point relative to the process's root directorymount_options- per-mount optionsoptional_fields- zero or more fields of the formtag[:value]fs_type- the filesystem type in the formtype[.subtype]mount_source- filesystem-specific information ornonesuper_options- per-superblock options
Functions
@spec find_by_mount_point(mount_info(), String.t()) :: mount_record() | nil
Find mount information by its mount point
@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.
@spec parse(String.t()) :: mount_info()
Parses mountinfo content into a list of mount_info structs.
@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.