Mount Linux Command

What is Linux mount Command?

Explanation

mount COMMAND:

Mount command is used to attach an external storage device (like disc or drives) to the USB port of the computer system.

SYNTAX :


mount [options] directories

OPTIONS:


mount lists all currently mounted devices
mount -t type device dir This tells the kernel to attach the file system found on device (which is of type type) at the directory dir.
mount [-l] [-t type] lists all mounted file systems (of type type). The option -l adds the (ext2, ext3 and XFS) labels in this listing.
-h prints a help message, and exits;
-V Cprints mount's version information, and exits;
-v Verbose mode.
-a Mount all filesystems (of the given types) mentioned in fstab.
-F Fork off a new incarnation of mount for each device. This will do the mounts on different devices or different NFS servers in parallel.
-f Causes everything to be done except for the actual system call; if it's not obvious, this ``fakes'' mounting the file system.
-l Add the ext2, ext3 and XFS labels in the mount output.
-n Mount without writing in /etc/fstab. This is necessary for example when /etc is on a read-only file system.
-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 are: adfs, affs, autofs, coda, coherent, cramfs, devpts, efs, ext, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, ntfs, proc, qnx4, ramfs, reiserfs, romfs, smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xenix, xfs, xiafs.
-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.
-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.
--bind Remount a subtree somewhere else (so that its contents are available in both places).
--move Move a subtree to some other place

EXAMPLE:


  1. To list the files that are attached to the system (e.g) USB / Hard disk
    df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/sda6 436G 221G 194G 54% /
    none 4.0K 0 4.0K 0% /sys/fs/cgroup
    udev 942M 4.0K 942M 1% /dev
    tmpfs 191M 1.1M 190M 1% /run
    none 5.0M 0 5.0M 0% /run/lock
    none 952M 872K 951M 1% /run/shm
    none 100M 48K 100M 1% /run/user
    /dev/sda1 19G 45M 18G 1% /tmp
    /dev/sdb 3910656 2807160 1103496 72% /media/myusb

    Here /dev/sdb is the mounted folder.
  2. To mount the device to system
    mount dev/sdb
Note: To unmount/detach the file mounted on the system, use umount command.Click here.

Ask Questions

Ask Question