This topic was published by DevynCJohnson and viewed 877 times since "". The last page revision was "".
- Topics - 444
Sometimes, partitions and filesystems must be manually mounted. Without an understanding of the mount command, this can be a problem. Thankfully, "mount" is a command that is easy to learn.
The "mount" command is used to mount a filesystem or storage device while "unmount" is the opposite. Use of these commands requires Root privileges. Typing the "mount" command without parameters will list the mounted filesystems. The easiest way to mount a storage device (like a hard-drive) is to type
mount /dev/sda2 /media/2nd. That command will mount the second filesystem/partition of the first SATA hard-drive to a directory called "2nd" under /media/. To unmount that same partition, type
umount /dev/sda2, or whatever the device may be. Alternately, users can reference the mount-point instead of the device file (umount /media/2nd).
NOTE: The "df" command is an alternative to the "mount" command when listing mounted filesystems.
If a partition is already mounted, but the user wishes to remount it using different options, use the "-o" parameter followed by the "remount" argument. The below command will remount /dev/sda3 with r+w (read and write allowed).
mount -o remount,rw /dev/sda3
"mount" supports many filesystems as listed below. However, for some filesystems, extra utilities are needed. To support CIF and Samba shares, users may need to install "smbfs" or "cifs-utils". Also, to mount filesystems like xfs, jfs, hpsplus, etc., the Linux kernel must have that feature built in or added as a module/driver.
Numerous parameters and options exist for mount, but it may be more beneficial to newbies to understand the general commands used to mount various filesystem types. The device paths and the mount-points are just examples. For instance, a user may have two floppy-disk drives (/dev/fd0 and /dev/fd1) and may prefer to mount ADFS partitions under /media/floppies/disk1 instead of "/mnt/floppy". So, some of the example paths may be tweaked to the user's needs. Also, the numbers used as the "offset" will be different in many scenarios.
The basic template used with the "mount" command is
mount -t FStype device mountpoint. The "-t" parameter stands for filesystem-type.
NOTE: A large list of mounting commands can be found at http://dcjtech.info/topic/unixoid-mounting-commands/
- adfs -
mount -t adfs /dev/fd0 /mnt/floppy
- affs -
mount -t affs -o offset=2099544064 /dev/sdf /media/Amiga
- affs (if mounted to a loopback device first) -
mount -t affs /dev/loop1 /media/Amiga
- cifs -
mount -t cifs //SERVER/SHARE /mnt/cifs -o username=USER,password=PSWD,domain=DOMAIN-NAME
- cramfs -
mount -t cramfs -o loop /path/cramfs-img /media/cramfs/
- debugfs -
mount -t debugfs none /sys/kernel/debug
- devpts -
mount -t devpts devpts /dev/pts
- efs -
mount -r -t efs /dev/cdrom /mnt/irix
- ext2 -
mount -t ext2 /dev/sda1 /media/hdd
- ext3 -
mount -t ext3 /dev/sda1 /media/hdd
- ext4 -
mount -t ext4 /dev/sda1 /media/hdd
- hfs -
mount -t hfs /dev/sdc2 /media/hfs # Journalling may need to be disabled
- hfsplus -
mount -t hfsplus /dev/sdc2 /media/hfs # Journalling may need to be disabled
- hpfs -
mount -t hpfs /dev/hda2 /mnt
- iso9660 -
mount -t iso9660 -o ro /dev/cdrom /mnt
- jfs -
mount -o noatime -t jfs /dev/jfs_dev /mnt/jfs
- minix -
losetup /dev/loop0 minix.img -o 512 && mount -t minix /dev/loop0 /mnt
- msdos -
mount -t msdos /dev/sda1 /mnt
- nfs -
mount -t nfs SERVER:/SHARE /mnt/nfs/shares
- nfs4 -
mount -t nfs4 -o proto=tcp,port=2049 SERVER:/SHARE /mnt/nfs/shares
- ntfs -
mount -t ntfs /dev/sda1 /mnt
- proc -
mount -t proc none /proc
- qnx4 -
mount -t qnx4 /dev/sda1 /mnt
- qnx4 -
mount -t qnx4fs /dev/sda1 /mnt
- ramfs -
mount -t ramfs -o size=512m ramfs /mnt/ramdisk
- reiserfs -
mount -t reiserfs -o nolog /dev/sdb1 /mnt/reiser
- romfs -
mount -o loop file.img /mnt/img/
- squashfs -
mount -t squashfs -o loop file.squashfs /mnt/
- smbfs -
mount -t smbfs //SERVER/SHARE /mnt/smb/share –o username=USER,workgroup=WORKGROUP,password=PSWD
- sysfs -
mount -t sysfs sys /sys
- tmpfs -
mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk
- ubifs -
mount -t ubifs ubiX:NAME /mnt/ubifs
- udf -
mount -t udf /dev/sr0 /cdrom/
- ufs -
mount -r -t ufs -o ufstype=old,ro /dev/sda1 /media/ufs
- umsdos -
mount -t umsdos /dev/sdb2 /media/umsdos
- usbfs -
mount -t usbfs none /proc/bus/usb -o devmode=0666
- vfat -
mount -t vfat /dev/sda1 /mnt
- xfs -
mount -t xfs /dev/sda1 /mnt
- xiafs -
mount -t xiafs /dev/sdc1 /mnt
- Most floppies -
mount /dev/fd0 /mnt
- *.img files -
mount -o loop file.img /mnt/img/
Mount has some return codes. If multiple errors occur, then the codes (in binary form) are "ORed" together. This means if errors 16 and 32 occur together, then the new code would be 48. To better explain, add the decimal error codes together (16 + 32).
- 0 - success
- 1 - incorrect invocation or permissions
- 2 - system error (out of memory, cannot fork, no more loop devices)
- 4 - internal mount bug
- 8 - user interrupt
- 16 - problems writing or locking /etc/mtab
- 32 - mount failure
- 64 - some mount succeeded
An "automounter" is any type of program that automatically mounts a filesystem when a user tries to access it. For instance, in many file-managers (such as Nautilus), all of the available partitions and drives are listed, but they are not mounted. After clicking a partition, the user can then access the storage unit.
"pmount" (portable mount) is a wrapper for mount that allows users to mount removable storage. This command does not require Root privileges. Thus, flash-drives, SD cards, CDs, and other commonly used removable storage do not require Root privilege when mounting. pmount commonly mounts partitions using the flags async, atime, nodev, noexec, noauto, nosuid, user, and rw. Such partitions are typically mounted under /media/. This utility supports the below listed filesystems. pmount tests the partition for each of these filesystems in the same order as listed below.
gnome-volume-manager and GNOME-VFS use "gnome-mount" which is similar to "pmount". "gnome-mount" can also manager iPod mounts and eject the devices.
Some systems and mount-utilities mount NFS shares under /net/. Under /net/, there is a folder for each hostname, and inside each of those directories are the folders for each share. In summary, this mounting format/template may be seen when mounting NFS shares - /net/HOSTNAME/SHARE/.
- GNOME-Mount - http://linux.die.net/man/1/gnome-mount
- Mount - http://linux.die.net/man/8/mount
- Pmount - http://linux.die.net/man/1/pmount
- The /etc/fstab File - http://dcjtech.info/topic/the-etcfstab-file/
- /etc/fstab Options - http://dcjtech.info/topic/etcfstab-options/
- Unixoid Mounting Commands - http://dcjtech.info/topic/unixoid-mounting-commands/
Attachments:You must be logged in to view attached files.