Sys::Linux::Mount - Bindings for the linux mount syscall.
Provides a nice high-ish level wrapper to make mounting filesystems easier.
use Sys::Linux::Mount ':all'; # or :consts, or any specific constant or function mount("/dev/source", "/target", "ext4", MS_RDONLY|MS_NOEXEC|MS_NODEV, {noacl=>1, ...}); umount("/target");
This module requires your script to have CAP_SYS_ADMIN, usually by running as root. Without that every call will likely fail.
root
All of these functions closely mirror the calling convetions and options of the respective syscalls, and more details can be found in the manpages for those calls
man 2 mount man 2 umount
mount
mount(source, target, [filesystem, [flags, [options]]])
Mount a filesystem, mostly mirrors the setup for the syscall, taking in flags as a bitwise combination of MS_* constants. MS_MGC_VAL is the magic value to say you have no flags.
MS_*
MS_MGC_VAL
options should be a hashref containing the options to give filesystem specific options, things like {uid => 'nobody', gid => 'nogroup'} for mounting CIFS filesystems. These are typically the things you'd see in mount -o uid=nobody,gid=nogroup,... except for a few like MS_NOATIME or MS_NODEV that aren't filesystem specific.
{uid => 'nobody', gid => 'nogroup'}
mount -o uid=nobody,gid=nogroup,...
umount
umount(mountpoint, [flags])
Unmount a filesystem. Possible flag values are MNT_FORCE, MNT_EXPIRE, MNT_DETACH, UMOUNT_NOFOLLOW.
The following constants are available to be exported,
MS_RDONLY MS_NOSUID MS_NODEV MS_NOEXEC MS_SYNCHRONOUS MS_REMOUNT MS_MANDLOCK MS_DIRSYNC MS_NOATIME MS_NODIRATIME MS_BIND MS_MOVE MS_REC MS_SILENT MS_POSIXACL MS_UNBINDABLE MS_PRIVATE MS_SLAVE MS_SHARED MS_RELATIME MS_KERNMOUNT MS_I_VERSION MS_STRICTATIME MS_LAZYTIME MS_ACTIVE MS_NOUSER MS_MGC_VAL MNT_FORCE MNT_DETACH MNT_EXPIRE UMOUNT_NOFOLLOW
For details about what they do, see the man pages for the mount syscall man 2 mount
man 2 mount
Ryan Voots simcop@cpan.org
To install Sys::Linux::Namespace, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sys::Linux::Namespace
CPAN shell
perl -MCPAN -e shell install Sys::Linux::Namespace
For more information on module installation, please visit the detailed CPAN module installation guide.