Automounting Data Drives Using FSTAB in Linux Mint Cinnamon

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
User avatar
Lady Fitzgerald
Level 15
Level 15
Posts: 5807
Joined: Tue Jan 07, 2020 3:12 pm
Location: AZ, SSA (Squabbling States of America)

Automounting Data Drives Using FSTAB in Linux Mint Cinnamon

Post by Lady Fitzgerald »

While there are GUI methods of setting up an internal drive to automatically mount, I found this one to be best (at least, it was for me) because it will allow the computer to boot even if a drive has died or has been removed.

1. Go to the File System (click on Home in Menu, then click on File system in left panel).

2. Right click on Media, then click on Open as Root.

3. Create a new folder named with the drive label.

4. Copy the UUID for the drivedrive from Disks and paste into a temporary Writer document or similar.

5. Open terminal and type:

sudo nano /etc/fstab

Then hit ENTER.

5. In new screen that pops up, start a new line after the last existing line and type:

UUID=(paste UUID here without parentheses)(TAB)/media/(folder name)(TAB)ext4(TAB)defaults, nofail(TAB)0(TAB)0

Do NOT press ENTER at the end of the line. If adding multiple drives, do only one drive at a time or use an arrow key to move to a new line.

Where you see (TAB) above, that means to press the TAB key (don't type the parentheses). This is an example of how an entry will look:

UUID=123ec4fd-54e2-4590-8a4b-da43630efd72 /media/Data1 ext4 defaults,nofail 0 0

6. Press CTRL+o

7. Press ENTER to save.

8. Press CTRL+x to exit.

9. If needing to add another drive, go back to step 1.

9. Restart the machine after all entries have been made. you should then see your drive(s) automounting.

It is important that nofail is included in the FSTAB entry. Otherwise, if the drive dies or is removed, the computer will be unable to boot.
Last edited by Lady Fitzgerald on Sun Aug 20, 2023 11:58 am, edited 4 times in total.
Jeannie

To ensure the safety of your data, you have to be proactive, not reactive, so, back it up!
linux-rox
Level 10
Level 10
Posts: 3334
Joined: Sun Jul 19, 2020 9:17 pm

Re: Automounting Data Drives Using FSTAB

Post by linux-rox »

Three tips you may find useful.

1. IMHO, three spaces works better than a tab in fstab. What tabs do depends on where the text is on the line. Three spaces always do the same thing.

2. Kind of surprised to see you using nano. If you want GUI, try EDITOR='xed -w' sudoedit /etc/fstab. Will prompt for password.

3. If you like that, can make permanent with echo "export SUDO_EDITOR='xed -w'" | tee -a .bashrc && echo "alias edit='sudoedit'" | tee -a .bashrc (adds two lines to your .bashrc file). Now the command becomes simply edit /etc/fstab. Once enter password, file opens in xed, easy-peasy.
User avatar
Lady Fitzgerald
Level 15
Level 15
Posts: 5807
Joined: Tue Jan 07, 2020 3:12 pm
Location: AZ, SSA (Squabbling States of America)

Re: Automounting Data Drives Using FSTAB

Post by Lady Fitzgerald »

linux-rox wrote: Sat May 27, 2023 10:58 pm Three tips you may find useful.

1. IMHO, three spaces works better than a tab in fstab. What tabs do depends on where the text is on the line. Three spaces always do the same thing.

2. Kind of surprised to see you using nano. If you want GUI, try EDITOR='xed -w' sudoedit /etc/fstab. Will prompt for password.

3. If you like that, can make permanent with echo "export SUDO_EDITOR='xed -w'" | tee -a .bashrc && echo "alias edit='sudoedit'" | tee -a .bashrc (adds two lines to your .bashrc file). Now the command becomes simply edit /etc/fstab. Once enter password, file opens in xed, easy-peasy.
Thanks for the suggestions. After a lot of research, I found that the method I described worked best for me. There is a GUI way using Disks but I've found this to be more reliable in the long run.
Jeannie

To ensure the safety of your data, you have to be proactive, not reactive, so, back it up!
linux-rox
Level 10
Level 10
Posts: 3334
Joined: Sun Jul 19, 2020 9:17 pm

Re: Automounting Data Drives Using FSTAB

Post by linux-rox »

Oh, I don't like the Disks method at all.

By the way, if anyone is interested, I notice on review that I neglected to mention one important detail for item #3. The edit to .bashrc doesn't take effect until the next time Terminal is opened. Or, can get it to take immediate effect with a further command: source .bashrc.
Post Reply

Return to “Tutorials”