Documentation
¶
Index ¶
- Constants
- func GetMountsUnderPath(pathPrefix string) ([]string, error)
- func IsBindMountedWithFstab(mount BindMount) (alreadyMounted bool, fstabEntryAlreadyAdded bool, err error)
- func RemoveBindMountsWithFstab(mount BindMount) error
- func SetupBindMountsWithFstab(mount BindMount) error
- func UnmountPath(target string) error
- type BindMount
Constants ¶
const ( DefaultFstabFile = "/etc/fstab" DefaultProcMountsFile = "/proc/mounts" )
Variables ¶
This section is empty.
Functions ¶
func GetMountsUnderPath ¶ added in v0.9.0
GetMountsUnderPath returns all mount points under the given path prefix by reading /proc/mounts. Returns mounts sorted deepest-first (longest paths first), which is the correct order for unmounting nested mounts.
func IsBindMountedWithFstab ¶
func IsBindMountedWithFstab(mount BindMount) (alreadyMounted bool, fstabEntryAlreadyAdded bool, err error)
IsBindMountedWithFstab checks if the bind mount is currently mounted and if the fstab entry exists
func RemoveBindMountsWithFstab ¶
RemoveBindMountsWithFstab undoes bind mount setup It unmounts the bind mount and removes the entry from /etc/fstab
func SetupBindMountsWithFstab ¶
SetupBindMountsWithFstab sets up a bind mount for the given target It adds an entry to /etc/fstab and performs the mount
func UnmountPath ¶ added in v0.9.0
UnmountPath unmounts the given path using lazy detach flag (MNT_DETACH). This is a lower-level function that does not check if the path is mounted. Use this when you already know the path is mounted (e.g., from reading /proc/mounts).
Note: We use MNT_DETACH (lazy unmount) without MNT_FORCE. MNT_FORCE is primarily useful for NFS mounts that have become unreachable. For local bind mounts (which is the primary use case here - sandbox mounts, overlay storage, namespace mounts), MNT_DETACH alone is sufficient and safer.