Re: mount() function problem !



On 13 Jun 2008 at 6:34, onkar.n.mahajan@xxxxxxxxx wrote:
int mount(const char *fs, const char *path, int mflag); int
mount(const char *fs, const char *path, int mflag, const char
*fstype, const char *dataptr, int datalen);

I am not getting what is meant by this --> int mflag, const char
*fstype, const char *dataptr, int datalen
Can anybody please explain me with example , Please !

Check your system's documentation. For example, here's some Linux
documentation.


Extract from mount(2) manpage:

NAME
mount- mount filesystems

SYNOPSIS
#include <sys/mount.h>

int mount(const char *source, const char *target,
const char *filesystemtype, unsigned long mountflags,
const void *data);


DESCRIPTION
mount() attaches the filesystem specified by source (which is often a device name,
but can also be a directory name or a dummy) to the directory specified by target.

Appropriate privilege (Linux: the CAP_SYS_ADMIN capability) is required to mount and
unmount filesystems.

Values for the filesystemtype argument supported by the kernel are listed in
/proc/filesystems (like "minix", "ext2", "msdos", "proc", "nfs", "iso9660" etc.).
Further types may become available when the appropriate modules are loaded.

The mountflags argument may have the magic number 0xC0ED (MS_MGC_VAL) in the top 16
bits (this was required in kernel versions prior to 2.4, but is no longer required
and ignored if specified), and various mount flags (as defined in <linux/fs.h> for
libc4 and libc5 and in <sys/mount.h> for glibc2) in the low order 16 bits:

MS_BIND (Linux 2.4 onwards)
Perform a bind mount, making a file or a directory subtree visible at another
point within a file system. Bind mounts may cross file system boundaries and
span chroot(2) jails. The filesystemtype, mountflags, and data arguments are
ignored.

MS_DIRSYNC (since Linux 2.5.19)
Make directory changes on this file system synchronous. (This property can
be obtained for individual directories or subtrees using chattr(1).)

MS_MANDLOCK
Permit mandatory locking on files in this file system. (Mandatory locking
must still be enabled on a per-file basis, as described in fcntl(2).)
MS_MOVE
Move a subtree. source specifies an existing mount point and target speci‐
fies the new location. The move is atomic: at no point is the subtree
unmounted. The filesystemtype, mountflags, and data arguments are ignored.

MS_NOATIME
Do not update access times for (all types of) files on this file system.

MS_NODEV
Do not allow access to devices (special files) on this file system.

MS_NODIRATIME
Do not update access times for directories on this file system. This flag
provides a subset of the functionality provided by MS_NOATIME; that is,
MS_NOATIME implies MS_NODIRATIME.

MS_NOEXEC
Do not allow programs to be executed from this file system.

MS_NOSUID
Do not honor set-user-ID and set-group-ID bits when executing programs from
this file system.

MS_RDONLY
Mount file system read-only.
MS_RELATIME (Since Linux 2.6.20)
When a file on this file system is accessed, only update the file’s last
accessed time (atime) if the current value of atime is less than or equal to
the file’s last modified (mtime) or last status change time (ctime). This
option is useful for programs, such as mutt(1), that need to know when a file
has been read since it was last modified.

MS_REMOUNT
Remount an existing mount. This allows you to change the mountflags and data
of an existing mount without having to unmount and remount the file system.
source and target should be the same values specified in the initial mount()
call; filesystemtype is ignored.

The following mountflags can be changed: MS_RDONLY, MS_SYNCHRONOUS, MS_MAND‐
LOCK; before kernel 2.6.16, the following could also be changed: MS_NOATIME
and MS_NODIRATIME; and, additionally, before kernel 2.4, the following could
also be changed: MS_NOSUID, MS_NODEV, MS_NOEXEC.

MS_SYNCHRONOUS
Make writes on this file system synchronous (as though the O_SYNC flag to
open(2) was specified for all file opens to this file system).

From Linux 2.4 onwards, the MS_NODEV, MS_NOEXEC, and MS_NOSUID flags are settable on
a per-mount-point basis. From kernel 2.6.16 onwards, MS_NOATIME and MS_NODIRATIME
are also settable on a per-mount-point basis. The MS_RELATIME flag is also settable
on a per-mount-point basis.

The data argument is interpreted by the different file systems. Typically it is a
string of comma-separated options understood by this file system. See mount(8) for
details of the options available for each filesystem type.


* * *


Extract from mount(8) manpage:


FILESYSTEM SPECIFIC MOUNT OPTIONS
The following options apply only to certain file systems. We sort them by file sys‐
tem. They all follow the -o flag.

What options are supported depends a bit on the running kernel. More info may be
found in the kernel source subdirectory Documentation/filesystems.

Mount options for adfs
uid=value and gid=value
Set the owner and group of the files in the file system (default: uid=gid=0).

ownmask=value and othmask=value
Set the permission mask for ADFS ’owner’ permissions and ’other’ permissions,
respectively (default: 0700 and 0077, respectively). See also
/usr/src/linux/Documentation/filesystems/adfs.txt.

Mount options for affs
uid=value and gid=value
Set the owner and group of the root of the file system (default: uid=gid=0,
but with option uid or gid without specified value, the uid and gid of the
current process are taken).

setuid=value and setgid=value
Set the owner and group of all files.

mode=value
Set the mode of all files to value & 0777 disregarding the original permis‐
sions. Add search permission to directories that have read permission. The
value is given in octal.

protect
Do not allow any changes to the protection bits on the file system.

usemp Set uid and gid of the root of the file system to the uid and gid of the
mount point upon the first sync or umount, and then clear this option.
Strange...

verbose
Print an informational message for each successful mount.

prefix=string
Prefix used before volume name, when following a link.

volume=string
Prefix (of length at most 30) used before ’/’ when following a symbolic link.

reserved=value
(Default: 2.) Number of unused blocks at the start of the device.

root=value
Give explicitly the location of the root block.

bs=value
Give blocksize. Allowed values are 512, 1024, 2048, 4096.

grpquota / noquota / quota / usrquota
These options are accepted but ignored. (However, quota utilities may react
to such strings in /etc/fstab.)

Mount options for cifs
See the options section of the mount.cifs(8) man page (smbfs package must be
installed).

Mount options for coherent
None.

Mount options for debugfs
The debugfs file system is a pseudo file system, traditionally mounted on /sys/ker‐
nel/debug. There are no mount options.

Mount options for devpts
The devpts file system is a pseudo file system, traditionally mounted on /dev/pts.
In order to acquire a pseudo terminal, a process opens /dev/ptmx; the number of the
pseudo terminal is then made available to the process and the pseudo terminal slave
can be accessed as /dev/pts/<number>.

uid=value and gid=value
This sets the owner or the group of newly created PTYs to the specified val‐
ues. When nothing is specified, they will be set to the UID and GID of the
creating process. For example, if there is a tty group with GID 5, then
gid=5 will cause newly created PTYs to belong to the tty group.

mode=value
Set the mode of newly created PTYs to the specified value. The default is
0600. A value of mode=620 and gid=5 makes "mesg y" the default on newly cre‐
ated PTYs.

Mount options for ext
None. Note that the ‘ext’ file system is obsolete. Don’t use it. Since Linux ver‐
sion 2.1.21 extfs is no longer part of the kernel source.

Mount options for ext2
The ‘ext2’ file system is the standard Linux file system. Since Linux 2.5.46, for
most mount options the default is determined by the filesystem superblock. Set them
with tune2fs(8).

acl / noacl
Support POSIX Access Control Lists (or not).

bsddf / minixdf
Set the behaviour for the statfs system call. The minixdf behaviour is to
return in the f_blocks field the total number of blocks of the file system,
while the bsddf behaviour (which is the default) is to subtract the overhead
blocks used by the ext2 file system and not available for file storage. Thus

% mount /k -o minixdf; df /k; umount /k
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/sda6 2630655 86954 2412169 3% /k
% mount /k -o bsddf; df /k; umount /k
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/sda6 2543714 13 2412169 0% /k

(Note that this example shows that one can add command line options to the options
given in /etc/fstab.)

check=none / nocheck
No checking is done at mount time. This is the default. This is fast. It is
wise to invoke e2fsck(8) every now and then, e.g. at boot time.

debug Print debugging info upon each (re)mount.

errors=continue / errors=remount-ro / errors=panic
Define the behaviour when an error is encountered. (Either ignore errors and
just mark the file system erroneous and continue, or remount the file system
read-only, or panic and halt the system.) The default is set in the filesys‐
tem superblock, and can be changed using tune2fs(8).

grpid or bsdgroups / nogrpid or sysvgroups
These options define what group id a newly created file gets. When grpid is
set, it takes the group id of the directory in which it is created; otherwise
(the default) it takes the fsgid of the current process, unless the directory
has the setgid bit set, in which case it takes the gid from the parent direc‐
tory, and also gets the setgid bit set if it is a directory itself.

grpquota / noquota / quota / usrquota
These options are accepted but ignored.

nobh Do not attach buffer_heads to file pagecache. (Since 2.5.49.)

nouid32
Disables 32-bit UIDs and GIDs. This is for interoperability with older ker‐
nels which only store and expect 16-bit values.

oldalloc or orlov
Use old allocator or Orlov allocator for new inodes. Orlov is default.

resgid=n and resuid=n
The ext2 file system reserves a certain percentage of the available space (by
default 5%, see mke2fs(8) and tune2fs(8)). These options determine who can
use the reserved blocks. (Roughly: whoever has the specified uid, or belongs
to the specified group.)

sb=n Instead of block 1, use block n as superblock. This could be useful when the
filesystem has been damaged. (Earlier, copies of the superblock would be
made every 8192 blocks: in block 1, 8193, 16385, ... (and one got thousands
of copies on a big filesystem). Since version 1.08, mke2fs has a -s (sparse
superblock) option to reduce the number of backup superblocks, and since ver‐
sion 1.15 this is the default. Note that this may mean that ext2 filesystems
created by a recent mke2fs cannot be mounted r/w under Linux 2.0.*.) The
block number here uses 1k units. Thus, if you want to use logical block 32768
on a filesystem with 4k blocks, use "sb=131072".

user_xattr / nouser_xattr
Support "user." extended attributes (or not).

Mount options for ext3
The ‘ext3’ file system is a version of the ext2 file system which has been enhanced
with journalling. It supports the same options as ext2 as well as the following
additions:

journal=update
Update the ext3 file system’s journal to the current format.

journal=inum
When a journal already exists, this option is ignored. Otherwise, it speci‐
fies the number of the inode which will represent the ext3 file system’s
journal file; ext3 will create a new journal, overwriting the old contents
of the file whose inode number is inum.

noload Do not load the ext3 file system’s journal on mounting.

data=journal / data=ordered / data=writeback
Specifies the journalling mode for file data. Metadata is always journaled.
To use modes other than ordered on the root file system, pass the mode to the
kernel as boot parameter, e.g. rootflags=data=journal.

journal
All data is committed into the journal prior to being written into the
main file system.

ordered
This is the default mode. All data is forced directly out to the main
file system prior to its metadata being committed to the journal.

writeback
Data ordering is not preserved - data may be written into the main
file system after its metadata has been committed to the journal.
This is rumoured to be the highest-throughput option. It guarantees
internal file system integrity, however it can allow old data to
appear in files after a crash and journal recovery.

commit=nrsec
Sync all data and metadata every nrsec seconds. The default value is 5 sec‐
onds. Zero means default.

user_xattr
Enable Extended User Attributes. See the attr(5) manual page.

acl Enable POSIX Access Control Lists. See the acl(5) manual page.

Mount options for fat
(Note: fat is not a separate filesystem, but a common part of the msdos, umsdos and
vfat filesystems.)

blocksize=512 / blocksize=1024 / blocksize=2048
Set blocksize (default 512).

uid=value and gid=value
Set the owner and group of all files. (Default: the uid and gid of the cur‐
rent process.)

umask=value
Set the umask (the bitmask of the permissions that are not present). The
default is the umask of the current process. The value is given in octal.

dmask=value
Set the umask applied to directories only. The default is the umask of the
current process. The value is given in octal.

fmask=value
Set the umask applied to regular files only. The default is the umask of the
current process. The value is given in octal.

check=value
Three different levels of pickyness can be chosen:

r[elaxed]
Upper and lower case are accepted and equivalent, long name parts are
truncated (e.g. verylongname.foobar becomes verylong.foo), leading
and embedded spaces are accepted in each name part (name and exten‐
sion).

n[ormal]
Like "relaxed", but many special characters (*, ?, <, spaces, etc.)
are rejected. This is the default.

s[trict]
Like "normal", but names may not contain long parts and special char‐
acters that are sometimes used on Linux, but are not accepted by MS-
DOS are rejected. (+, =, spaces, etc.)

codepage=value
Sets the codepage for converting to shortname characters on FAT and VFAT
filesystems. By default, codepage 437 is used.

conv=b[inary] / conv=t[ext] / conv=a[uto]
The fat file system can perform CRLF<-->NL (MS-DOS text format to UNIX text
format) conversion in the kernel. The following conversion modes are avail‐
able:

binary no translation is performed. This is the default.

text CRLF<-->NL translation is performed on all files.

auto CRLF<-->NL translation is performed on all files that don’t have a
"well-known binary" extension. The list of known extensions can be
found at the beginning of fs/fat/misc.c (as of 2.0, the list is: exe,
com, bin, app, sys, drv, ovl, ovr, obj, lib, dll, pif, arc, zip, lha,
lzh, zoo, tar, z, arj, tz, taz, tzp, tpz, gz, tgz, deb, gif, bmp, tif,
gl, jpg, pcx, tfm, vf, gf, pk, pxl, dvi).

Programs that do computed lseeks won’t like in-kernel text conversion. Sev‐
eral people have had their data ruined by this translation. Beware!

For file systems mounted in binary mode, a conversion tool (fromdos/todos) is
available.

cvf_format=module
Forces the driver to use the CVF (Compressed Volume File) module cvf_module
instead of auto-detection. If the kernel supports kmod, the cvf_format=xxx
option also controls on-demand CVF module loading.

cvf_option=option
Option passed to the CVF module.

debug Turn on the debug flag. A version string and a list of file system parame‐
ters will be printed (these data are also printed if the parameters appear to
be inconsistent).

fat=12 / fat=16 / fat=32
Specify a 12, 16 or 32 bit fat. This overrides the automatic FAT type detec‐
tion routine. Use with caution!

iocharset=value
Character set to use for converting between 8 bit characters and 16 bit Uni‐
code characters. The default is iso8859-1. Long filenames are stored on disk
in Unicode format.

quiet Turn on the quiet flag. Attempts to chown or chmod files do not return
errors, although they fail. Use with caution!

sys_immutable, showexec, dots, nodots, dotsOK=[yes|no]
Various misguided attempts to force Unix or DOS conventions onto a FAT file
system.

Mount options for hfs
creator=cccc, type=cccc
Set the creator/type values as shown by the MacOS finder used for creating
new files. Default values: ’????’.

uid=n, gid=n
Set the owner and group of all files. (Default: the uid and gid of the cur‐
rent process.)

dir_umask=n, file_umask=n, umask=n
Set the umask used for all directories, all regular files, or all files and
directories. Defaults to the umask of the current process.

session=n
Select the CDROM session to mount. Defaults to leaving that decision to the
CDROM driver. This option will fail with anything but a CDROM as underlying
device.

part=n Select partition number n from the device. Only makes sense for CDROMS.
Defaults to not parsing the partition table at all.

quiet Don’t complain about invalid mount options.

Mount options for hpfs
uid=value and gid=value
Set the owner and group of all files. (Default: the uid and gid of the cur‐
rent process.)

umask=value
Set the umask (the bitmask of the permissions that are not present). The
default is the umask of the current process. The value is given in octal.

case=lower / case=asis
Convert all files names to lower case, or leave them. (Default: case=lower.)

conv=binary / conv=text / conv=auto
For conv=text, delete some random CRs (in particular, all followed by NL)
when reading a file. For conv=auto, choose more or less at random between
conv=binary and conv=text. For conv=binary, just read what is in the file.
This is the default.

nocheck
Do not abort mounting when certain consistency checks fail.

Mount options for iso9660
ISO 9660 is a standard describing a filesystem structure to be used on CD-ROMs.
(This filesystem type is also seen on some DVDs. See also the udf filesystem.)

Normal iso9660 filenames appear in a 8.3 format (i.e., DOS-like restrictions on
filename length), and in addition all characters are in upper case. Also there is
no field for file ownership, protection, number of links, provision for block/char‐
acter devices, etc.

Rock Ridge is an extension to iso9660 that provides all of these unix like features.
Basically there are extensions to each directory record that supply all of the addi‐
tional information, and when Rock Ridge is in use, the filesystem is indistinguish‐
able from a normal UNIX file system (except that it is read-only, of course).

norock Disable the use of Rock Ridge extensions, even if available. Cf. map.

nojoliet
Disable the use of Microsoft Joliet extensions, even if available. Cf. map.

check=r[elaxed] / check=s[trict]
With check=relaxed, a filename is first converted to lower case before doing
the lookup. This is probably only meaningful together with norock and
map=normal. (Default: check=strict.)

uid=value and gid=value
Give all files in the file system the indicated user or group id, possibly
overriding the information found in the Rock Ridge extensions. (Default:
uid=0,gid=0.)

map=n[ormal] / map=o[ff] / map=a[corn]
For non-Rock Ridge volumes, normal name translation maps upper to lower case
ASCII, drops a trailing ‘;1’, and converts ‘;’ to ‘.’. With map=off no name
translation is done. See norock. (Default: map=normal.) map=acorn is like
map=normal but also apply Acorn extensions if present.

mode=value
For non-Rock Ridge volumes, give all files the indicated mode. (Default:
read permission for everybody.) Since Linux 2.1.37 one no longer needs to
specify the mode in decimal. (Octal is indicated by a leading 0.)

unhide Also show hidden and associated files. (If the ordinary files and the asso‐
ciated or hidden files have the same filenames, this may make the ordinary
files inaccessible.)

block=[512|1024|2048]
Set the block size to the indicated value. (Default: block=1024.)

conv=a[uto] / conv=b[inary] / conv=m[text] / conv=t[ext]
(Default: conv=binary.) Since Linux 1.3.54 this option has no effect any‐
more. (And non-binary settings used to be very dangerous, possibly leading
to silent data corruption.)

cruft If the high byte of the file length contains other garbage, set this mount
option to ignore the high order bits of the file length. This implies that a
file cannot be larger than 16MB.

session=x
Select number of session on multisession CD. (Since 2.3.4.)

sbsector=xxx
Session begins from sector xxx. (Since 2.3.4.)

The following options are the same as for vfat and specifying them only makes sense
when using discs encoded using Microsoft’s Joliet extensions.

iocharset=value
Character set to use for converting 16 bit Unicode characters on CD to 8 bit
characters. The default is iso8859-1.

utf8 Convert 16 bit Unicode characters on CD to UTF-8.

Mount options for jfs
iocharset=name
Character set to use for converting from Unicode to ASCII. The default is to
do no conversion. Use iocharset=utf8 for UTF8 translations. This requires
CONFIG_NLS_UTF8 to be set in the kernel .config file.

resize=value
Resize the volume to value blocks. JFS only supports growing a volume, not
shrinking it. This option is only valid during a remount, when the volume is
mounted read-write. The resize keyword with no value will grow the volume to
the full size of the partition.

nointegrity
Do not write to the journal. The primary use of this option is to allow for
higher performance when restoring a volume from backup media. The integrity
of the volume is not guaranteed if the system abnormally abends.

integrity
Default. Commit metadata changes to the journal. Use this option to remount
a volume where the nointegrity option was previously specified in order to
restore normal behavior.

errors=continue / errors=remount-ro / errors=panic
Define the behaviour when an error is encountered. (Either ignore errors and
just mark the file system erroneous and continue, or remount the file system
read-only, or panic and halt the system.)

noquota / quota / usrquota / grpquota
These options are accepted but ignored.

Mount options for minix
None.

Mount options for msdos
See mount options for fat. If the msdos file system detects an inconsistency, it
reports an error and sets the file system read-only. The file system can be made
writeable again by remounting it.

Mount options for ncpfs
Just like nfs, the ncpfs implementation expects a binary argument (a struct
ncp_mount_data) to the mount system call. This argument is constructed by ncp‐
mount(8) and the current version of mount (2.12) does not know anything about ncpfs.

Mount options for nfs and nfs4
See the options section of the nfs(5) man page (nfs-common package must be
installed).

The nfs and nfs4 implementation expects a binary argument (a struct nfs_mount_data)
to the mount system call. This argument is constructed by mount.nfs(8) and the cur‐
rent version of mount (2.13) does not know anything about nfs and nfs4.

Mount options for ntfs
iocharset=name
Character set to use when returning file names. Unlike VFAT, NTFS suppresses
names that contain unconvertible characters. Deprecated.

nls=name
New name for the option earlier called iocharset.

utf8 Use UTF-8 for converting file names.

uni_xlate=[0|1|2]
For 0 (or ‘no’ or ‘false’), do not use escape sequences for unknown Unicode
characters. For 1 (or ‘yes’ or ‘true’) or 2, use vfat-style 4-byte escape
sequences starting with ":". Here 2 give a little-endian encoding and 1 a
byteswapped bigendian encoding.

posix=[0|1]
If enabled (posix=1), the file system distinguishes between upper and lower
case. The 8.3 alias names are presented as hard links instead of being sup‐
pressed.

uid=value, gid=value and umask=value
Set the file permission on the filesystem. The umask value is given in
octal. By default, the files are owned by root and not readable by somebody
else.

Mount options for proc
uid=value and gid=value
These options are recognized, but have no effect as far as I can see.

Mount options for ramfs
Ramfs is a memory based filesystem. Mount it and you have it. Unmount it and it is
gone. Present since Linux 2.3.99pre4. There are no mount options.

Mount options for reiserfs
Reiserfs is a journaling filesystem. The reiserfs mount options are more fully
described at http://www.namesys.com/mount-options.html.

conv Instructs version 3.6 reiserfs software to mount a version 3.5 file system,
using the 3.6 format for newly created objects. This file system will no
longer be compatible with reiserfs 3.5 tools.

hash=rupasov / hash=tea / hash=r5 / hash=detect
Choose which hash function reiserfs will use to find files within directo‐
ries.

rupasov
A hash invented by Yury Yu. Rupasov. It is fast and preserves local‐
ity, mapping lexicographically close file names to close hash values.
This option should not be used, as it causes a high probability of
hash collisions.

tea A Davis-Meyer function implemented by Jeremy Fitzhardinge. It uses
hash permuting bits in the name. It gets high randomness and, there‐
fore, low probability of hash collisions at some CPU cost. This may
be used if EHASHCOLLISION errors are experienced with the r5 hash.

r5 A modified version of the rupasov hash. It is used by default and is
the best choice unless the file system has huge directories and
unusual file-name patterns.

detect Instructs mount to detect which hash function is in use by examining
the file system being mounted, and to write this information into the
reiserfs superblock. This is only useful on the first mount of an old
format file system.

hashed_relocation
Tunes the block allocator. This may provide performance improvements in some
situations.

no_unhashed_relocation
Tunes the block allocator. This may provide performance improvements in some
situations.

noborder
Disable the border allocator algorithm invented by Yury Yu. Rupasov. This
may provide performance improvements in some situations.

nolog Disable journalling. This will provide slight performance improvements in
some situations at the cost of losing reiserfs’s fast recovery from crashes.
Even with this option turned on, reiserfs still performs all journalling
operations, save for actual writes into its journalling area. Implementation
of nolog is a work in progress.

notail By default, reiserfs stores small files and ‘file tails’ directly into its
tree. This confuses some utilities such as LILO(8). This option is used to
disable packing of files into the tree.

replayonly
Replay the transactions which are in the journal, but do not actually mount
the file system. Mainly used by reiserfsck.

resize=number
A remount option which permits online expansion of reiserfs partitions.
Instructs reiserfs to assume that the device has number blocks. This option
is designed for use with devices which are under logical volume management
(LVM). There is a special resizer utility which can be obtained from
ftp://ftp.namesys.com/pub/reiserfsprogs.

user_xattr
Enable Extended User Attributes. See the attr(5) manual page.

acl Enable POSIX Access Control Lists. See the acl(5) manual page.

Mount options for romfs
None.

Mount options for smbfs
Just like nfs, the smbfs implementation expects a binary argument (a struct
smb_mount_data) to the mount system call. This argument is constructed by smb‐
mount(8) and the current version of mount (2.12) does not know anything about smbfs.

Mount options for sysv
None.

Mount options for tmpfs
The following parameters accept a suffix k, m or g for Ki, Mi, Gi (binary kilo, mega
and giga) and can be changed on remount.

size=nbytes
Override default maximum size of the filesystem. The size is given in bytes,
and rounded down to entire pages. The default is half of the memory.

nr_blocks=
Set number of blocks.

nr_inodes=
Set number of inodes.

mode= Set initial permissions of the root directory.

Mount options for udf
udf is the "Universal Disk Format" filesystem defined by the Optical Storage Tech‐
nology Association, and is often used for DVD-ROM. See also iso9660.

gid= Set the default group.

umask= Set the default umask. The value is given in octal.

uid= Set the default user.

unhide Show otherwise hidden files.

undelete
Show deleted files in lists.

nostrict
Unset strict conformance.

iocharset
Set the NLS character set.

bs= Set the block size. (May not work unless 2048.)

novrs Skip volume sequence recognition.

session=
Set the CDROM session counting from 0. Default: last session.

anchor=
Override standard anchor location. Default: 256.

volume=
Override the VolumeDesc location. (unused)

partition=
Override the PartitionDesc location. (unused)

lastblock=
Set the last block of the filesystem.

fileset=
Override the fileset block location. (unused)

rootdir=
Override the root directory location. (unused)

Mount options for ufs
ufstype=value
UFS is a file system widely used in different operating systems. The problem
are differences among implementations. Features of some implementations are
undocumented, so its hard to recognize the type of ufs automatically. That’s
why the user must specify the type of ufs by mount option. Possible values
are:

old Old format of ufs, this is the default, read only. (Don’t forget to
give the -r option.)

44bsd For filesystems created by a BSD-like system (NetBSD,FreeBSD,OpenBSD).

sun For filesystems created by SunOS or Solaris on Sparc.

sunx86 For filesystems created by Solaris on x86.

hp For filesystems created by HP-UX, read-only.

nextstep
For filesystems created by NeXTStep (on NeXT station) (currently read
only).

nextstep-cd
For NextStep CDROMs (block_size == 2048), read-only.

openstep
For filesystems created by OpenStep (currently read only). The same
filesystem type is also used by Mac OS X.

onerror=value
Set behaviour on error:

panic If an error is encountered, cause a kernel panic.

[lock|umount|repair]
These mount options don’t do anything at present; when an error is
encountered only a console message is printed.

Mount options for umsdos
See mount options for msdos. The dotsOK option is explicitly killed by umsdos.

Mount options for vfat
First of all, the mount options for fat are recognized. The dotsOK option is
explicitly killed by vfat. Furthermore, there are

uni_xlate
Translate unhandled Unicode characters to special escaped sequences. This
lets you backup and restore filenames that are created with any Unicode char‐
acters. Without this option, a ’?’ is used when no translation is possible.
The escape character is ’:’ because it is otherwise illegal on the vfat
filesystem. The escape sequence that gets used, where u is the unicode char‐
acter, is: ’:’, (u & 0x3f), ((u>>6) & 0x3f), (u>>12).

posix Allow two files with names that only differ in case.

nonumtail
First try to make a short name without sequence number, before trying
name~num.ext.

utf8 UTF8 is the filesystem safe 8-bit encoding of Unicode that is used by the
console. It can be be enabled for the filesystem with this option. If
‘uni_xlate’ gets set, UTF8 gets disabled.

shortname=[lower|win95|winnt|mixed]

Defines the behaviour for creation and display of filenames which fit into
8.3 characters. If a long name for a file exists, it will always be preferred
display. There are four modes:

lower Force the short name to lower case upon display; store a long name
when the short name is not all upper case.

win95 Force the short name to upper case upon display; store a long name
when the short name is not all upper case.

winnt Display the shortname as is; store a long name when the short name is
not all lower case or all upper case.

mixed Display the short name as is; store a long name when the short name is
not all upper case.

The default is "lower".

Mount options for usbfs
devuid=uid and devgid=gid and devmode=mode
Set the owner and group and mode of the device files in the usbfs file system
(default: uid=gid=0, mode=0644). The mode is given in octal.

busuid=uid and busgid=gid and busmode=mode
Set the owner and group and mode of the bus directories in the usbfs file
system (default: uid=gid=0, mode=0555). The mode is given in octal.

listuid=uid and listgid=gid and listmode=mode
Set the owner and group and mode of the file devices (default: uid=gid=0,
mode=0444). The mode is given in octal.

Mount options for xenix
None.

Mount options for xfs
allocsize=size
Sets the buffered I/O end-of-file preallocation size when doing delayed allo‐
cation writeout (default size is 64KiB). Valid values for this option are
page size (typically 4KiB) through to 1GiB, inclusive, in power-of-2 incre‐
ments.

attr2 / noattr2
The options enable/disable (default is disabled for backward compatibility
on-disk) an "opportunistic" improvement to be made in the way inline extended
attributes are stored on-disk. When the new form is used for the first time
(by setting or removing extended attributes) the on-disk superblock feature
bit field will be updated to reflect this format being in use.

barrier
Enables the use of block layer write barriers for writes into the journal and
unwritten extent conversion. This allows for drive level write caching to be
enabled, for devices that support write barriers.

dmapi Enable the DMAPI (Data Management API) event callouts. Use with the mtpt
option.

grpid / bsdgroups and nogrpid / sysvgroups
These options define what group ID a newly created file gets. When grpid is
set, it takes the group ID of the directory in which it is created; otherwise
(the default) it takes the fsgid of the current process, unless the directory
has the setgid bit set, in which case it takes the gid from the parent direc‐
tory, and also gets the setgid bit set if it is a directory itself.

ihashsize=value
Sets the number of hash buckets available for hashing the in-memory inodes of
the specified mount point. If a value of zero is used, the value selected by
the default algorithm will be displayed in /proc/mounts.

ikeep / noikeep
When inode clusters are emptied of inodes, keep them around on the disk
(ikeep) - this is the traditional XFS behaviour and is still the default for
now. Using the noikeep option, inode clusters are returned to the free space
pool.

inode64
Indicates that XFS is allowed to create inodes at any location in the
filesystem, including those which will result in inode numbers occupying more
than 32 bits of significance. This is provided for backwards compatibility,
but causes problems for backup applications that cannot handle large inode
numbers.

largeio / nolargeio
If nolargeio is specified, the optimal I/O reported in st_blksize by stat(2)
will be as small as possible to allow user applications to avoid inefficient
read/modify/write I/O. If largeio is specified, a filesystem that has a
swidth specified will return the swidth value (in bytes) in st_blksize. If
the filesystem does not have a swidth specified but does specify an allocsize
then allocsize (in bytes) will be returned instead. If neither of these two
options are specified, then filesystem will behave as if nolargeio was speci‐
fied.

logbufs=value
Set the number of in-memory log buffers. Valid numbers range from 2-8 inclu‐
sive. The default value is 8 buffers for filesystems with a blocksize of
64KiB, 4 buffers for filesystems with a blocksize of 32KiB, 3 buffers for
filesystems with a blocksize of 16KiB and 2 buffers for all other configura‐
tions. Increasing the number of buffers may increase performance on some
workloads at the cost of the memory used for the additional log buffers and
their associated control structures.

logbsize=value
Set the size of each in-memory log buffer. Size may be specified in bytes,
or in kilobytes with a "k" suffix. Valid sizes for version 1 and version 2
logs are 16384 (16k) and 32768 (32k). Valid sizes for version 2 logs also
include 65536 (64k), 131072 (128k) and 262144 (256k). The default value for
machines with more than 32MiB of memory is 32768, machines with less memory
use 16384 by default.

logdev=device and rtdev=device
Use an external log (metadata journal) and/or real-time device. An XFS
filesystem has up to three parts: a data section, a log section, and a real-
time section. The real-time section is optional, and the log section can be
separate from the data section or contained within it. Refer to xfs(5).

mtpt=mountpoint
Use with the dmapi option. The value specified here will be included in the
DMAPI mount event, and should be the path of the actual mountpoint that is
used.

noalign
Data allocations will not be aligned at stripe unit boundaries.

noatime
Access timestamps are not updated when a file is read.

norecovery
The filesystem will be mounted without running log recovery. If the filesys‐
tem was not cleanly unmounted, it is likely to be inconsistent when mounted
in norecovery mode. Some files or directories may not be accessible because
of this. Filesystems mounted norecovery must be mounted read-only or the
mount will fail.

nouuid Don’t check for double mounted file systems using the file system uuid. This
is useful to mount LVM snapshot volumes.

osyncisdsync
Make O_SYNC writes implement true O_SYNC. WITHOUT this option, Linux XFS
behaves as if an osyncisdsync option is used, which will make writes to files
opened with the O_SYNC flag set behave as if the O_DSYNC flag had been used
instead. This can result in better performance without compromising data
safety. However if this option is not in effect, timestamp updates from
O_SYNC writes can be lost if the system crashes. If timestamp updates are
critical, use the osyncisosync option.

uquota / usrquota / uqnoenforce / quota
User disk quota accounting enabled, and limits (optionally) enforced. Refer
to xfs_quota(8) for further details.

gquota / grpquota / gqnoenforce
Group disk quota accounting enabled and limits (optionally) enforced. Refer
to xfs_quota(8) for further details.

pquota / prjquota / pqnoenforce
Project disk quota accounting enabled and limits (optionally) enforced. Refer
to xfs_quota(8) for further details.

sunit=value and swidth=value
Used to specify the stripe unit and width for a RAID device or a stripe vol‐
ume. value must be specified in 512-byte block units. If this option is not
specified and the filesystem was made on a stripe volume or the stripe width
or unit were specified for the RAID device at mkfs time, then the mount sys‐
tem call will restore the value from the superblock. For filesystems that
are made directly on RAID devices, these options can be used to override the
information in the superblock if the underlying disk layout changes after the
filesystem has been created. The swidth option is required if the sunit
option has been specified, and must be a multiple of the sunit value.

swalloc
Data allocations will be rounded up to stripe width boundaries when the cur‐
rent end of file is being extended and the file size is larger than the
stripe width size.

Mount options for xiafs
None. Although nothing is wrong with xiafs, it is not used much, and is not main‐
tained. Probably one shouldn’t use it. Since Linux version 2.1.21 xiafs is no
longer part of the kernel source.

.



Relevant Pages

  • Re: getfsent(3) and spaces in fstab
    ... Each filesystem is described on a separate line; ... having a space in a filesystem or mount point will violate ... if the name of the file system or the mount point ...
    (freebsd-hackers)
  • Re: mounting filesytem for homedir
    ... if i mount the filesystem with the superuser ACL on the directory ... you mount the disk, and then after you mount the disk you need to again ... root, but is a problem when a user owns the entire partition filesystem. ... including the "root" of the mounted file system. ...
    (Fedora)
  • Re: usb device
    ... The file system on the device is fat32! ... >>I had a similar problem while trying to mount a newly bought USB stick ... It was mountable and writeabel and readable under Windows XP ... >Yes definitely check the filesystem on the device. ...
    (Debian-User)
  • Re: [autofs] [RFC] Towards a Modern Autofs
    ... >entangling autofs with that work. ... >filesystem it's willing to export. ... >>map is mounted. ... The result is that some users will see mount points ...
    (Linux-Kernel)
  • Re: mounting filesytem for homedir
    ... you mount the disk, and then after you mount the disk you need to again make ... on the filesystem on the disk part) then the most restrictive of the two permissions will be used. ... It is not typically a problem with directories like home since /home is owned by root, but is a problem when a user owns the entire partition filesystem. ... The mode of the directory the filesystem is going to be mounted on doesn't have any impact on the mode/rights of the mounted filesystem, including the "root" of the mounted file system. ...
    (Fedora)

Loading