Skip to content

About

simple guide for using the linux terminal to automatically mount drives in your linux operating system.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Manually adding partitions to fstab for automatically mounting drives

1. Use this command to check information required for fstab

lsblk -lf

Example information needed from lsblk:

  • partition name: sda1
  • file system: ext4
  • UUID: ba76177d-6d1f-4c22-a6c4-c1a3d65664cf

2. Create a mount point directory in /media. In this example I have named it '1tbMP' but you can name it anything you'd like

sudo mkdir /media/1tbMP

3. Mount partition to the directory you created

  • partition is located in /dev
sudo mount /dev/sda1 /media/1tbMP

4. Open the fstab file with nano to edit it

sudo nano /etc/fstab

5. Add the following line to the bottom of your fstab file

  • Format: UUID=your_drive_uuid /media/your_drive_name filesystem defaults,nofail 0 2
UUID=ba76177d-6d1f-4c22-a6c4-c1a3d65664cf /media/1tbMP ext4 defaults,nofail 0 2

Understanding what each part in this line does:

  • UUID: the partition identifier
  • /media/1tbMP: the mountpoint you created
  • ext4: the file system the partition is using (other examples: NTFS, exFat, Fat32, btrfs)
  • defaults: applies standard settings (rw, suid, dev, exec, auto, nouser, async)
  • nofail: Prevents the system from hanging or dropping into an emergency shell on boot if the drive is unplugged or missing. (If this does happens to you don't panic. Use this other guide to easily help you get back into your system: [https://github.com/trashcat53/escape-emergency-shell/tree/main])
  • 0: disables automated backups (use other recources life timeshift to safely take control of backups)
  • 2: checks filesystem after checking root (use 0 to not check, use 1 to check root first)

6. Optional: run this command to check for syntax errors in order to prevent potential boot issues from occuring

sudo mount -a

7. take ownership of /media and newly created mount point

cd /media
ls

# replace username with your actual username
sudo chown -R username:username /media/1tbMP
sudo chown username /media

About

simple guide for using the linux terminal to automatically mount drives in your linux operating system.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors