pavement

Mount

From FreeBSDwiki
Jump to: navigation, search
The Mediawiki system (the 'software' that runs this site) capitalises all articles. Please note that commands on most UNIX and Unix-like systems are entered in lower case. As an example the article documenting the Ln command would be issued from the command line as 'ln'.

The mount command is used to link a file system to the local host allowing access to files stored upon them. These file systems could be on physical media, such as a hard drive, CD-ROM or USB memory key, or virtual media, such as file server shares. FreeBSD has support for reading from a large number of file systems and can write back to a majority of them.

Contents

Operation

The mounting of a file system to the local host works by creating a mount-point at which the file system can be accessed. This fits in with the Unix concept of 'everything is a file' and as such a CD-ROM drive, for example, is typically mounted as '/cdrom'. Other file systems are typically mounted under the '/mnt' directory. The technical term is called 'grafting' a device to the local file system tree.

An typical installation of FreeBSD might have the following mount-points:

/       - file system root;
/var    - log files;
/usr    - user specific directories, ports, etc.;
/tmp    - temporary workspace;
/cdrom  - physical CD-ROM drive.

These mount-points are automatically mounted when the system is started because they are stored in a file called '/etc/fstab' (derived from File System TABle). The fstab file used to mount the above listed mount-points contains the following entires:

# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ad0s1b             none            swap    sw              0       0
/dev/ad0s1a             /               ufs     rw              1       1
/dev/ad0s1e             /tmp            ufs     rw              2       2
/dev/ad0s1f             /usr            ufs     rw              2       2
/dev/ad0s1d             /var            ufs     rw              2       2
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0

The mounted file systems in this example are physical devices attached to the local system and located under the /dev directory with the hard drive being 'ad0s1x' and CD-ROM being 'acd0'. The 'none' mount-point simply exists to inform the system of where the swap-file (often called 'virtual memory') is located. Further details of the fstab file can be found in the fstab article.

Mount Commands

The mount command on its own mounts FreeBSD formatted (or UFS or UFS2) file systems. In order to mount foreign (or non-native FreeBSD formatted) file systems each supported file system has its own mount command in the format of 'mount_filesystem'; as an example the supported 'MS-DOS' (or DR-DOS, FAT16 or FAT32) formatted file system has the command 'mount_msdosfs'.

The following file systems are supported by FreeBSD:

CD-ROM

The mount_cd9660 command mounts file systems formatted using ISO 9660. This is limited to optical media conforming to CD-ROM standards and can include writable CD-R and re-writable CD-RW medium - though this is limited to read-only. Applications within the ports system are available to create (or write) to CD-R and CD-RW media.

Example:

# mount_cd9660 /dev/acd0 /cdrom
# ls /cdrom/
.cshrc          INSTALL.HTM     boot.catalog    media           sys
.profile        INSTALL.TXT     cdrom.inf       mnt             tmp
6.3-RELEASE     README.HTM      dev             packages        tools
COPYRIGHT       README.TXT      docbook.css     proc            usr
ERRATA.HTM      RELNOTES.HTM    etc             rescue          var
ERRATA.TXT      RELNOTES.TXT    floppies        root
HARDWARE.HTM    bin             lib             sbin
HARDWARE.TXT    boot            libexec         stand

devfs

mount_devfs

DVD

The mount_udf command mounts file systems formatted using Universal Disk Format. This is limited to optical media conforming to DVD-ROM standards and can include writable DVD-R, DVD+R and re-writable DVD-RW, DVD+RW and DVD-RAM medium - though this is limited to read-only and to data DVDs. Applications within the ports system are available to create (or write) to the various DVD media. Video DVDs are typically encrypted to stop piracy and as such may not mount successfully.

File Descriptor

mount_fdescfs

Linux ext2

The mount_ext2fs command mounts file systems formatted using Second Extended ext2 (but not the newer ext3 or ext4). This is typically the format used in the GNU/Linux kernel (sometimes referred to as an operating system). FreeBSD supports reading from this file system.

Linux Process

The mount_linprocfs command forms part of the Linux binary emulation layer available in FreeBSD.

Linux System

The mount_linsysfs command forms part of the Linux binary emulation layer available in FreeBSD.

MFS

mount_mfs

Microsoft DOS (FAT16 or FAT32)

The mount_msdosfs command mounts file systems formatted using File Allocation Table. This is typically the format used in older versions of Microsoft Windows as well as common memory cards and USB memory keys. FreeBSD supports reading and writing to this file system.

Example (using a USB memory key):

# mkdir /mnt/usb
# mount_msdosfs /dev/da0s1 /mnt/usb
# ls /mnt/usb/
BackupA1                        Drivers
BackupA2                        Listing
BackupA3                        Support
#

The above example creates the initial mount-point for the USB memory key using the mkdir command. This needs to be done only once.

Microsoft Network Shares (CIFS, SMB or Samba)

The mount_smbfs command mounts file file systems located on network shares using the Samba protocol. This protocol is available with Microsoft Windows Server operating systems (where it is referred to by CIFS, the Common Internet File System) as well as other servers capable of hosting the CIFS protocol. The mount_samba command is used on one system to access the file system of another hosting the CIFS share.

Note: The mount_smbfs command is not available as part of the default FreeBSD installation. It is available from the ports system.

Microsoft NT (NTFS)

The mount_ntfs command mounts file systems formatted using Microsoft's proprietary New Technology File System. This is typically the format used in newer versions of Microsoft Windows. FreeBSD supports reading from this file system. There are projects actively working towards supporting the writing to this file system in various stages of progress however it is strongly recommended that read-only access to NTFS file systems is used on essential data drives.

Null

mount_nullfs

Process

mount_procfs

Reiser

The mount_reiserfs command mounts file systems formatted using Reiser (but not the newer Resier version 4). This is privately developed file system created by Hans Reiser through his Namesys company though the file system is available for free on open source operating systems. FreeBSD supports reading from this file system.

Standard

mount_std

UMAP

mount_umapfs

Union

mount_unionfs

Unix Network Share

The mount_nfs command mounts file systems located on network shares using the NFS protocol. This protocol is available with the default FreeBSD installation as well as almost all known UNIX and Unix-line operating systems. The mount_nfs command is used on one system to access the file system of another hosting the NFS share.

Unix Network Share (version 4)

The mount_nfs4 command mounts file systems located on network shares using the NFS protocol, specifically version 4. This command is used to connect to newer versions NFS shares, which offer improved functionality, but otherwise maintains similarly to the previous NFS versions.

Notes

Unless otherwise stated above (such as the read-only aspect of certain listed file systems) the limitations of the file system implementation on FreeBSD is typically based on the design of a given file system. For example the MS-DOS file system variation called FAT16 has a physical partition (or slice in FreeBSD terminology) size limitation of 2GB. Another example could be network based shares using NFS or CIFS where the server hosting the share could place specific read/write attributes and thereby control the access available to the client system mounting that share.

See Also

See also related articles: umount and etc/fstab

Personal tools