linux-mount-0.2.0.1: Mount and unmount filesystems

Portabilityportable
Stabilityexperimental
MaintainerNicola Squartini <tensor5@gmail.com>
Safe HaskellSafe

System.Linux.Mount

Contents

Description

linux-mount provides bindings to the Linux mount() and umount() syscalls. All functions below may fail with isPermissionError if the user does not have the required privileges.

Synopsis

Mount a filesystem

mountSource

Arguments

:: String

Device file

-> FilePath

Mount point

-> String

Filesystem type

-> [MountFlag]

List of mount options

-> DriverData

Driver specific options

-> IO () 

Mount a filesystem (call to mount()).

remountSource

Arguments

:: FilePath

Mount point

-> [MountFlag]

List of mount options

-> DriverData

Driver specific options

-> IO () 

Alter flags of a mounted filesystem (call to mount() with MS_REMOUNT).

Mount flags

data MountFlag Source

A filesystem independent option to be used when mounting a filesystem.

Constructors

ReadOnly

Mount read-only (MS_RDONLY).

NoSUID

Ignore suid and sgid bits (MS_NOSUID).

NoDev

Disallow access to device special files (MS_NODEV).

NoExec

Disallow program execution (MS_NOEXEC).

Synchronous

Writes are synced at once (MS_SYNCHRONOUS).

MandLock

Allow mandatory locks on a filesystem (MS_MANDLOCK).

DirSync

Directory modifications are synchronous (MS_DIRSYNC).

NoATime

Do not update access times (MS_NOATIME).

NoDirATime

Do not update directory access times (MS_NODIRATIME).

Silent

Silent mount (MS_SILENT).

PosixACL

VFS does not apply the umask (MS_POSIXACL).

RelATime

Update atime relative to mtime/ctime (MS_RELATIME).

IVersion

Update inode I_version field (MS_I_VERSION).

StrictATime

Always perform atime updates (MS_STRICTATIME).

type DriverData = ByteStringSource

Filesystem dependent options to be used when mounting a filesystem; the content of DriverData is passed directly to the filesystem driver.

Bind a filesystem

bindSource

Arguments

:: FilePath

Source mount point

-> FilePath

Target mount point

-> IO () 

Mount an already mounted filesystem under a new directory (call to mount() with MS_BIND).

rBindSource

Arguments

:: FilePath

Source mount point

-> FilePath

Target mount point

-> IO () 

Mount an already mounted filesystem and all its submounts under a new directory (call to mount() with MS_BIND and MS_REC).

rebindSource

Arguments

:: FilePath

Mount point

-> [MountFlag]

List of mount options

-> IO () 

Alter flags of a bound filesystem (call to mount() with MS_REMOUNT and MS_BIND).

Change propagation flags

These functions change the propagation flag of an already mounted filesystem, as explained in https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt. They all take the mount point as argument.

makeShared :: FilePath -> IO ()Source

Set the MS_SHARED propagation flag on a mounted filesystem.

makeRShared :: FilePath -> IO ()Source

Set the MS_SHARED propagation flag on a mounted filesystem and recursively on all submounts.

makeSlave :: FilePath -> IO ()Source

Set the MS_SLAVE propagation flag on a mounted filesystem.

makeRSlave :: FilePath -> IO ()Source

Set the MS_SLAVE propagation flag on a mounted filesystem recursively on all submounts.

makePrivate :: FilePath -> IO ()Source

Set the MS_PRIVATE propagation flag on a mounted filesystem.

makeRPrivate :: FilePath -> IO ()Source

Set the MS_PRIVATE propagation flag on a mounted filesystem and recursively on all submounts.

makeUnbindable :: FilePath -> IO ()Source

Set the MS_UNBINDABLE propagation flag on a mounted filesystem.

makeRUnbindable :: FilePath -> IO ()Source

Set the MS_UNBINDABLE propagation flag on a mounted filesystem and recursively on all submounts.

Move a filesystem

moveSource

Arguments

:: FilePath

Old mount point

-> FilePath

New mount point

-> IO () 

Atomically move a mounted filesystem to another mount point (call to mount() with MS_MOVE).

Unmount a filesystem

umountSource

Arguments

:: FilePath

Mount point

-> IO () 

Unmount a filesystem (call to umount()).

umountWithSource

Arguments

:: UmountFlag

Unmount option

-> SymLink

Follow or NoFollow symbolic links

-> FilePath

Mount point

-> IO () 

Unmount a filesystem using specific unmount options (call to umount2()). See UmountFlag for details.

Unmount flags

data UmountFlag Source

A filesystem independent option to be used when unmounting a filesystem.

Constructors

Plain

Plain unmount, behaves like umount.

Force

Force unmount even if busy.

Detach

Perform a lazy unmount: make the mount point unavailable for new accesses, and actually perform the unmount when the mount point ceases to be busy.

Expire

Mark the mount point as expired. If a mount point is not currently in use, then an initial call to umountWith with this flag fails with the error eAGAIN, but marks the mount point as expired. The mount point remains expired as long as it isn't accessed by any process. A second umountWith call specifying Expire unmounts an expired mount point.

data SymLink Source

Whether to follow symbolic links on umount.

Constructors

Follow 
NoFollow