findmnt

package
v0.0.0-...-0a8b275 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PathNfsSeparator = ':'
)

Variables

This section is empty.

Functions

func Has

func Has(dev string, mnt string) (bool, error)

Has return True when {dev} is mounted on {mnt} using the findmnt command

func HasFromMount

func HasFromMount(dev string, mnt string) (bool, error)

HasFromMount return True when {dev} is mounted on {mnt} using the mount command

Types

type MountInfo

type MountInfo struct {
	Source  string `json:"source"`
	Target  string `json:"target"`
	FsType  string `json:"fstype"`
	Options string `json:"options"`
}

func List

func List(dev string, mnt string) (mounts []MountInfo, err error)

List return matching dev and mnt list of MountInfo. findmnt exec is used to do initial filtering, then filter on mnt is used (for nfs) + custom filter on [dev] for bind mounts.

We can't use findmnt -J -T {mnt} -S {dev} for nfs because it may hang. A timeout version of findmnt is not sufficient, we have to differentiate hang but mounted from not mounted.

So when dev is on nfs, We can't use findmnt -J -T {mnt} -S {dev} Instead findmnt -J -S {dev} is used, then mnt is filtered within List function.

Jump to

Keyboard shortcuts

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