.\" Hey Emacs! This file is -*- nroff -*- source. .\" .\" Copyright (C) 1993 Rickard E. Faith .\" Copyright (C) 1994 Andries E. Brouwer .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" " .\" Modified Mon Nov 4 20:23:39 1996 by Eric S. Raymond .TH MOUNT 2 "28 Nov 1994" "Linux 1.1.67" "Linux Programmer's Manual" .SH NAME mount, umount \- mount and unmount filesystems. .SH SYNOPSIS .B #include .br .B #include .sp .BI "int mount(const char *" specialfile ", const char * " dir .BI ", const char * " filesystemtype ", unsigned long " rwflag .BI ", const void * " data ); .sp .BI "int umount(const char *" specialfile ); .sp .BI "int umount(const char *" dir ); .SH DESCRIPTION .B mount attaches the filesystem specified by .I specialfile (which is often a device name) to the directory specified by .IR dir . .B umount removes the attachment of the filesystem specified by .IR specialfile or .IR dir . Only the super-user may mount and unmount filesystems. The .IR filesystemtype argument may take one of the values listed in /proc/filesystems (like "minix", "ext2", "msdos", "proc", "nfs", "iso9660" etc.). The .IR rwflag argument has the magic number 0xC0ED in the top 16 bits, and various mount flags (as defined in ) in the low order 16 bits: .nf #define MS_RDONLY 1 /* mount read-only */ #define MS_NOSUID 2 /* ignore suid and sgid bits */ #define MS_NODEV 4 /* disallow access to device special files */ #define MS_NOEXEC 8 /* disallow program execution */ #define MS_SYNC 16 /* writes are synced at once */ #define MS_REMOUNT 32 /* alter flags of a mounted FS */ #define MS_MGC_VAL 0xC0ED0000 .fi If the magic number is absent, then the last two arguments are not used. The .IR data argument is interpreted by the different file systems. .SH "RETURN VALUE" On success, zero is returned. On error, \-1 is returned, and .I errno is set appropriately. .SH ERRORS The error values given below result from filesystem type independent errors. Each filesystem type may have its own special errors and its own special behavior. See the kernel source code for details. .TP 0.8i .B EPERM The user is not the super-user. .TP .B ENODEV .I Filesystemtype not configured in the kernel. .TP .B ENOTBLK .I Specialfile is not a block device (if a device was required). .TP .B EBUSY .I Specialfile is already mounted. Or, it cannot be remounted read-only, because it still holds files open for writing. Or, it cannot be mounted on .I dir because .I dir is still busy (it is the working directory of some task, the mount point of another device, has open files, etc.). .TP .B EINVAL .I Specialfile had an invalid superblock. Or, a remount was attempted, while .I specialfile was not already mounted on .IR dir . Or, an umount was attempted, while .I dir was not a mount point. .TP .B EFAULT One of the pointer arguments points outside the user address space. .TP .B ENOMEM The kernel could not allocate a free page to copy filenames or data into. .TP .B ENAMETOOLONG A pathname was longer than MAXPATHLEN. .TP .B ENOENT A pathname was empty or had a nonexistent component. .TP .B ENOTDIR The second argument, or a prefix of the first argument, is not a directory. .TP .B EACCES A component of a path was not searchable. .br Or, mounting a read-only filesystem was attempted without giving the MS_RDONLY flag. .br Or, the block device .I Specialfile is located on a filesystem mounted with the MS_NODEV option. .TP .B ENXIO The major number of the block device .I specialfile is out of range. .TP .B EMFILE (In case no block device is required:) Table of dummy devices is full. .SH "CONFORMING TO" These functions are Linux-specific and should not be used in programs intended to be portable. .SH "SEE ALSO" .BR mount "(8), " umount (8)