Skip to content

fstab

Mount a partition

bash
sudo mount /dev/sda1 /mnt

Mount a partition at boot

bash
sudo vim /etc/fstab

Add this line:

bash
/dev/sda1 /mnt ext4 defaults 0 0

Mount a network share

Login

If you have a login and password:

create a file named .smb.cred in ~/.smb.cred

bash
username=yourusername
password=yourpassword
domain=yourdomainifyouhaveone

Unfortunately, fstab is unabel to read this file with ~/ or $HOME so you need to put the full path to the file...

Mount

bash
sudo mount -v -t cifs -o file_mode=0777,dir_mode=0777,credentials=/home/<YOUR_USERNAME>/.smb.cred

Mount at boot

bash
sudo vim /etc/fstab

Add this line:

bash
//<YOUR_SERVER>/<YOUR_SHARE> /mnt cifs file_mode=0777,dir_mode=0777credentials=/home/<YOUR_USERNAME>/.smb.cred 0 0