Author Topic: Help with fstab options = defaults  (Read 1980 times)

Offline Nish

  • Sr. Member
  • ****
  • Posts: 384
    • SMQ's Adventures in Linux
Help with fstab options = defaults
« on: February 23, 2012, 12:06:31 PM »
I am building a new system with an SSD so am editing fstab to optimize it.  I added "discard" for trim function and I see that I should also add "noatime". I have  read up on "noatime" and I believe I understand it.  Originally, there were no options in my fstab except for "defaults".

What I am not quite understanding is what "defaults" covers already.  From what I understand "defaults" covers a set of options without having to list them separately.  I have googled a bit about it and it seems to mean different things to different file systems.  This is ext4 and I am not sure if I should remove "defaults" and replace with individual options.  I don't want to create a conflict by giving an option that conflicts with what "defaults" has covered.

Did that make sense?  ???

Never borrow time.  The interest will kill you - signed Mastercard & Visa

Embrace the Bird.  http://www.smqlinux.com - an old lady's adventures in linuxdom

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6214
Re: Help with fstab options = defaults
« Reply #1 on: February 23, 2012, 12:14:08 PM »
http://www.tuxfiles.org/linuxhelp/fstab.html

The above link is my authoritative guide to anything fstab.

The link has this for default: "rw, suid, dev, exec, auto, nouser, async".
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 10613
  • MLUs Forever!
Re: Help with fstab options = defaults
« Reply #2 on: February 23, 2012, 01:00:02 PM »
If considering noatime, you might also consider relatime ......
MLUs rule the roost!

Linux XPS 3.2.18-pclos2.pae.bfs  32 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT

Offline Nish

  • Sr. Member
  • ****
  • Posts: 384
    • SMQ's Adventures in Linux
Re: Help with fstab options = defaults
« Reply #3 on: February 23, 2012, 01:29:06 PM »
http://www.tuxfiles.org/linuxhelp/fstab.html

The above link is my authoritative guide to anything fstab.

The link has this for default: "rw, suid, dev, exec, auto, nouser, async".


Thank you.  I do not see ext4 mentioned there and assuming its defaults are similiar to ext2 and ext 3. Also starting to understandif I wanted to change an option to "user" then I would not be able to use "defaults" and would have to list rw, suid, dev, exec, auto, async?  This could be why I never saw "defaults" before in my PCLOS' fstab at least because normally I go in right away to PCC and change to allow user to mount the partitions.

If considering noatime, you might also consider relatime ......


hmmm, more options? had to google this one and what I see noatime (do not update), or relatime (update atime if older than mtime)- I am trying to get the least number of writes to the drive and from what I understand noatime is the way to go so that just reading the file, doesn't cause a write by changing the accessed time.  Now, I am seeing relatime is pretty much standard in linux now but what I am not understanding is what is mtime?  modified time? This one is getting a little over my head.
Never borrow time.  The interest will kill you - signed Mastercard & Visa

Embrace the Bird.  http://www.smqlinux.com - an old lady's adventures in linuxdom

Offline pags

  • Hero Member
  • *****
  • Posts: 2515
  • Keep it clean.
Re: Help with fstab options = defaults
« Reply #4 on: February 23, 2012, 01:39:03 PM »
...Also starting to understandif I wanted to change an option to "user" then I would not be able to use "defaults" and would have to list rw, suid, dev, exec, auto, async?  This could be why I never saw "defaults" before in my PCLOS' fstab at least because normally I go in right away to PCC and change to allow user to mount the partitions.
...

Not necessarily.  You can have "defaults", and then other options after it, and the last one will override the one from "defaults" (or any other previous, conflicting options).

For instance, I have an NTFS partition mounted from fstab, using "defaults".
It mounts thusly:
Code: [Select]
/dev/sda2 on /mnt/windows type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)

I added (as a test) ",ro" immediately after "defaults", and it mounted thusly:
Code: [Select]
/dev/sda2 on /mnt/windows type fuseblk (ro,nosuid,nodev,allow_other,blksize=4096)

You can see that the Read Only (ro) option then superceded the default Read/Write (rw), leaving the others unchanged...


Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6372
  • I'm going South
Re: Help with fstab options = defaults
« Reply #5 on: February 23, 2012, 02:13:18 PM »
...Also starting to understandif I wanted to change an option to "user" then I would not be able to use "defaults" and would have to list rw, suid, dev, exec, auto, async?  This could be why I never saw "defaults" before in my PCLOS' fstab at least because normally I go in right away to PCC and change to allow user to mount the partitions.
...

Not necessarily.  You can have "defaults", and then other options after it, and the last one will override the one from "defaults" (or any other previous, conflicting options).

For instance, I have an NTFS partition mounted from fstab, using "defaults".
It mounts thusly:
Code: [Select]
/dev/sda2 on /mnt/windows type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)

I added (as a test) ",ro" immediately after "defaults", and it mounted thusly:
Code: [Select]
/dev/sda2 on /mnt/windows type fuseblk (ro,nosuid,nodev,allow_other,blksize=4096)

You can see that the Read Only (ro) option then superceded the default Read/Write (rw), leaving the others unchanged...



Not only that. As you wrote, a "ro" in the fourth field of a line in /etc/fstab will override one default option and leave all other defaults as they were.

But the interesting thing is that then you don't need to specify "defaults" in the line to retain them. The "defaults" option is just a placeholder: it's needed if you don't add any other options to the fourth field, simply because the fourth field can't be left empty. If it's empty the system will interpret what you intend to be the fifth field as the fourth field. But if you add "ro" to the fourth field, it won't be empty and you won't need "defaults"; you'll get all other defaults anyway.

An explicit "defaults" won't hurt though.
« Last Edit: February 23, 2012, 02:18:06 PM by Bald Brick »
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Offline Nish

  • Sr. Member
  • ****
  • Posts: 384
    • SMQ's Adventures in Linux
Re: Help with fstab options = defaults
« Reply #6 on: February 23, 2012, 02:42:20 PM »

An explicit "defaults" won't hurt though.


As long as the "defaults" is the first.  Because it reads them in order, got it.

I had put noatime before defaults and will change it to after defaults tonight.  Just in case, because from what I have been reading relatime is a default in linux now though not sure it is covered by "defaults" there. 

Some good info, thank you.

Never borrow time.  The interest will kill you - signed Mastercard & Visa

Embrace the Bird.  http://www.smqlinux.com - an old lady's adventures in linuxdom

Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6372
  • I'm going South
Re: Help with fstab options = defaults
« Reply #7 on: February 23, 2012, 02:54:11 PM »

An explicit "defaults" won't hurt though.


As long as the "defaults" is the first.  Because it reads them in order, got it.

I didn't think about that.  :o So I thought you were right.

But you weren't. Even if "defaults" isn't the first option given, it won't override earlier options. To test it I just changed the /etc/fstab entry for one of my data partitions from
Code: [Select]
LABEL=Data /home/erik/Data1 ext4 defaults 1 2to
Code: [Select]
LABEL=Data /home/erik/Data1 ext4 ro,defaults 1 2
So "defaults" comes after "ro" and should override it. But after a reboot /etc/mtab still reports the partition as read-only.

It seems that even when "defaults" isn't just used as a placeholder, it isn't a real option either.

Edited
« Last Edit: February 23, 2012, 03:27:18 PM by Bald Brick »
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Offline Nish

  • Sr. Member
  • ****
  • Posts: 384
    • SMQ's Adventures in Linux
Re: Help with fstab options = defaults
« Reply #8 on: February 23, 2012, 05:04:37 PM »

As long as the "defaults" is the first.  Because it reads them in order, got it.


I didn't think about that.  :o So I thought you were right.

But you weren't. Even if "defaults" isn't the first option given, it won't override earlier options. To test it I just changed the /etc/fstab entry for one of my data partitions from
Code: [Select]
LABEL=Data /home/erik/Data1 ext4 defaults 1 2to
Code: [Select]
LABEL=Data /home/erik/Data1 ext4 ro,defaults 1 2
So "defaults" comes after "ro" and should override it. But after a reboot /etc/mtab still reports the partition as read-only.

It seems that even when "defaults" isn't just used as a placeholder, it isn't a real option either.
Edited
[/quote]

hmm, see  that did originally make sense to me because in my soon-to-be-former line of work as an e-learn developer, in our dev tools you can put in multiple actions for an object that may seem contradictory but they are read in order so the end result is what you want.

what you are saying here now, is "defaults" is just a placeholder.  I am wondering where the real default values are coming from.  For instance, they are saying that in the latest linux systems, "noatime" is the default.  Where is that being made the default, kernel level?

UPDATE Interesting discussion aside, testing out options and their placement in fstab (with an amusing aside into using "user" on my / drive doh) I have found it doesn't make any difference where I place things.

Additionally, trim is not working. Using the test http://techgage.com/article/enabling_and_testing_ssd_trim_support_under_linux/

I find the garbage is still located there even after removing the file (and used sync) and now have to wonder if indeed it is because this mobo does not support AHCI.  It is supposedly a fallacy that you need AHCI for trim as it is a function of the device and the OS. http://forum-en.msi.com/faq/article/ide-sata-and-ahci-all-you-need-to-know

Oh really? Then why is it not working.

Afraid this SSD will meet a bad end in my hands. Three hard shutdowns with no fsck because I don't know what options are safe to use on an SSD. Getting filled with garbage because I possibly have the wrong mobo. I want to start over but afraid to format the darn thing. This was like buying a Porsche when you don't know how to drive. Time to put it on ebay and drag out my trusty old clunk and chunk PATA WD that even I have not managed to kill in years.
« Last Edit: February 24, 2012, 04:47:58 AM by Nish »
Never borrow time.  The interest will kill you - signed Mastercard & Visa

Embrace the Bird.  http://www.smqlinux.com - an old lady's adventures in linuxdom