Documentation ¶
Index ¶
- Variables
- func BindMount(source, target string, options ...string) error
- func EvalSymlinks(symPath *string) error
- func FormatAndMount(source, target, fsType string, options ...string) error
- func GetDiskFormat(disk string) (string, error)
- func Mount(source, target, fsType string, options ...string) error
- func Unmount(target string) error
- type Info
Constants ¶
This section is empty.
Variables ¶
var ErrNotImplemented = errors.New("not implemented")
ErrNotImplemented is returned when a platform does not implement the contextual function.
Functions ¶
func BindMount ¶
BindMount behaves like Mount was called with a "bind" flag set in the options list.
func EvalSymlinks ¶
EvalSymlinks evaluates the provided path and updates it to remove any symlinks in its structure, replacing them with the actual path components.
func FormatAndMount ¶
FormatAndMount uses unix utils to format and mount the given disk.
func GetDiskFormat ¶
GetDiskFormat uses 'lsblk' to see if the given disk is unformatted.
func Mount ¶
Mount mounts source to target as fstype with given options.
The parameters 'source' and 'fstype' must be empty strings in case they are not required, e.g. for remount, or for an auto filesystem type where the kernel handles fstype automatically.
The 'options' parameter is a list of options. Please see mount(8) for more information. If no options are required then please invoke Mount with an empty or nil argument.
Types ¶
type Info ¶
type Info struct { // Device is the device on which the filesystem is mounted. Device string // Path is the filesystem path to which the device is mounted. Path string // Source may be set to one of two values: // // 1. If this is a bind mount created with "bindfs" then Source // is set to the filesystem path bind mounted to Path. // // 2. If this is any other type of mount then Source is set to // a concatenation of the mount source and the root of // the mount within the file system (fields 10 & 4 from // the section on /proc/<pid>/mountinfo at // https://www.kernel.org/doc/Documentation/filesystems/proc.txt). // // It is not possible to diffentiate a native bind mount from a // non-bind mount after the native bind mount has been created. // Therefore, while the Source field will be set to the filesystem // path bind mounted to Path for native bind mounts, the value of // the Source field can in no way be used to determine *if* a mount // is a bind mount. Source string // Type is the filesystem type. Type string // Opts are the mount options used to create this mount point. Opts []string }
Info is information about a single mount point.
func GetDevMounts ¶
GetDevMounts returns a slice of all mounts for dev
func GetMounts ¶
GetMounts returns a slice of all the mounted filesystems.
* Linux hosts use mount_namespaces to obtain mount information.
Support for mount_namespaces was introduced to the Linux kernel in 2.2.26 (http://man7.org/linux/man-pages/man5/proc.5.html) on 2004/02/04. The kernel documents the contents of "/proc/<pid>/mountinfo" at https://www.kernel.org/doc/Documentation/filesystems/proc.txt.
- Darwin hosts parse the output of the "mount" command to obtain mount information.