[solved] FSTAB for dummies?

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
elmarts
Level 3
Level 3
Posts: 139
Joined: Mon Aug 08, 2016 6:46 pm

[solved] FSTAB for dummies?

Post by elmarts »

I want to have a couple of NTFS hard drives automount on login and/or boot, but am terrified of "editing" system files like fstab (which is what I gather has to be done to do this). Is there a point and grunt interface to fstab somewhere? - Elmar
Last edited by elmarts on Fri Aug 12, 2016 11:57 am, edited 1 time in total.
- Elmar
Dual boot win 10 & Linux Mint
Release Linux Mint 19.3 Tricia 64-bit
Kernel Linux 5.0.0-20-generic x86_64
MATE 1.22.2

User avatar
WharfRat
Level 21
Level 21
Posts: 13744
Joined: Thu Apr 07, 2011 8:15 pm

Re: FSTAB for dummies?

Post by WharfRat »

elmarts wrote:I want to have a couple of NTFS hard drives automount on login and/or boot, but am terrified of "editing" system files like fstab (which is what I gather has to be done to do this). Is there a point and grunt interface to fstab somewhere? - Elmar
Just use your text editor with escalated privileges.

First, make a copy just in case something goes awry.

Code: Select all

sudo  cp -va /etc/fstab /etc/fstab.safe
Good luck :wink:
ImageImage

Mute Ant
Level 14
Level 14
Posts: 5132
Joined: Tue Sep 03, 2013 7:45 pm
Location: Norfolk UK

Re: FSTAB for dummies?

Post by Mute Ant »

"point and grunt interface to fstab somewhere" Well yes, the Disks accessory will do the typing for you...mostly it gets it right, mostly.
While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named "manual".

User avatar
WharfRat
Level 21
Level 21
Posts: 13744
Joined: Thu Apr 07, 2011 8:15 pm

Re: FSTAB for dummies?

Post by WharfRat »

Mute Ant wrote:"point and grunt interface to fstab somewhere" Well yes, the Disks accessory will do the typing for you...mostly it gets it right, mostly.
That app usually does more harm than good :?
ImageImage

User avatar
slipstick
Level 5
Level 5
Posts: 955
Joined: Sun Oct 21, 2012 9:56 pm
Location: Somewhere on the /LL0 scale

Re: FSTAB for dummies?

Post by slipstick »

Info about fstab in case you need to modify it manually:

https://help.ubuntu.com/community/Fstab
https://ubuntuforums.org/showthread.php?t=283131
In theory, theory and practice are the same. In practice, they ain't.

User avatar
Flemur
Level 17
Level 17
Posts: 7643
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: FSTAB for dummies?

Post by Flemur »

Do what wharfrat said.
Then

Code: Select all

sudo your-text-editor /etc/fstab
(gedit, leafpad, whatever)
and add your one line for each ntfs partition.

The lines will look like:
$ grep NTFS /etc/fstab

Code: Select all

LABEL=NTFS    /mnt/NTFS    ntfs    user,windows_names   0 0
My ntfs partition had that LABEL applied, it's not automagical.

You'll probably have something like

Code: Select all

UUID=long-goofy-number     /mnt/NTFS    ntfs    user,windows_names   0 0
You can find the UUID's from

Code: Select all

sudo blkid
(not the "PARTUUID") Example (partition not mounted, doesn't matter):

Code: Select all

sudo blkid | grep ntfs
/dev/sda9: LABEL="NTFS" UUID="2DB5D2C37E4AFEF5" TYPE="ntfs" PARTUUID="850d2a1e-09"
When you're done with the text editor, save the file and try

Code: Select all

diff /etc/fstab /etc/fstab.safe
to see that the only differences are what you just added.

Note: I'm pretty sure that if you mess up your ntfs entry the worst that can happen is
- takes 1.5 minutes more per mistaken partition to boot (so don't freak out if it's slow)
- it might be read-only or something.

Edit
WharfRat That app [disks] usually does more harm than good
I've never used it but see problems here that it apparently caused.

Edit2:
You'll also have to make a "mount point" (e.g. "/mnt/NTFS" above), which is just an empty directory to start with.

Code: Select all

sudo mkdir /mnt/NTFS
sudo chown username:username /mnt/NTFS
It can be anywhere, like under your $HOME:
/home/username/ntfs
rather than /mnt/NTFS.
Last edited by Flemur on Thu Aug 11, 2016 7:23 pm, edited 2 times in total.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?

User avatar
jimallyn
Level 18
Level 18
Posts: 8951
Joined: Thu Jun 05, 2014 7:34 pm
Location: Wenatchee, WA USA

Re: FSTAB for dummies?

Post by jimallyn »

It's not hard to do. I was afraid to do it, too, but I did a little Googling for information, and have done it on 3 computers now. This page will probably help you:

https://help.ubuntu.com/community/Fstab
Image

“If the government were coming for your TVs and cars, then you'd be upset. But, as it is, they're only coming for your sons.” - Daniel Berrigan

all41
Level 15
Level 15
Posts: 5845
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: FSTAB for dummies?

Post by all41 »

+1 slipstick and jimallyn.
https://help.ubuntu.com/community/Fstab
This helped me understand the string of an fstab entry.
What seems to be missing is an explanation of noatime--even though it appears
in one of the examples. I do see noauto though--is that the same using different syntax?

User avatar
jimallyn
Level 18
Level 18
Posts: 8951
Joined: Thu Jun 05, 2014 7:34 pm
Location: Wenatchee, WA USA

Re: FSTAB for dummies?

Post by jimallyn »

I'm pretty sure I didn't wind up using that option. I had to Google it to see what it does. Here you go:

http://tldp.org/LDP/solrhe/Securing-Opt ... sec73.html

https://www.howtoforge.com/reducing-dis ... th-noatime
Image

“If the government were coming for your TVs and cars, then you'd be upset. But, as it is, they're only coming for your sons.” - Daniel Berrigan

User avatar
eatenimpinia
Level 3
Level 3
Posts: 146
Joined: Thu Sep 10, 2015 9:29 pm

Re: FSTAB for dummies?

Post by eatenimpinia »

Flemur wrote:Do what wharfrat said.
Then

Code: Select all

sudo your-text-editor /etc/fstab
(gedit, leafpad, whatever)...
Don't sudo into a graphical interface. Do a gksudo, instead. IOW:

Code: Select all

gksudo leafpad /etc/fstab
if leafpad is what you use.

For specifics of gksudo vs sudo:

https://askubuntu.com/questions/11760/w ... 1766#11766
Distro: (back to) Linux Mint 17.3 Rosa, Kernel: 4.4.0-51-generic x86_64 (64 bit), Desktop: Cinnamon 2.8.8

User avatar
slipstick
Level 5
Level 5
Posts: 955
Joined: Sun Oct 21, 2012 9:56 pm
Location: Somewhere on the /LL0 scale

Re: FSTAB for dummies?

Post by slipstick »

eatenimpinia wrote:
Flemur wrote:Do what wharfrat said.
Then

Code: Select all

sudo your-text-editor /etc/fstab
(gedit, leafpad, whatever)...
Don't sudo into a graphical interface. Do a gksudo, instead. IOW:

Code: Select all

gksudo leafpad /etc/fstab
if leafpad is what you use.

For specifics of gksudo vs sudo:

https://askubuntu.com/questions/11760/w ... 1766#11766
But then I hear that gksu/gksudo is deprecated to be replaced by pkexec: https://ubuntuforums.org/showthread.php?t=2225832
In theory, theory and practice are the same. In practice, they ain't.

all41
Level 15
Level 15
Posts: 5845
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: FSTAB for dummies?

Post by all41 »

Don't sudo into a graphical interface.
editing fstab as a graphical interface?
fstab is a text file--gksu not needed
I just navigate to the file and open as administrator (or open as root) for editing

User avatar
Flemur
Level 17
Level 17
Posts: 7643
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: FSTAB for dummies?

Post by Flemur »

all41
editing fstab as a graphical interface?
I always use "vi" for this kinda stuff...
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?

User avatar
WharfRat
Level 21
Level 21
Posts: 13744
Joined: Thu Apr 07, 2011 8:15 pm

Re: FSTAB for dummies?

Post by WharfRat »

Lets keep it simple. This will open the fstab file :wink:

Code: Select all

for e in kate gedit pluma xed;do if test -e /usr/bin/$e;then gksudo $e /etc/fstab;fi;done
ImageImage

User avatar
MajorMuff
Level 3
Level 3
Posts: 170
Joined: Thu Jun 23, 2016 4:41 am
Location: the Netherlands

Re: FSTAB for dummies?

Post by MajorMuff »

all41 wrote:
Don't sudo into a graphical interface.
editing fstab as a graphical interface?
fstab is a text file--gksu not needed
I just navigate to the file and open as administrator (or open as root) for editing
You could use a text editor with a GUI, which is probably what he meant ;)
If it screams it isn't food yet.

User avatar
slipstick
Level 5
Level 5
Posts: 955
Joined: Sun Oct 21, 2012 9:56 pm
Location: Somewhere on the /LL0 scale

Re: FSTAB for dummies?

Post by slipstick »

Don't know which desktop he's using, but on Cinnamon just open the file manager, select "File System", right click on "etc" and select "Open as Root", then double click on "fstab" to open it in gedit. Edit the file, close gedit and close the file manager. Done.
In theory, theory and practice are the same. In practice, they ain't.

elmarts
Level 3
Level 3
Posts: 139
Joined: Mon Aug 08, 2016 6:46 pm

Re: FSTAB for dummies?

Post by elmarts »

slipstick wrote:Don't know which desktop he's using, but on Cinnamon just open the file manager, select "File System", right click on "etc" and select "Open as Root", then double click on "fstab" to open it in gedit. Edit the file, close gedit and close the file manager. Done.
I'm in Mate, I just downloaded gedit as I don't have it. I did not see "open as root" even with right click on the file, I just clicked on it and it opened read-only. This is what I see in fstab now:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda5 during installation
UUID=40cad870-cb56-464f-a741-4222c0cccb81 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda6 during installation
UUID=3d57b0a6-c727-400a-971e-8a4a0362168d none swap sw 0 0
/dev/sdb /media/floppy0 auto rw,user,noauto,exec,utf8 0 0

and this is what blkid shows me:
/dev/sda1: LABEL="Win 7 boot" UUID="1EC01A73C01A50FF" TYPE="ntfs" PARTUUID="cf695485-01"
/dev/sda2: LABEL="Part 2" UUID="52A07B3EA07B281D" TYPE="ntfs" PARTUUID="cf695485-02"
/dev/sda5: UUID="40cad870-cb56-464f-a741-4222c0cccb81" TYPE="ext4" PARTUUID="cf695485-05"
/dev/sda6: UUID="3d57b0a6-c727-400a-971e-8a4a0362168d" TYPE="swap" PARTUUID="cf695485-06"
/dev/sdb1: UUID="56F01CF1F01CD957" TYPE="ntfs" PARTUUID="00000001-01"
/dev/sdc1: LABEL="500 GB" UUID="2E809C1A809BE71D" TYPE="ntfs" PARTUUID="a4b57300-01"

I need the "500 GB" (last line) entry automounted on boot ...
- Elmar
Dual boot win 10 & Linux Mint
Release Linux Mint 19.3 Tricia 64-bit
Kernel Linux 5.0.0-20-generic x86_64
MATE 1.22.2

User avatar
WharfRat
Level 21
Level 21
Posts: 13744
Joined: Thu Apr 07, 2011 8:15 pm

Re: FSTAB for dummies?

Post by WharfRat »

This will make it real easy....

Code: Select all

sudo  cp -va /etc/fstab /etc/fstab.safe
Create a mount point for it

Code: Select all

sudo mkdir /media/data
You can call it something else, but just make sure it matches the mount point in the next line

Code: Select all

echo -e "# added for /dev/sdc1\nUUID=2E809C1A809BE71D    /media/data    ntfs-3g    noatime,nls=utf8,windows_names,dmask=002,fmask=111,uid=1000,gid=1000    0 0"| sudo tee -a /etc/fstab
When done

Code: Select all

sudo mount /media/data
Enjoy :wink:
ImageImage

elmarts
Level 3
Level 3
Posts: 139
Joined: Mon Aug 08, 2016 6:46 pm

<solved> Re: FSTAB for dummies?

Post by elmarts »

Delightful - did exactly as you said, and lo, and behold! the drive appears on my desktop. And it will survive powerdown and automount upon reboot?
- Elmar
Dual boot win 10 & Linux Mint
Release Linux Mint 19.3 Tricia 64-bit
Kernel Linux 5.0.0-20-generic x86_64
MATE 1.22.2

User avatar
WharfRat
Level 21
Level 21
Posts: 13744
Joined: Thu Apr 07, 2011 8:15 pm

Re: <solved> Re: FSTAB for dummies?

Post by WharfRat »

elmarts wrote:Delightful - did exactly as you said, and lo, and behold! the drive appears on my desktop. And it will survive powerdown and automount upon reboot?
Just shutdown normally as I'm sure you're probably already doing and yes, it will mount during boot...
ImageImage

Post Reply

Return to “Newbie Questions”