User avatar
thagrol
Posts: 8232
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

STICKY: Using fstab A Beginner's Guide

Fri Feb 05, 2021 7:33 pm

There seems to have been a resurgence in folks having problems adding entries to /etc/fstab (not that that every really went away).

Many of the online resources I've seen are either incomplete, poor, or just plain wrong and often don't cover what to do when things go wrong.

As one of the folks who try to help with this, I figured I'd brain dump and throw something together.

First draft so likley a bit rough around the edges.

Released under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license

Zipped PDF attached:
fstab.zip
(119.24 KiB) Downloaded 451 times
2022-04-21 New version. Previous version available on github

2021-10-14: New version. Previous version available on github.
Change Log:
  • Addressed github issue #3
  • Updated 11.1 with additional systemd mount options
  • Changed heading for 11.3 to include exFAT
  • Adjusted page breaks
  • Corrected date in previous change log entry.
Last edited by thagrol on Thu Apr 21, 2022 1:07 pm, edited 3 times in total.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

User avatar
jahboater
Posts: 8370
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: Using fstab A Beginner's Guide

Fri Feb 05, 2021 8:21 pm

Very impressive and likely very useful!

One problem I have seen more than once is the lack of ownership etc on FAT filesystems.
Perhaps a few words about how they are "faked" in Linux?

Also a short description of some common mount options, especially for ext4 since it is the most used FS?

bls
Posts: 2729
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: Using fstab A Beginner's Guide

Fri Feb 05, 2021 11:20 pm

This is great! Seems fairly complete for a first go. Is there a way to make Troubleshooting bold in the TOC so that people are less likely to miss it? :lol:

The only suggestion I'd have is an advanced section along the lines of the "making things more secure" section for using x-systemd-automount, x-systemd-idle-timout, etc.

PS Love the 'password=derf' :lol:
Pi tools:
Quickly and easily build customized exactly as-you-want SSDs/SD Cards: https://github.com/gitbls/sdm
Easily run and manage your network's DHCP/DNS servers on a Pi: https://github.com/gitbls/ndm
Easy and secure IPSEC/IKEV2 VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

User avatar
thagrol
Posts: 8232
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: STICKY: Using fstab A Beginner's Guide

Mon Feb 08, 2021 12:27 am

Updated version.

From the change log:
2020-02-08
Numerous tweaks
Add two new trouble shooting items: 9.3 and 9.4
Added section 11
Attachments
fstab.zip
(118.52 KiB) Downloaded 686 times
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

nrajesh
Posts: 14
Joined: Sat Feb 13, 2021 4:45 pm

Re: STICKY: Using fstab A Beginner's Guide

Sun Feb 21, 2021 12:03 am

can you update this doc for exfat ?

Would it change anything in the instructions?

User avatar
thagrol
Posts: 8232
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: STICKY: Using fstab A Beginner's Guide

Sun Feb 21, 2021 12:22 am

nrajesh wrote:
Sun Feb 21, 2021 12:03 am
can you update this doc for exfat ?
Possibly but no promises as to when.
Would it change anything in the instructions?
Only a single mount option. On current RPiOS "umask=000" is not neccessary as with the exFAT driver that is the default. However including it does no harm.

Edit: and the fs type, obviously.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

User avatar
thagrol
Posts: 8232
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: STICKY: Using fstab A Beginner's Guide

Sat Mar 06, 2021 8:21 pm

No new revision will be made.

After my recent experience I'm giving up on trying to help folks. It just isn't worth the hassle.

Mods please lock.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

User avatar
CaptainMidnight
Posts: 340
Joined: Sun Nov 03, 2019 4:32 pm
Location: UK

Re: STICKY: Using fstab A Beginner's Guide

Mon Mar 08, 2021 9:03 am

I do understand your point of view, as some replies on these forums are questionable at best... it's just a shame the minority can spoil this resource for the benefit of the majority.

Anyway, if possible I was just after a clarification of your final point on page 8 wrt choosing to make the mount point read only. I read this as if the mount point was just /mnt instead of /mnt/folder - assume it's choosing to make the former (/mnt) read only, which is the scenario that could cause potential conflicts.
"Never get out of the boat."
Absolutely goddamn right!
Unless you were goin' all the way...

User avatar
thagrol
Posts: 8232
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: STICKY: Using fstab A Beginner's Guide

Mon Mar 08, 2021 12:02 pm

CaptainMidnight wrote:
Mon Mar 08, 2021 9:03 am
I do understand your point of view, as some replies on these forums are questionable at best... it's just a shame the minority can spoil this resource for the benefit of the majority.

Anyway, if possible I was just after a clarification of your final point on page 8 wrt choosing to make the mount point read only. I read this as if the mount point was just /mnt instead of /mnt/folder - assume it's choosing to make the former (/mnt) read only, which is the scenario that could cause potential conflicts.
It'll only cause problems when the mount fails. Which is the point of doing it.

When the mount fails, with a writeable mountpoit you end up writing to the SD card. Not only can this fill it up, it can also make files appear to be missing should the mount succeed at a later time. They won't be missing they'll be masked by the mount, which also make it harder to track down where your SD card's space has gone.

It's optional, if you're not happy with the potential conflicts don't do it.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

DunkPS
Posts: 6
Joined: Fri Oct 02, 2020 6:35 pm

Re: STICKY: Using fstab A Beginner's Guide

Sun Apr 04, 2021 8:48 am

Big thanks !!!
Just downloaded the fstab.zip
Ever day's a school day
useful and interesting

Paul :geek:
Learning Linux in Lockdown
Raspberry Pi Model B Plus, Revision 1.2, 2014
Raspbian Linux 10 - Buster

User avatar
thagrol
Posts: 8232
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: STICKY: Using fstab A Beginner's Guide

Tue Apr 13, 2021 6:47 pm

Now available on github: https://github.com/thagrol/Guides
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

User avatar
neilgl
Posts: 5411
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: STICKY: Using fstab A Beginner's Guide

Tue Apr 13, 2021 10:27 pm

Thanks

JonG
Posts: 64
Joined: Thu Oct 10, 2019 4:23 am

Re: STICKY: Using fstab A Beginner's Guide

Fri Aug 20, 2021 10:05 am

Thank you for this excellent guide.

I notice that you recommend using the following for network shares:
defaults,noatime,nofail,_netdev

I found that using noatime with CIFS gives me an error 22 - invalid argument

Here is an example:
//10.100.102.108/User /mnt/User cifs defaults,noatime,nofail,_netdev,username=.........
Once I remove "noatime" it mounts correctly.

I've googled this issue, but I couldn't find any reference to problems with noatime and network shares.

Is this a general problem, or specific to my setup?

User avatar
thagrol
Posts: 8232
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: STICKY: Using fstab A Beginner's Guide

Fri Aug 20, 2021 10:50 am

That's a mistake on my part. Thanks for pointing it out.

I'll correct in in the next update.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

Udab
Posts: 28
Joined: Tue May 04, 2021 1:23 pm

Re: STICKY: Using fstab A Beginner's Guide

Mon Sep 27, 2021 6:20 pm

How i can set my external USB disk to automount at every boot?

User avatar
thagrol
Posts: 8232
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: STICKY: Using fstab A Beginner's Guide

Mon Sep 27, 2021 6:27 pm

Udab wrote:
Mon Sep 27, 2021 6:20 pm
How i can set my external USB disk to automount at every boot?
See the guide: viewtopic.php?f=91&t=302752&p=1815316#p1815316 I'm not going to retype it here for you.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

User avatar
thagrol
Posts: 8232
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: STICKY: Using fstab A Beginner's Guide

Tue Sep 28, 2021 9:42 am

thagrol wrote:
Mon Sep 27, 2021 6:27 pm
Udab wrote:
Mon Sep 27, 2021 6:20 pm
How i can set my external USB disk to automount at every boot?
See the guide: viewtopic.php?f=91&t=302752&p=1815316#p1815316 I'm not going to retype it here for you.
On reflection that was a little harsh.

To briefly answer the question: add it to /etc/fstab starting your mount options with defaults,nofail. More details in the guide.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

User avatar
thagrol
Posts: 8232
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: STICKY: Using fstab A Beginner's Guide

Thu Oct 14, 2021 5:47 pm

New version available. See first post in topic.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

hydra3333
Posts: 286
Joined: Thu Jan 10, 2013 11:48 pm

Re: STICKY: Using fstab A Beginner's Guide

Wed Nov 24, 2021 4:27 am

Hello. I see per the thread above viewtopic.php?p=1942599#p1942599 that a future kernel update will bring a new NTFS3 and SMB_SERVER as a part of new kernel 5.15 ... just a heads up and thanks for the doco.

munyua44
Posts: 1
Joined: Thu Nov 25, 2021 5:20 pm

Re: STICKY: Using fstab A Beginner's Guide

Fri Nov 26, 2021 5:09 am

very encouraging work you are doing there. I have had a lot of trouble when it comes to working with fstab. Your work is great and I have tried it out and the outcome is great. Keep coming up with more insights for the benefit of those interrested.

User avatar
thagrol
Posts: 8232
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: STICKY: Using fstab A Beginner's Guide

Mon Apr 25, 2022 9:09 pm

Forgot to do this when I updated the guide over the weekend: New version attached to the first post in this thread.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

Return to “Beginners”