Difference between revisions of "Mount"

From ArchWiki
Jump to: navigation, search
(Command line alternatives to mount)
m (Grammar cleanup)
Line 2: Line 2:
 
== Introduction ==
 
== Introduction ==
  
The ''mount''.'''X''' scripts, where '''''X''''' is the name of a '''partition type''', can be used to '''alter''' ''default'' [http://linux.die.net/man/8/mount mount] '''options''' for almost any '''supported''' partition types by [http://linux.die.net/man/8/mount mount]. Here are a few examples about how to extend mount functionality and modify default options. To change default settings in [https://wiki.archlinux.org/index.php/Kernels/Compilation/Traditional kernel] you need to compile own. If the script doesn't exist then default options will be used.
+
The ''mount''.'''X''' scripts, where '''''X''''' is the name of a '''partition type''', can be used to '''alter''' ''default'' [http://linux.die.net/man/8/mount mount] '''options''' for almost any '''supported''' partition types by [http://linux.die.net/man/8/mount mount]. Here are a few examples about how to extend mount functionality and modify default options. To change the default settings in the [https://wiki.archlinux.org/index.php/Kernels/Compilation/Traditional kernel] you will need to compile the kernel yourself. If the script doesn't exist then the default options will be used.
  
=== Methods that can be used to change default mount options ===
+
=== Methods that can be used to change the default mount options ===
* [https://wiki.archlinux.org/index.php/Kernels/Compilation/Traditional By compiling own kernel]
+
* [https://wiki.archlinux.org/index.php/Kernels/Compilation/Traditional By compiling the kernel yourself]
 
* By using scripts
 
* By using scripts
 
* [https://wiki.archlinux.org/index.php/Fstab By editing fstab]
 
* [https://wiki.archlinux.org/index.php/Fstab By editing fstab]
  
 
=== About mount ===
 
=== About mount ===
The '''mount''' is the default application for connection of ''file systems'', ''partition tables'', ''shared folders'' to the Linux operation system. It can mount file systems supported by the linux ''kernel'' but can be extended even with other ''drivers'' or ''applications'' as for example [https://www.archlinux.org/packages/?sort=&q=ntfs-3g&maintainer=&flagged= NTFS-3G] for mounting [https://wiki.archlinux.org/index.php/NTFS-3G NTFS] in rw (read write) mode.
+
'''mount''' is an application used to access ''file systems'', ''partition tables'', and ''shared folders''. It can mount file systems supported by the Linux ''kernel'', but can be extended with other ''drivers'' or ''applications'', such as [https://www.archlinux.org/packages/?sort=&q=ntfs-3g&maintainer=&flagged= NTFS-3G] for mounting [https://wiki.archlinux.org/index.php/NTFS-3G NTFS] with read / write functionality.
  
 
=== Command line alternatives to ''mount'' ===
 
=== Command line alternatives to ''mount'' ===
* [https://www.archlinux.org/packages/?q=fuseiso fuseiso], mounting ISO without administative rights. Repo: Community
+
* [https://www.archlinux.org/packages/?q=fuseiso fuseiso], mount an ISO as a regular user. Repo: Community
* [https://aur.archlinux.org/packages/pmount/ pmount], mounting without administrative rights to /media/sdXY. Repo: [https://aur.archlinux.org/packages/ AUR]
+
* [https://aur.archlinux.org/packages/pmount/ pmount], mount as a regular user to /media/sdXY. Repo: [https://aur.archlinux.org/packages/ AUR]
 
* acdfuse-git
 
* acdfuse-git
 
* 9mount
 
* 9mount
Line 28: Line 28:
 
== Supported file systems ==
 
== Supported file systems ==
 
=== By kernel ===
 
=== By kernel ===
This should show supported file systems by your kernel:
+
View the supported file systems by your kernel:
 
  zcat /proc/config.gz | grep  "_FS="  
 
  zcat /proc/config.gz | grep  "_FS="  
Shows total number of supported file system types:
+
View the total number of supported file system types:
 
  zcat /proc/config.gz | grep  "_FS=" | wc -l
 
  zcat /proc/config.gz | grep  "_FS=" | wc -l
  
Line 36: Line 36:
 
  zcat /proc/config.gz | grep  "_FS=" | sed "s/^CONFIG_//m" | sed "s/.$//m" | sed "s/_FS=//m" | sort
 
  zcat /proc/config.gz | grep  "_FS=" | sed "s/^CONFIG_//m" | sed "s/.$//m" | sed "s/_FS=//m" | sort
  
Output:
+
Example output:
 
  9P
 
  9P
 
  AFFS
 
  AFFS
Line 80: Line 80:
 
  VFAT
 
  VFAT
 
  XFS
 
  XFS
=== According to manual ===  
+
=== According to the manual ===  
 
  affs
 
  affs
 
  autofs
 
  autofs
Line 126: Line 126:
 
== '''VFAT / FAT''' ==
 
== '''VFAT / FAT''' ==
  
Here is an example of the default [http://linux.die.net/man/8/mount mount] configuration in kernel:
+
Here is an example of the default [http://linux.die.net/man/8/mount mount] configuration:
  
 
Example:
 
Example:
Line 138: Line 138:
 
  CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
 
  CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
  
If partition type detects by mount as VFAT it will run the '''/sbin/mount.vfat''' script.
+
If the partition type detected by mount is VFAT then it will run the '''/sbin/mount.vfat''' script.
  
 
Example:
 
Example:
Line 150: Line 150:
 
== '''ISO''' ==
 
== '''ISO''' ==
  
When ''iso9660'' image type is detected by '''mount''' it will run the '''/sbin/mount.iso9660''' script.
+
When the ''iso9660'' image type is detected by '''mount''' it will run the '''/sbin/mount.iso9660''' script.
  
 
Example:
 
Example:
Line 160: Line 160:
 
  #mount -oloop,ro,relatime,utf8 -i -t iso9660 "$@"
 
  #mount -oloop,ro,relatime,utf8 -i -t iso9660 "$@"
 
  # fuseiso "$@"
 
  # fuseiso "$@"
*It works by adding '''utf8''' but getting errors when using '''iso8859''' for iocharset.
+
*It works by adding '''utf8''' but will get errors when using '''iso8859''' for iocharset.
*'''utf8''' option is the same as '''iocharset=utf8''', you can use any of them.
+
*The '''utf8''' option is the same as '''iocharset=utf8''', you can use either of them.
*You can even use '''fuseiso''' then just comment '''mount''' and uncomment '''fuseiso "$@"'''. Or use any other mount application in the script.
+
*You can even use '''fuseiso''' and then just comment out '''mount''' and uncomment '''fuseiso "$@"'''. Or use any other mount application in the script.
 
{{Note|You still need root rights (su/sudo) to use mount even if fuseiso is used in the script.}}
 
{{Note|You still need root rights (su/sudo) to use mount even if fuseiso is used in the script.}}
  
Line 186: Line 186:
 
  CONFIG_NLS_ISO8859_15=m
 
  CONFIG_NLS_ISO8859_15=m
  
Scripts are useful if you want to add more actions when a storage device, USB or an image file (ISO, img, dd) become mounted.
+
You can add more actions for when a storage device, such as a USB drive or image file (ISO, img, dd), is mounted by using scripts.
  
 
== '''References''' ==
 
== '''References''' ==
Line 192: Line 192:
 
*Comparison of file systems: [http://en.wikipedia.org/wiki/Comparison_of_file_systems wikipedia].  
 
*Comparison of file systems: [http://en.wikipedia.org/wiki/Comparison_of_file_systems wikipedia].  
 
*Documentation of file systems supported by kernel: [https://www.kernel.org/doc/Documentation/filesystems/ kernel.org].
 
*Documentation of file systems supported by kernel: [https://www.kernel.org/doc/Documentation/filesystems/ kernel.org].
*Manual for the ''mount'': [http://linux.die.net/man/8/mount linux.die.net].
+
*Manual for the ''mount'' command: [http://linux.die.net/man/8/mount linux.die.net].
 
[[Category:File systems]]
 
[[Category:File systems]]

Revision as of 12:14, 13 June 2014

Introduction

The mount.X scripts, where X is the name of a partition type, can be used to alter default mount options for almost any supported partition types by mount. Here are a few examples about how to extend mount functionality and modify default options. To change the default settings in the kernel you will need to compile the kernel yourself. If the script doesn't exist then the default options will be used.

Methods that can be used to change the default mount options

About mount

mount is an application used to access file systems, partition tables, and shared folders. It can mount file systems supported by the Linux kernel, but can be extended with other drivers or applications, such as NTFS-3G for mounting NTFS with read / write functionality.

Command line alternatives to mount

  • fuseiso, mount an ISO as a regular user. Repo: Community
  • pmount, mount as a regular user to /media/sdXY. Repo: AUR
  • acdfuse-git
  • 9mount
  • adbfs-git
  • cryptmount
  • cddfs
  • vdimount
  • wiifuse
  • ws
  • xbfuse-git
  • xmlfs

Supported file systems

By kernel

View the supported file systems by your kernel:

zcat /proc/config.gz | grep  "_FS=" 

View the total number of supported file system types:

zcat /proc/config.gz | grep  "_FS=" | wc -l

Here is for a more clean output:

zcat /proc/config.gz | grep  "_FS=" | sed "s/^CONFIG_//m" | sed "s/.$//m" | sed "s/_FS=//m" | sort

Example output:

9P
AFFS
AFS
AUTOFS4
BEFS
BTRFS
CEPH
CODA
CONFIGFS
DEBUG
ECRYPT
EFIVAR
EXOFS
EXT4
F2FS
F2FS_CHECK
F2FS_STAT
FAT
FUSE
GFS2
HFS
HFSPLUS
ISO9660
JFFS2
JFS
LUSTRE
MINIX
MSDOS
NCP
NFS
NILFS2
NTFS
OCFS2
OMFS
PROC
REISERFS
SCSI_PROC
UBIFS
UDF
UFS
USB_F
VFAT
XFS

According to the manual

affs
autofs
cifs
coda
coherent
cramfs
debugfs
devpts
efs
ext
ext2
ext3
ext4
hfs
hfsplus
hpfs
iso9660
jfs
minix
msdos
ncpfs
nfs
nfs4
ntfs
proc
qnx4
ramfs
reiserfs
romfs
smbfs
squashfs
sysv
tmpfs
ubifs
udf
ufs
umsdos
usbfs
vfat
xenix
xfs
xiafs

VFAT / FAT

Here is an example of the default mount configuration:

Example:

zcat /proc/config.gz | grep -i fat

Output:

# DOS/FAT/NT Filesystems
CONFIG_FAT_FS=m
CONFIG_VFAT_FS=m
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"

If the partition type detected by mount is VFAT then it will run the /sbin/mount.vfat script.

Example:

cat /sbin/mount.vfat

Output:

#!/bin/bash
#mount VFAT as rw for all users
/sbin/mount -i -t vfat -oumask=0000,iocharset=utf8 "$@"

ISO

When the iso9660 image type is detected by mount it will run the /sbin/mount.iso9660 script.

Example:

$cat /sbin/mount.iso9660

Output:

#!/bin/bash
mount -i -t iso9660 "$@"
#mount -oloop,ro,relatime,utf8 -i -t iso9660 "$@"
# fuseiso "$@"
  • It works by adding utf8 but will get errors when using iso8859 for iocharset.
  • The utf8 option is the same as iocharset=utf8, you can use either of them.
  • You can even use fuseiso and then just comment out mount and uncomment fuseiso "$@". Or use any other mount application in the script.
Note: You still need root rights (su/sudo) to use mount even if fuseiso is used in the script.


Defaults of ISO mount configuration in the kernel.

Example:

zcat /proc/config.gz | grep -i "_iso" | grep -vi "CONFIG_MEMORY_ISOLATION" | grep -iv "CONFIG_USB_SL811_HCD_ISO"

Output:

CONFIG_ISO9660_FS=m
CONFIG_NLS_ISO8859_8=m
CONFIG_NLS_ISO8859_1=m
CONFIG_NLS_ISO8859_2=m
CONFIG_NLS_ISO8859_3=m
CONFIG_NLS_ISO8859_4=m
CONFIG_NLS_ISO8859_5=m
CONFIG_NLS_ISO8859_6=m
CONFIG_NLS_ISO8859_7=m
CONFIG_NLS_ISO8859_9=m
CONFIG_NLS_ISO8859_13=m
CONFIG_NLS_ISO8859_14=m
CONFIG_NLS_ISO8859_15=m

You can add more actions for when a storage device, such as a USB drive or image file (ISO, img, dd), is mounted by using scripts.

References