\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Oxville (baa)} \pdfinfo{ /Title (fstab-nfs.pdf) /Creator (Cheatography) /Author (Oxville (baa)) /Subject (fstab-nfs Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{780202} \definecolor{LightBackground}{HTML}{FAF7F7} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{fstab-nfs Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Oxville (baa)} via \textcolor{DarkBackground}{\uline{cheatography.com/57831/cs/15315/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Oxville (baa) \\ \uline{cheatography.com/baa} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 29th March, 2018.\\ Updated 29th March, 2018.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{AUTO MOUNTING NFS SHARES IN /ETC/FSTAB}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{To mount an NFS share using fstab (/etc/fstab) you need to know a few things, the hostname or IP address of the NFS server, the share name and where you intend to mount the share at. Next, add this line to the end of the /etc/fstab file:} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\{\{nl\}\} {\bf{hostname\_or\_ip:/share\_name /yourmount\_location nfs rsize=8192,wsize=8192,timeo=14,intr 0 0 \{\{nl\}\}\{\{nl\}\}}}} \tn % Row Count 8 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{\{nl\}\} {\bf{10.0.0.50:/backup /nfs/backup nfs rsize=8192,wsize=8192,timeo=14,intr 0 0}} \{\{nl\}\}\{\{nl\}\}} \tn % Row Count 11 (+ 3) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{When you are done, you can quickly refresh the fstab using the mount command} \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{fstab Options common to all file-systems}} \tn % Row 0 \SetRowColor{LightBackground} auto / noauto & With the auto option, the device will be mounted automatically at bootup or when the mount -a command is issued. auto is the default option. For the device not to be \tn % Row Count 9 (+ 9) % Row 1 \SetRowColor{white} dev / nodev & Interpret/do not interpret block special devices on the file-system. \tn % Row Count 13 (+ 4) % Row 2 \SetRowColor{LightBackground} exec / noexec & exec lets binaries that are on the partition be executed, whereas noexec is the opposite. \tn % Row Count 18 (+ 5) % Row 3 \SetRowColor{white} rw / ro & Mount the file-system in either read write or read only mode. \tn % Row Count 22 (+ 4) % Row 4 \SetRowColor{LightBackground} sync / async & How the input and output to the filesystem should be done. sync means it is done synchronously. \tn % Row Count 27 (+ 5) % Row 5 \SetRowColor{white} suid / nosuid & Permit/Block the operation of suid, and sgid bits. \tn % Row Count 30 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{fstab Options common to all file-systems (cont)}} \tn % Row 6 \SetRowColor{LightBackground} user / users / nouser & user permits any user to mount the filesystem. This automatically implies noexec, nosuid, nodev unless overridden. If nouser is specified, only root can mount the filesystem. If users is specified, every user in group users will be able to unmount the volume. \tn % Row Count 13 (+ 13) % Row 7 \SetRowColor{white} defaults & Use default settings. Default settings are defined per file system at the file system level. The normal default for Ext3 file systems is (rw,suid,dev,exec,auto,nouser,async) \tn % Row Count 22 (+ 9) % Row 8 \SetRowColor{LightBackground} owner (Linux-specific) & Permit the owner of device to mount. \tn % Row Count 24 (+ 2) % Row 9 \SetRowColor{white} atime / noatime / relatime / strictatime (Linux-specific) & The Unix stat structure records when files are last accessed (atime), modified (mtime), and changed (ctime). One result is that atime is written every time a file is read, which has been heavily criticized for causing performance degradation and increased wear. \tn % Row Count 38 (+ 14) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{0.76 cm} x{3.268 cm} x{3.572 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{File-system-specific options}} \tn % Row 0 \SetRowColor{LightBackground} ext2 & check=\{none, normal, strict\} & Sets the fsck checking level. \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} & debug & Print debugging info on each remount . \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} & sb=n & n is the block which should be used as the superblock for the fs. \tn % Row Count 9 (+ 4) % Row 3 \SetRowColor{white} fat & check=\{r{[}elaxed{]}, n{[}ormal{]}, s{[}trict{]}\} & Not the same as ext2, but rather deals with allowed filenames. See mount. \tn % Row Count 14 (+ 5) % Row 4 \SetRowColor{LightBackground} & conv=\{b{[}inary{]}, t{[}ext{]}, a{[}uto{]}\} & Performs DOS \textless{}-{}-{}-\textgreater{} UNIX text file conversions automatically. See mount. \tn % Row Count 18 (+ 4) % Row 5 \SetRowColor{white} fat, ntfs & windows\_names & Linux filesystems have a larger set of allowed characters in filenames. windows\_names restricts the set of allowed characters for the volume to only those acceptable by Windows. Note: though FAT/NTFS are the most common use case, this feature is not specifically restricted to those filesystem types. \tn % Row Count 35 (+ 17) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{p{0.76 cm} x{3.268 cm} x{3.572 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{File-system-specific options (cont)}} \tn % Row 6 \SetRowColor{LightBackground} & uid=n, gid=n & Sets the user identifier, uid, and group identifier, gid, for all files on the filesystem. \tn % Row Count 5 (+ 5) % Row 7 \SetRowColor{white} & umask=nnn, dmask=nnn, fmask=nnn & \tn % Row Count 7 (+ 2) % Row 8 \SetRowColor{LightBackground} nfs & addr=ip & where 'ip' means IP address \tn % Row Count 9 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2 cm} x{6 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{nfs - fstab format and options for nfs}} \tn % Row 0 \SetRowColor{LightBackground} nfsvers=n & The NFS protocol version number used to contact the server's NFS service. \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} soft / hard & Determines the recovery behavior of the NFS client after an NFS request times out. \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} intr / nointr & This option is provided for backward compatibility. It is ignored after kernel 2.6.25. \tn % Row Count 9 (+ 3) % Row 3 \SetRowColor{white} timeo=n & The time in deciseconds (tenths of a second) the NFS client waits for a response before it retries an NFS request. For NFS over TCP the default timeo value is 600 (60 seconds). \tn % Row Count 15 (+ 6) % Row 4 \SetRowColor{LightBackground} retrans=n & The number of times the NFS client retries a request before it attempts further recovery action. If the retrans option is not specified, the NFS client tries each request three times. \tn % Row Count 22 (+ 7) % Row 5 \SetRowColor{white} rsize=n & The maximum number of bytes in each network READ request that the NFS client can receive when reading data from a file on an NFS server. \tn % Row Count 27 (+ 5) % Row 6 \SetRowColor{LightBackground} wsize=n & The maximum number of bytes per network WRITE request that the NFS client can send when writing data to a file on an NFS server. \tn % Row Count 32 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2 cm} x{6 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{nfs - fstab format and options for nfs (cont)}} \tn % Row 7 \SetRowColor{LightBackground} actimeo=n & Using actimeo sets all of acregmin, acregmax, acdirmin, and acdirmax to the same value. \tn % Row Count 3 (+ 3) % Row 8 \SetRowColor{white} bg / fg & Determines how the mount command behaves if an attempt to mount an export fails. \tn % Row Count 6 (+ 3) % Row 9 \SetRowColor{LightBackground} retry=n & The number of minutes that the mount command retries an NFS mount operation in the foreground or background before giving up. \tn % Row Count 11 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\# Examples \newline \newline server:path /mountpoint fstype option,option,... 0 0 \newline \newline The following example from an /etc/fstab file causes the mount command to negotiate reasonable defaults for NFS behavior. \newline server:/export /mnt nfs defaults 0 0 \newline \newline This example can be used to mount /usr over NFS. \newline server:/export /usr nfs ro,nolock,nocto,actimeo=3600 0 0 \newline \newline additional info: \newline https://www.systutorials.com/docs/linux/man/5-nfs/} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.32 cm} x{5.68 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Configuration Options NFS side}} \tn % Row 0 \SetRowColor{LightBackground} rw & This option gives the client computer both read and write access to the volume. \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} sync & This option forces NFS to write changes to disk before replying. This results in a more stable and consistent environment since the reply reflects the actual state of the remote volume. However, it also reduces the speed of file operations. \tn % Row Count 12 (+ 9) % Row 2 \SetRowColor{LightBackground} \seqsplit{no\_subtree\_check} & This option prevents subtree checking, which is a process where the host must check whether the file is actually still available in the exported tree for every request. This can cause many problems when a file is renamed while the client has it opened. In almost all cases, it is better to disable subtree checking. \tn % Row Count 24 (+ 12) % Row 3 \SetRowColor{white} \seqsplit{no\_root\_squash} & By default, NFS translates requests from a root user remotely into a non-privileged user on the server. This was intended as security feature to prevent a root account on the client from using the file system of the host as root. no\_root\_squash disables this behavior for certain shares. \tn % Row Count 35 (+ 11) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{example: \newline in the file /etc/export \newline \newline \# the location | the network | the options | \newline /mount/folder 192.168.1.0/24(rw,sync,no\_root\_squash)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Sample NFS fstab entry}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{To mount an export using NFS version 2, use the nfs file system type and specify the nfsvers=2 mount option. To mount using NFS version 3, use the nfs file system type and specify the nfsvers=3 mount option. To mount using NFS version 4, use either the nfs file system type, with the nfsvers=4 mount option, or the nfs4 file system type. The following example from an /etc/fstab file causes the mount command to negotiate reasonable defaults for NFS behavior.} \tn % Row Count 10 (+ 10) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{A sample fstab entry for NFS share is as follows \{\{nl\}\}{\bf{ server:/export /mnt nfs defaults 0 0}}} \tn % Row Count 12 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{host.myserver.com:/home /mnt/home nfs rw,hard,intr,rsize=8192,wsize=8192,timeo=14 0 0}}} \tn % Row Count 14 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}