gofsutil

package module
v1.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 18 Imported by: 17

README

Mount

A portable Go library for filesystem related operations such as mount, format, etc.

Documentation

Overview

Package gofsutil provides many filesystem-specific functions, such as mount, format, etc., and is based largely on k8s.io/pkg/util/mount.

Index

Constants

View Source
const FCPortPrefix = "0x50"

FCPortPrefix has the required port prefix for FCTargetHosts

View Source
const NoDiscard = "NoDiscard"

NoDiscard is a context option for using the nodiscard flag on mkfs

View Source
const ProcMountsFields = 9

ProcMountsFields is fields per line in procMountsPath as per https://www.kernel.org/doc/Documentation/filesystems/proc.txt

View Source
const RequestID = "RequestID"

RequestID is for logging the CSI or other type of Request ID

Variables

View Source
var (
	// GOFSMockMounts and the other variables in gofsutils_mock.go
	// allow the user to manipulate the data returned in the mock
	// mode or return induced errors.
	GOFSMockMounts []Info
	// GOFSMockFCHostWWNs is a list of port WWNs on this host's FC NICs
	GOFSMockFCHostWWNs []string
	// GOFSMockWWNToDevice allows you to return a device for a WWN.
	GOFSMockWWNToDevice map[string]string
	// GOFSWWNPath gives a path for the WWN entry (e.g. /dev/disk/by-id/wwn-0x)
	GOFSWWNPath string
	// GOFSMockTargetIPLUNToDevice map[string]string
	// assumes key is of form ip-<targetIP>:-lun<decimal_lun_id>
	GOFSMockTargetIPLUNToDevice map[string]string
	// GOFSRescanCallback is a function called when a rescan is processed.
	GOFSRescanCallback func(scan string)
	// GOFSMockMountInfo contains mount information for filesystem volumes
	GOFSMockMountInfo *DeviceMountInfo

	// GOFSMock allows you to induce errors in the various routine.
	GOFSMock struct {
		InduceBindMountError              bool
		InduceMountError                  bool
		InduceGetMountsError              bool
		InduceDevMountsError              bool
		InduceUnmountError                bool
		InduceFormatError                 bool
		InduceGetDiskFormatError          bool
		InduceWWNToDevicePathError        bool
		InduceTargetIPLUNToDeviceError    bool
		InduceRemoveBlockDeviceError      bool
		InduceMultipathCommandError       bool
		InduceFCHostWWNsError             bool
		InduceRescanError                 bool
		InduceIssueLipError               bool
		InduceGetSysBlockDevicesError     bool
		InduceGetDiskFormatType           string
		InduceGetMountInfoFromDeviceError bool
		InduceDeviceRescanError           bool
		InduceResizeMultipathError        bool
		InduceFSTypeError                 bool
		InduceResizeFSError               bool
		InduceGetMpathNameFromDeviceError bool
		InduceFilesystemInfoError         bool
	}
)
View Source
var (
	// ErrNotImplemented is returned when a platform does not implement
	// the contextual function.
	ErrNotImplemented = errors.New("not implemented")
)
View Source
var MultipathDevDiskByIDPrefix = "/dev/disk/by-id/dm-uuid-mpath-3"

MultipathDevDiskByIDPrefix is a pathname prefix for items located in /dev/disk/by-id

Functions

func BindMount

func BindMount(
	ctx context.Context,
	source, target string,
	opts ...string,
) error

BindMount behaves like Mount was called with a "bind" flag set in the options list.

func DeviceRescan added in v1.3.0

func DeviceRescan(ctx context.Context,
	devicePath string,
) error

DeviceRescan rescan the device for size alterations

func EvalSymlinks(_ context.Context, symPath *string) error

EvalSymlinks evaluates the provided path and updates it to remove any symlinks in its structure, replacing them with the actual path components.

func FindFSType added in v1.3.0

func FindFSType(
	ctx context.Context, mountpoint string,
) (fsType string, err error)

FindFSType fetches the filesystem type on mountpoint

func Format

func Format(
	ctx context.Context,
	source, target, fsType string,
	opts ...string,
) error

Format uses unix utils to format the given disk.

func FormatAndMount

func FormatAndMount(
	ctx context.Context,
	source, target, fsType string,
	opts ...string,
) error

FormatAndMount uses unix utils to format and mount the given disk.

func FsInfo added in v1.8.0

func FsInfo(ctx context.Context, path string) (int64, int64, int64, int64, int64, int64, error)

FsInfo given the path of the filesystem will return its stats

func GetDiskFormat

func GetDiskFormat(ctx context.Context, disk string) (string, error)

GetDiskFormat uses 'lsblk' to see if the given disk is unformatted.

func GetFCHostPortWWNs added in v1.2.0

func GetFCHostPortWWNs(ctx context.Context) ([]string, error)

GetFCHostPortWWNs returns the Fibrechannel Port WWNs of the local host.

func GetMpathNameFromDevice added in v1.4.0

func GetMpathNameFromDevice(ctx context.Context, device string) (string, error)

GetMpathNameFromDevice retrieves mpath device name from device name

func GetSysBlockDevicesForVolumeWWN added in v1.2.0

func GetSysBlockDevicesForVolumeWWN(ctx context.Context, volumeWWN string) ([]string, error)

GetSysBlockDevicesForVolumeWWN given a volumeWWN will return a list of devices in /sys/block for that WWN (e.g. sdx, sdaa)

func IssueLIPToAllFCHosts added in v1.2.0

func IssueLIPToAllFCHosts(ctx context.Context) error

IssueLIPToAllFCHosts issues the LIP command to all FC hosts.

func MakeMountArgs

func MakeMountArgs(
	_ context.Context,
	source, target, fsType string,
	opts ...string,
) []string

MakeMountArgs makes the arguments to the mount(8) command.

The argument list returned is built as follows:

mount [-t $fsType] [-o $options] [$source] $target

func Mount

func Mount(
	ctx context.Context,
	source, target, fsType string,
	opts ...string,
) error

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.

func MultipathCommand added in v1.2.0

func MultipathCommand(ctx context.Context, timeoutSeconds time.Duration, chroot string, arguments ...string) ([]byte, error)

MultipathCommand executes the multipath command with a timeout and various arguments. Optionally a chroot directory can be specified for changing root directory. This only works in a container or another environment where it can chroot to /noderoot.

func RemoveBlockDevice added in v1.1.0

func RemoveBlockDevice(ctx context.Context, blockDevicePath string) error

RemoveBlockDevice removes a block device by getting the device name from the last component of the blockDevicePath and then removing the device by writing '1' to /sys/block{deviceName}/device/delete

func RemoveDuplicates

func RemoveDuplicates(a []string) []string

RemoveDuplicates removes duplicate and empty values from the provided slice of strings and maintains the original order of the list.

This function defers to RemoveDuplicatesExponentialOrdered, a variation of RemoveDuplicatesExponentialUnordered as described in the article "Learning Golang By Benchmarking Set Implementations" by Karl Seguin at https://goo.gl/NTU36K. The variation preserves the slice's original order and has minimal to no impact on performance.

The function's O(n^2) complexity could be altered to O(n) (linear) by using a map[string]struct{} to track unique elements with zero memory allocation. However, as long as the input data is small, the current implementation is more performant both with respect to both CPU and memory. Given that this function is used to remove duplicate mount options, there should never be a sufficiently large enough dataset that a linear version of this function would be more performant the current implementation.

The function RemoveDuplicatesLinearOrdered is the linear version of this function. If the situation should ever change such that mount options number in the thousands then this function should defer to RemoveDuplicatesLinearOrdered instead of RemoveDuplicatesExponentialOrdered.

$ go test -run Bench -bench BenchmarkRemoveDuplicates -benchmem -v
goos: darwin
goarch: amd64
pkg: github.com/thecodeteam/gofsutil
BenchmarkRemoveDuplicates_Exponential_Ordered___SmallData-8   	20000000	       121 ns/op	       0 B/op	       0 allocs/op
BenchmarkRemoveDuplicates_Exponential_Unordered_SmallData-8   	20000000	        99.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkRemoveDuplicates_Linear______Ordered___SmallData-8   	 2000000	       715 ns/op	     288 B/op	       1 allocs/op
BenchmarkRemoveDuplicates_Exponential_Ordered___BigData-8     	   20000	     84731 ns/op	       0 B/op	       0 allocs/op
BenchmarkRemoveDuplicates_Exponential_Unordered_BigData-8     	   10000	    156660 ns/op	       0 B/op	       0 allocs/op
BenchmarkRemoveDuplicates_Linear______Ordered___BigData-8     	   50000	     36971 ns/op	   20512 B/op	       2 allocs/op
PASS
ok  	github.com/thecodeteam/gofsutil	22.085s

func RemoveDuplicatesExponentialOrdered

func RemoveDuplicatesExponentialOrdered(a []string) []string

RemoveDuplicatesExponentialOrdered removes duplicate and empty values from the provided slice of strings using an exponentially complex algorithm and maintains the original order of the list.

func RemoveDuplicatesExponentialUnordered

func RemoveDuplicatesExponentialUnordered(a []string) []string

RemoveDuplicatesExponentialUnordered removes duplicate and empty values from the provided slice of strings using an exponentially complex algorithm and does not maintain the original order of the list.

func RemoveDuplicatesLinearOrdered

func RemoveDuplicatesLinearOrdered(a []string) []string

RemoveDuplicatesLinearOrdered removes duplicate and empty values from the provided slice of strings using a linearly complex algorithm and maintains the original order of the list.

func RescanSCSIHost added in v1.1.0

func RescanSCSIHost(ctx context.Context, targets []string, lun string) error

RescanSCSIHost will rescan scsi hosts for a specified lun. If targets are specified, only hosts who are related to the specified FC port WWN or iscsi iqn target(s) are rescanned. Targets must either begin with 0x50 for FC or iqn. for Iscsi. If lun is specified, then the rescan is for that particular volume.

func ResizeFS added in v1.3.0

func ResizeFS(
	ctx context.Context,
	volumePath, devicePath, ppathDevice,
	mpathDevice, fsType string,
) error

ResizeFS expands the filesystem to the new size of underlying device

func ResizeMultipath added in v1.3.0

func ResizeMultipath(ctx context.Context, deviceName string) error

ResizeMultipath expands the multipath volumes

func TargetIPLUNToDevicePath added in v1.2.0

func TargetIPLUNToDevicePath(ctx context.Context, targetIP string, lunID int) (map[string]string, error)

TargetIPLUNToDevicePath returns the /dev/devxxx path when presented with an ISCSI target IP and a LUN id. It returns the entry name in /dev/disk/by-path and the device path, along with error.

func Unmount

func Unmount(ctx context.Context, target string) error

Unmount unmounts the target.

func UseMockFS

func UseMockFS()

UseMockFS creates a mock file system for testing. This then is used with gofsutil_mock.go methods so that you can implement mock testing for calls using gofsutils.

func ValidateDevice

func ValidateDevice(ctx context.Context, source string) (string, error)

ValidateDevice evalutes the specified path and determines whether or not it is a valid device. If true then the provided path is evaluated and returned as an absolute path without any symlinks. Otherwise an empty string is returned.

func WWNToDevicePath added in v1.1.0

func WWNToDevicePath(ctx context.Context, wwn string) (string, error)

WWNToDevicePath returns the device path corresponding to a LUN's WWN (World Wide Name). A null path is returned if the device isn't found.

func WWNToDevicePathX added in v1.2.0

func WWNToDevicePathX(ctx context.Context, wwn string) (string, string, error)

WWNToDevicePathX returns the symlink and device path corresponding to a LUN's WWN (World Wide Name). A null path is returned if the device isn't found.

Types

type ContextKey added in v1.2.0

type ContextKey string

ContextKey is a variable containing context-keys

type DeviceMountInfo added in v1.3.0

type DeviceMountInfo struct {
	DeviceNames []string
	MPathName   string
	PPathName   string
	MountPoint  string
}

DeviceMountInfo describes the filesystem mount information related to the mounted CSI device

func GetMountInfoFromDevice added in v1.3.0

func GetMountInfoFromDevice(ctx context.Context, devID string) (*DeviceMountInfo, error)

GetMountInfoFromDevice retrieves mount information associated with the volume

type Entry

type Entry struct {
	// Root of the mount within the filesystem.
	Root string

	// MountPoint relative to the process's root
	MountPoint string

	// MountOpts are per-mount options.
	MountOpts []string

	// FSType is the name of filesystem of the form "type[.subtype]".
	FSType string

	// MountSource is filesystem specific information or "none"
	MountSource string
}

Entry is a superset of Info and maps to the fields of a mount table entry:

(1) mount ID:  unique identifier of the mount (may be reused after umount)
(2) parent ID:  ID of parent (or of self for the top of the mount tree)
(3) major:minor:  value of st_dev for files on filesystem
(4) root:  root of the mount within the filesystem
(5) mount point:  mount point relative to the process's root
(6) mount options:  per mount options
(7) optional fields:  zero or more fields of the form "tag[:value]"
(8) separator:  marks the end of the optional fields
(9) filesystem type:  name of filesystem of the form "type[.subtype]"
(10) mount source:  filesystem specific information or "none"
(11) super options:  per super block options

type EntryScanFunc

type EntryScanFunc func(
	ctx context.Context,
	entry Entry,
	cache map[string]Entry) (Info, bool, error)

EntryScanFunc defines the signature of the function that is optionally provided to the functions in this package that scan the mount table. The mount entry table is ignored when this function returns a false value or error.

func DefaultEntryScanFunc

func DefaultEntryScanFunc() EntryScanFunc

DefaultEntryScanFunc returns the default entry scan function.

type FS

type FS struct {
	// ScanEntry is the function used to process mount table entries.
	ScanEntry EntryScanFunc
}

FS provides many filesystem-specific functions, such as mount, format, etc.

func (*FS) BindMount

func (fs *FS) BindMount(
	ctx context.Context,
	source, target string,
	options ...string,
) error

BindMount behaves like Mount was called with a "bind" flag set in the options list.

func (*FS) DeviceRescan added in v1.3.0

func (fs *FS) DeviceRescan(ctx context.Context,
	devicePath string,
) error

DeviceRescan rescan the device for size alterations

func (*FS) FindFSType added in v1.3.0

func (fs *FS) FindFSType(
	ctx context.Context, mountpoint string,
) (fsType string, err error)

FindFSType fetches the filesystem type on mountpoint

func (*FS) Format

func (fs *FS) Format(
	ctx context.Context,
	source, target, fsType string,
	options ...string,
) error

Format uses unix utils to format the given disk.

func (*FS) FormatAndMount

func (fs *FS) FormatAndMount(
	ctx context.Context,
	source, target, fsType string,
	options ...string,
) error

FormatAndMount uses unix utils to format and mount the given disk.

func (*FS) FsInfo added in v1.8.0

func (fs *FS) FsInfo(ctx context.Context, path string) (int64, int64, int64, int64, int64, int64, error)

FsInfo given the path of the filesystem will return its stats

func (*FS) GetDevMounts

func (fs *FS) GetDevMounts(ctx context.Context, dev string) ([]Info, error)

GetDevMounts returns a slice of all mounts for the provided device.

func (*FS) GetDiskFormat

func (fs *FS) GetDiskFormat(ctx context.Context, disk string) (string, error)

GetDiskFormat uses 'lsblk' to see if the given disk is unformatted.

func (*FS) GetFCHostPortWWNs added in v1.2.0

func (fs *FS) GetFCHostPortWWNs(ctx context.Context) ([]string, error)

GetFCHostPortWWNs returns the port WWN addresses of local FC adapters.

func (*FS) GetMountInfoFromDevice added in v1.3.0

func (fs *FS) GetMountInfoFromDevice(ctx context.Context, devID string) (*DeviceMountInfo, error)

GetMountInfoFromDevice retrieves mount information associated with the volume

func (*FS) GetMounts

func (fs *FS) GetMounts(ctx context.Context) ([]Info, error)

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.

func (*FS) GetMpathNameFromDevice added in v1.4.0

func (fs *FS) GetMpathNameFromDevice(ctx context.Context, device string) (string, error)

GetMpathNameFromDevice retrieves mpath device name from device name

func (*FS) GetSysBlockDevicesForVolumeWWN added in v1.2.0

func (fs *FS) GetSysBlockDevicesForVolumeWWN(ctx context.Context, volumeWWN string) ([]string, error)

GetSysBlockDevicesForVolumeWWN given a volumeWWN will return a list of devices in /sys/block for that WWN (e.g. sdx, sdaa)

func (*FS) IssueLIPToAllFCHosts added in v1.2.0

func (fs *FS) IssueLIPToAllFCHosts(ctx context.Context) error

IssueLIPToAllFCHosts issues the LIP command to all FC hosts.

func (*FS) Mount

func (fs *FS) Mount(
	ctx context.Context,
	source, target, fsType string,
	options ...string,
) error

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.

func (*FS) MultipathCommand added in v1.2.0

func (fs *FS) MultipathCommand(ctx context.Context, timeoutSeconds time.Duration, chroot string, arguments ...string) ([]byte, error)

MultipathCommand executes the multipath command with a timeout and various arguments. Optionally a chroot directory can be specified for changing root directory. This only works in a container or another environment where it can chroot to /noderoot.

func (*FS) RemoveBlockDevice added in v1.1.0

func (fs *FS) RemoveBlockDevice(ctx context.Context, blockDevicePath string) error

RemoveBlockDevice removes a block device by getting the device name from the last component of the blockDevicePath and then removing the device by writing '1' to /sys/block{deviceName}/device/delete

func (*FS) RescanSCSIHost added in v1.1.0

func (fs *FS) RescanSCSIHost(ctx context.Context, targets []string, lun string) error

RescanSCSIHost will rescan scsi hosts for a specified lun. If targets are specified, only hosts who are related to the specified iqn target(s) are rescanned. If lun is specified, then the rescan is for that particular volume.

func (*FS) ResizeFS added in v1.3.0

func (fs *FS) ResizeFS(
	ctx context.Context,
	volumePath, devicePath, ppathDevice,
	mpathDevice, fsType string,
) error

ResizeFS expands the filesystem to the new size of underlying device

func (*FS) ResizeMultipath added in v1.3.0

func (fs *FS) ResizeMultipath(ctx context.Context, deviceName string) error

ResizeMultipath resizes the multipath devices mounted on FS

func (*FS) TargetIPLUNToDevicePath added in v1.2.0

func (fs *FS) TargetIPLUNToDevicePath(ctx context.Context, targetIP string, lunID int) (map[string]string, error)

TargetIPLUNToDevicePath returns the /dev/devxxx path when presented with an ISCSI target IP and a LUN id. It returns the entry name in /dev/disk/by-path and the device path, along with error.

func (*FS) Unmount

func (fs *FS) Unmount(ctx context.Context, target string) error

Unmount unmounts the target.

func (*FS) ValidateDevice

func (fs *FS) ValidateDevice(
	ctx context.Context, source string,
) (string, error)

ValidateDevice evalutes the specified path and determines whether or not it is a valid device. If true then the provided path is evaluated and returned as an absolute path without any symlinks. Otherwise an empty string is returned.

func (*FS) WWNToDevicePath added in v1.1.0

func (fs *FS) WWNToDevicePath(ctx context.Context, wwn string) (string, string, error)

WWNToDevicePath returns the symlink and device path given a LUN's WWN.

type FSinterface

type FSinterface interface {

	// Architecture agnostic implementations, generally just wrappers
	GetDiskFormat(ctx context.Context, disk string) (string, error)
	Format(ctx context.Context, source, target, fsType string, options ...string) error
	FormatAndMount(ctx context.Context, source, target, fsType string, options ...string) error
	Mount(ctx context.Context, source, target, fsType string, options ...string) error
	BindMount(ctx context.Context, source, target string, options ...string) error
	Unmount(ctx context.Context, target string) error
	GetMounts(ctx context.Context) ([]Info, error)
	GetDevMounts(ctx context.Context, dev string) ([]Info, error)
	ValidateDevice(ctx context.Context, source string) (string, error)
	WWNToDevicePath(ctx context.Context, wwn string) (string, string, error)
	RescanSCSIHost(ctx context.Context, targets []string, lun string) error
	RemoveBlockDevice(ctx context.Context, blockDevicePath string) error
	TargetIPLUNToDevicePath(ctx context.Context, targetIP string, lunID int) (map[string]string, error)
	MultipathCommand(ctx context.Context, timeoutSeconds time.Duration, chroot string, arguments ...string) ([]byte, error)
	GetFCHostPortWWNs(ctx context.Context) ([]string, error)
	IssueLIPToAllFCHosts(ctx context.Context) error
	GetSysBlockDevicesForVolumeWWN(ctx context.Context, volumeWWN string) ([]string, error)
	DeviceRescan(ctx context.Context, devicePath string) error
	ResizeFS(ctx context.Context, volumePath, devicePath, ppathDevice, mpathDevice, fsType string) error
	GetMountInfoFromDevice(ctx context.Context, devID string) (*DeviceMountInfo, error)
	ResizeMultipath(ctx context.Context, deviceName string) error
	FindFSType(ctx context.Context, mountpoint string) (fsType string, err error)
	GetMpathNameFromDevice(ctx context.Context, device string) (string, error)
	FsInfo(ctx context.Context, path string) (int64, int64, int64, int64, int64, int64, error)
	// contains filtered or unexported methods
}

FSinterface has the methods support by gofsutils.

type Info

type Info struct {
	// Device is the filesystem path of the device to which the filesystem is
	// mounted.
	Device string

	// Path is the filesystem path to which 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 (absolute, no symlinks)
	//      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 (https://linux.die.net/man/8/mount)
	// used to mount the filesystem.
	Opts []string
}

Info describes a mounted filesystem.

Please note that all fields that represent filesystem paths must be absolute and not contain any symlinks.

func GetDevMounts

func GetDevMounts(ctx context.Context, dev string) ([]Info, error)

GetDevMounts returns a slice of all mounts for the provided device.

func GetMounts

func GetMounts(ctx context.Context) ([]Info, error)

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.

func ReadProcMountsFrom

func ReadProcMountsFrom(
	ctx context.Context,
	file io.Reader,
	_ bool,
	expectedFields int,
	scanEntry EntryScanFunc,
) ([]Info, uint32, error)

ReadProcMountsFrom parses the contents of a mount table file, typically "/proc/self/mountinfo".

From https://www.kernel.org/doc/Documentation/filesystems/proc.txt:

3.5 /proc/<pid>/mountinfo - Information about mounts --------------------------------------------------------

This file contains lines of the form:

36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue (1)(2)(3) (4) (5) (6) (7) (8) (9) (10) (11)

(1) mount ID: unique identifier of the mount (may be reused after umount) (2) parent ID: ID of parent (or of self for the top of the mount tree) (3) major:minor: value of st_dev for files on filesystem (4) root: root of the mount within the filesystem (5) mount point: mount point relative to the process's root (6) mount options: per mount options (7) optional fields: zero or more fields of the form "tag[:value]" (8) separator: marks the end of the optional fields (9) filesystem type: name of filesystem of the form "type[.subtype]" (10) mount source: filesystem specific information or "none" (11) super options: per super block options

Parsers should ignore all unrecognised optional fields. Currently the possible optional fields are:

shared:X mount is shared in peer group X master:X mount is slave to peer group X propagate_from:X mount is slave and receives propagation from peer group X (*) unbindable mount is unbindable

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL