Mounting drives


Using mount command


mount /dev/sdb1 /media/usbdrive

In /etc/fstab


Drive


# mount a drive
UUID=<uuid>	/backup	 ext4    defaults 0 0

Samba share


# mount a smb share
//xxx.xxx.x.x/ShareName			/backup		cifs	x-systemd.automount,rw,iocharset=utf8,uid=1000,gid=1000,credentials=/etc/smbclient.conf		0	0

And put your credentials in `/etc/smbclient.conf`


username=user
password=pass

/etc/fstab


Structure of the file:


<File system>   <mnt>   <type fs>   <options>   <dump>  <pass>

File system


It could be the path to the device like `/dev/sda1` or the UUID of the drive (more reliable), you can get it with `lsblk`


Mounting point


It's the path where you want to mount your device. It could be anything like /mnt/backup or /home for example.


File system type


It's the partition of your drive like (ext4, fat32, ...)


Options


- auto: The fs will be mount during startup or when you use `mount -a`

- noauto: The fs must be manually mounted

- exec: Allow file execution

- noexec: Disallow file execution

- ro: Allow read only

- rw: Allow read and write

- sync: Synchronous interaction with the fs

- async: Asynchronous interaction with the fs

- user: Any user can mount it

- nouser: Only root can mount it

- suid: Allow suid & sgid bit operations

- nosuid: Disallow suid & sgid bit operations

- defaults: equivalent to rw,suid,dev,exec,auto,nouser,async

- noatime: Don't update file access time

- nodiratime: Don't update directory access time

- relatime: Only update file access time if this one is before the new file access time


Dump


Use by dump. It can be 0 or 1. If 0, dump will ignore it.


Pass


Use by fschk. Can be 2 enable fschk to check it or 0 to ignore it. 1 is reserved for root partition


Last-Updated: 2022-08-15
Content from gemini://kelgors.me/wiki/mount.gmi

More info about Gemini protocol