CONTENT
  • CHANGES
Szukaj
counter

#top mount


mount - mount a file system

Powiązane:

SYNOPSIS
mount [-lhV]
mount -a [-fFnrsvw] [-t vfstype] [-O optlist]
mount [-fnrsvw] [-o options [,...]] device | dir
mount [-fnrsvw] [-t vfstype] [-o options] device dir


DESCRIPTION



OPTIONS
-V
Output version.

-h
Print a help message.

-v
Verbose mode.

-a
Mount all filesystems (of the given types) mentioned in fstab.

-F
(Used in conjunction with -a.) Fork off a new incarnation of mount for each device. This will do the mounts on different devices or different NFS servers in parallel. This has the advantage that it is faster; also NFS timeouts go in parallel. A disadvantage is that the mounts are done in undefined order. Thus, you cannot use this option if you want to mount both /usr and /usr/spool.

-f
Causes everything to be done except for the actual system call; if it's not obvious, this ‘‘fakes'' mounting the file system. This option is useful in conjunction with the -v flag to determine what the mount command is trying to do. It can also be used to add entries for devices that were mounted earlier with the -n option.

-i
Don't call the /sbin/mount.<filesystem> helper even if it exists.

-l
Add the ext2, ext3 and XFS labels in the mount output. Mount must have permission to read the disk device (e.g. be suid root) for this to work. One can set such a label for ext2 or ext3 using the e2label(8) utility, or for XFS using xfs_admin(8), or for reiserfs using reiserfstune(8).

-n
Mount without writing in /etc/mtab. This is necessary for example when /etc is on a read-only file system.

-p num
In case of a loop mount with encryption, read the passphrase from file descriptor num instead of from the terminal.

-s
Tolerate sloppy mount options rather than failing. This will ignore mount options not supported by a filesystem type. Not all filesystems support this option. This option exists for support of the Linux autofs-based automounter.

-r
Mount the file system read-only. A synonym is -o ro.

-w
Mount the file system read/write. This is the default. A synonym is -o rw.

-L label
Mount the partition that has the specified label.

-U uuid
Mount the partition that has the specified uuid. These two options require the file /proc/partitions (present since Linux 2.1.116) to exist.

-t vfstype
The argument following the -t is used to indicate the file system type. The file system types which are currently supported include: adfs, affs, autofs, cifs, coda, coherent, cramfs, debugfs, devpts, efs, ext, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, nfs4, ntfs, proc, qnx4, ramfs, reiserfs, romfs, smbfs, sysv, tmpfs, udf, ufs, umsdos, usbfs, vfat, xenix, xfs, xiafs. Note that coherent, sysv and xenix are equivalent and that xenix and coherent will be removed at some point in the future — use sysv instead. Since kernel version 2.1.21 the types ext and xiafs do not exist anymore. Earlier, usbfs was known as usbdevfs.

For most types all the mount program has to do is issue a simple mount(2) system call, and no detailed knowledge of the filesystem type is required. For a few types however (like nfs, nfs4, cifs, smbfs, ncpfs) ad hoc code is necessary. The nfs ad hoc code is built in, but cifs, smbfs, and ncpfs have a separate mount program. In order to make it possible to treat all types in a uniform way, mount will execute the program /sbin/mount.TYPE (if that exists) when called with type TYPE. Since various versions of the smbmount program have different calling conventions, /sbin/mount.smbfs may have to be a shell script that sets up the desired call.

If no -t option is given, or if the auto type is specified, mount will try to guess the desired type. If mount was compiled with the blkid library, the guessing is done by this library. Otherwise, mount guesses itself by probing the superblock; if that does not turn up anything that looks familiar, mount will try to read the file /etc/filesystems, or, if that does not exist, /proc/filesystems. All of the filesystem types listed there will be tried, except for those that are labeled "nodev" (e.g., devpts, proc, nfs, and nfs4). If /etc/filesystems ends in a line with a single * only, mount will read /proc/filesystems afterwards.

The auto type may be useful for user-mounted floppies. Creating a file /etc/filesystems can be useful to change the probe order (e.g., to try vfat before msdos or ext3 before ext2) or if you use a kernel module autoloader. Warning: the probing uses a heuristic (the presence of appropriate ‘magic'), and could recognize the wrong filesystem type, possibly with catastrophic consequences. If your data is valuable, don't ask mount to guess.

More than one type may be specified in a comma separated list. The list of file system types can be prefixed with no to specify the file system types on which no action should be taken. (This can be meaningful with the -a option.)

For example, the command:
mount -a -t nomsdos,ext
mounts all file systems except those of type msdos and ext.

-O
Used in conjunction with -a, to limit the set of filesystems to which the -a is applied. Like -t in this regard except that it is useless except in the context of -a. For example, the command:
mount -a -O no_netdev
mounts all file systems except those which have the option _netdev specified in the options field in the /etc/fstab file.

It is different from -t in that each option is matched exactly; a leading no at the beginning of one option does not negate the rest.

The -t and -O options are cumulative in effect; that is, the command
mount -a -t ext2 -O _netdev
mounts all ext2 filesystems with the _netdev option, not all
filesystems that are either ext2 or have the _netdev option specified.

-o
Options are specified with a -o flag followed by a comma separated string of options. Some of these options are only useful when they appear in the /etc/fstab file. The following options apply to any file system that is being mounted (but not every file system actually honors them - e.g., the sync option today has effect only for ext2, ext3, fat, vfat and ufs):

async
All I/O to the file system should be done asynchronously.

atime
Update inode access time for each access. This is the default.

auto
Can be mounted with the -a option.

defaults
Use default options: rw, suid, dev, exec, auto, nouser, and async.

dev
Interpret character or block special devices on the file system.

exec
Permit execution of binaries.

group
Allow an ordinary (i.e., non-root) user to mount the file system if one of his groups matches the group of the device. This option implies the options nosuid and nodev (unless overridden by subsequent options, as in the option line group,dev,suid).

mand
Allow mandatory locks on this filesystem. See fcntl(2).

_netdev
The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system).

noatime
Do not update inode access times on this file system (e.g, for faster access on the news spool to speed up news servers).

nodiratime
Do not update directory inode access times on this filesystem.

noauto
Can only be mounted explicitly (i.e., the -a option will not cause the file system to be mounted).

nodev
Do not interpret character or block special devices on the file system.

noexec
Do not allow direct execution of any binaries on the mounted file system. (Until recently it was possible to run binaries anyway using a command like /lib/ld*.so /mnt/binary. This trick fails since Linux 2.4.25 / 2.6.0.)

nomand
Do not allow mandatory locks on this filesystem.

nosuid
Do not allow set-user-identifier or set-group-identifier bits to take effect. (This seems safe, but is in fact rather unsafe if you have suidperl(1) installed.)

nouser
Forbid an ordinary (i.e., non-root) user to mount the file system. This is the default.

owner
Allow an ordinary (i.e., non-root) user to mount the file system if he is the owner of the device. This option implies the options nosuid and nodev (unless overridden by subsequent options, as in the option line owner,dev,suid).

remount
Attempt to remount an already-mounted file system. This is commonly used to change the mount flags for a file system, especially to make a readonly file system writeable. It does not change device or mount point.

ro
Mount the file system read-only.

_rnetdev
Like _netdev, except "fsck -a" checks this filesystem during rc.sysinit.

rw
Mount the file system read-write.

suid
Allow set-user-identifier or set-group-identifier bits to take effect.

sync
All I/O to the file system should be done synchronously. In case of media with limited number of write cycles (e.g. some flash drives) "sync" may cause life-cycle shortening.

dirsync
All directory updates within the file system should be done synchronously. This affects the following system calls: creat, link, unlink, symlink, mkdir, rmdir, mknod and rename.

user
Allow an ordinary user to mount the file system. The name of the mounting user is written to mtab so that he can unmount the file system again. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line user,exec,dev,suid).

users
Allow every user to mount and unmount the file system. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line users,exec,dev,suid).

context=context, fscontext=context and defcontext=context
The context= option is useful when mounting filesystems that do not support extended attributes, such as a floppy or hard disk formatted with VFAT, or systems that are not normally running under SELinux, such as an ext3 formatted disk from a non-SELinux workstation. You can also use context= on filesystems you do not trust, such as a floppy. It also helps in compatibility with xattr-supporting filesystems on earlier 2.4.<x> kernel versions. Even where xattrs are supported, you can save time not having to label every file by assigning the entire disk one security context.

A commonly used option for removable media is context=system_u:object_r:removable_t.

Two other options are fscontext= and defcontext=, both of which are mutually exclusive of the context option. This means you can use fscontext and defcontext with each other, but neither can be used with context.

The fscontext= option works for all filesystems, regardless of their xattr support. The fscontext option sets the overarching filesystem label to a specific security context. This filesystem label is separate from the individual labels on the files. It represents the entire filesystem for certain kinds of permission checks, such as during mount or file creation. Individual file labels are still obtained from the xattrs on the files themselves. The context option actually sets the aggregate context that fscontext provides, in addition to supplying the same label for individual files.

You can set the default security context for unlabeled files using defcontext= option. This overrides the value set for unlabeled files in the policy and requires a file system that supports xattr labeling.

For more details see selinux(8)

--bind
Remount a subtree somewhere else (so that its contents are available in both places). See above.

--move
Move a subtree to some other place. See above.



EXAMPLES
Line with LABEL in file/etc/fstab:
LABEL=local-data /usr/local/data        ext3    defaults        0 0
mount using LABEL
mount LABEL=local-data
mount -L local-data

Line with UUID in file/etc/fstab:
UUID=79d86fa6-584d-454c-8912-90980f2ea2b2 /usr/local/data        ext3    defaults        0 0
mount using UUID
mount UUID="79d86fa6-584d-454c-8912-90980f2ea2b2"
mount -U "79d86fa6-584d-454c-8912-90980f2ea2b2"

mount share over smb
mount -t smbfs -o username=guest,password=guest,codepage=cp850,iocharset=iso-8859-2 //host/share /mnt/smb/host/share




Zmodyfikowany ostatnio: 2014/05/15 09:59:22 (9 lat temu), textsize: 14,9 kB, htmlsize: 16,5 kB

Zapraszam do komentowania, zgłaszania sugestii, propozycji, własnych przykładów, ...
Dodaj komentarzKomentarze użytkowników