findmnt

package
v3.0.0-rc67 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	PathNfsSeparator = ':'
	JsonCapability   = "node.x.findmnt.json"
)

Variables

This section is empty.

Functions

func Has

func Has(ctx context.Context, dev string, mnt string) (bool, error)

Has returns true when {dev} is mounted on {mnt} using the findmnt command

func HasDev

func HasDev(ctx context.Context, dev string) (bool, error)

HasDev returns true when a fs is mounted from {dev} using the findmnt command

func HasFromMount

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

HasFromMount returns true when {dev} is mounted on {mnt} using the mount command

func HasMnt

func HasMnt(ctx context.Context, mnt string) (bool, error)

HasMnt returns true when a fs is mounted on {mnt} using the findmnt command

func HasMntWithTypes

func HasMntWithTypes(ctx context.Context, fsTypes []string, mnt string) (bool, error)

HasMntWithTypes returns true when a fs with type matching one of {fsTypes} is mounted on {mnt} using the findmnt 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(ctx context.Context, 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