# Mounting

Notes on mounting stuff


# Regular disk

mount /dev/sda1 /path/to/mount/target

# Find UUID

blkid

# Add disk to fstab by UUID

UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /mount/location ext4 defaults 0 0

# CIFS

# Install library

apt-get install -y cifs-utils

# Mount command

mount -t cifs //cifs.server/path /path/to/mount/target

# fstab entry

//cifs.server/path /path/to/mount/target cifs credentials=/etc/.smbcredentials,iocharset=utf8,sec=ntlmssp,vers=3.0 0 0

# .smbcredentials file

username=user
password=plaintextpassword

# Permissions for other users

//cifs.server/path /path/to/mount/target cifs credentials=/etc/.smbcredentials,iocharset=utf8,sec=ntlmssp,vers=3.0,file_mode=0777,dir_mode=0777 0 0

# CIFS Auto-mount Using Kerberos

This will automatically mount CIFS shares on a domain-joined linux machine

# Install packages

Install the packages cifs-utils keyutils autofs

# Edit config

Add the following line to /etc/auto.master

/- /etc/auto.cifs

# Add mounts

Create a file at /etc/auto.cifs

/mnt/path   -fstype=cifs,multiuser,cruid=${UID},sec=krb5,vers=3    ://storage-server.domain.tld/share-path

# Start the service

systemctl enable autofs
systemctl start autofs

# NFS

# Install library

Ubuntu/Debian

apt-get install -y nfs-common

Centos

yum install -y nfs-utils

# Mount command

mount -t nfs 10.0.0.1:/nfspool/share /path/to/mount/target

# fstab entry

10.0.0.1:/nfspool/share /path/to/mount/target nfs rw,relatime,rsize=16384,wsize=16384,hard 0 0

# Show nfs exports on a server

showmount -e 10.0.0.1

# Updated Exported Mounts

use this after editing the /etc/exports file

exportfs -ra
Last Updated: 2021/03/31 12:28+00:00