LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-12-2017, 09:26 PM   #1
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Rep: Reputation: Disabled
Using "none" in /etc/fstab


We can use "none" for mount point (2-nd) field when
we define swap mounting in /etc/stab.

Just wondering what use cases are applicable to
using "none" on the first field in /etc/fstab.
Typically, the first field is for devices, e.g. /dev/vdb1.
 
Old 04-12-2017, 10:23 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,342
Blog Entries: 28

Rep: Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145
The device won't mount because device "/dev/none" doesn't exist.

The first field must point to a device that the computer believes exists. If you want to mount that device to /etc/media/none, that's fine, in that /etc/media/none is a mountpoint, it's not a nothing (i. e., it's not a none, it's a thing that happens to be named "none"). You could also call it /etc/media/fred or /etc/media/ralph, for all fstab cares.

Last edited by frankbell; 04-12-2017 at 10:24 PM.
 
Old 04-12-2017, 10:51 PM   #3
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by frankbell View Post
The device won't mount because device "/dev/none" doesn't exist.

The first field must point to a device that the computer believes exists. If you want to mount that device to /etc/media/none, that's fine, in that /etc/media/none is a mountpoint, it's not a nothing (i. e., it's not a none, it's a thing that happens to be named "none"). You could also call it /etc/media/fred or /etc/media/ralph, for all fstab cares.
Well, how do you explain "none" for swap mounting?
Swap does not mount to anything.
 
Old 04-12-2017, 11:10 PM   #4
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196
Quote:
Originally Posted by fanoflq View Post
Well, how do you explain "none" for swap mounting?
Swap does not mount to anything.
That is explained in man fstab...

Quote:
The first field (fs_spec).
This field describes the block special device or remote filesystem to be mounted.

For ordinary mounts it will hold (a link to) a block special device node (as created by mknod(8))
for the device to be mounted, like `/dev/cdrom' or `/dev/sdb7'. For NFS mounts one will have
<host>:<dir>, e.g., `knuth.aeb.nl:/'. For procfs, use `proc'.

Instead of giving the device explicitly, one may indicate the (ext2 or xfs) filesystem that is to
be mounted by its UUID or volume label (cf. e2label(8) or xfs_admin(8)), writing LABEL=<label>
or UUID=<uuid>, e.g., `LABEL=Boot' or `UUID=3e6be9de-8139-11d1-9106-a43f08d823a6'. This will
make the system more robust: adding or removing a SCSI disk changes the disk device name but not
the filesystem volume label.

Note that mount(8) uses UUIDs as strings. The string representation of the UUID should be based
on lower case characters.

The second field (fs_file).
This field describes the mount point for the filesystem. For swap partitions, this field should
be specified as `none'. If the name of the mount point contains spaces these can be escaped as
`\040'.
"none" in the second field is only applicable to swap devices, or if you create a mount point actually named none.

There are no normal use cases for none in the first field. "none" in the first field is not legal (unless of course you have an actual block device recognized by that name).

Last edited by astrogeek; 04-12-2017 at 11:16 PM. Reason: comments, emphasis, quoting
 
Old 04-13-2017, 09:11 AM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,781

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Quote:
Originally Posted by astrogeek View Post
There are no normal use cases for none in the first field. "none" in the first field is not legal (unless of course you have an actual block device recognized by that name).
It is legal for a tmpfs or a pseudo-filesystem like /proc that does not use a physical device. Using "none" in that first field is still not recommended because an error message reporting an issue with "none" or the output from the mount command saying "none on /proc ..." is just confusing.
 
1 members found this post helpful.
Old 04-13-2017, 05:22 PM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Some fstab documentation pages are out of date.
Mine has
Code:
The first field (fs_spec).
       This field describes the block special device or remote filesystem to be mounted.

       For ordinary mounts, it will hold (a link to) a block special device node (as created by mknod(8)) for the device to  be  mounted,
       like  `/dev/cdrom'  or  `/dev/sdb7'.  For NFS mounts, this field is <host>:<dir>, e.g., `knuth.aeb.nl:/'.  For filesystems with no
       storage, any string can be used, and will show up in df(1) output, for example.   Typical  usage  is  `proc'  for  procfs;  `mem',
       `none', or `tmpfs' for tmpfs.  Other special filesystems, like udev and sysfs, are typically not listed in fstab.

       LABEL=<label>  or  UUID=<uuid> may be given instead of a device name.  This is the recommended method, as device names are often a
       coincidence of hardware detection order, and can change when other disks are added  or  removed.   For  example,  `LABEL=Boot'  or
       `UUID=3e6be9de-8139-11d1-9106-a43f08d823a6'.  (Use a filesystem-specific tool like e2label(8), xfs_admin(8), or fatlabel(8) to set
       LABELs on filesystems).

       It's also possible to use PARTUUID= and PARTLABEL=. These partitions identifiers are supported for example for GUID Partition  Ta‐
       ble (GPT).

       See mount(8), blkid(8) or lsblk(8) for more details about device identifiers.
       Note that mount(8) uses UUIDs as strings. The string representation of the UUID should be based on lower case characters.
Specifically "For filesystems with no storage, any string can be used". And even includes the use of the word "none".

Last edited by jpollard; 04-13-2017 at 05:25 PM.
 
1 members found this post helpful.
Old 04-13-2017, 05:30 PM   #7
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
Some fstab documentation pages are out of date.
Mine has
Code:
The first field (fs_spec).
       This field describes the block special device or remote filesystem to be mounted.

       For ordinary mounts, it will hold (a link to) a block special device node (as created by mknod(8)) for the device to  be  mounted,
       like  `/dev/cdrom'  or  `/dev/sdb7'.  For NFS mounts, this field is <host>:<dir>, e.g., `knuth.aeb.nl:/'.  

For filesystems with no storage, any string can be used, and will show up in df(1) output, for example.   Typical  usage  is  `proc'  for  procfs;  `mem',
`none', or `tmpfs' for tmpfs.  Other special filesystems, like udev and sysfs, are typically not listed in fstab.

... ...
Specifically "For filesystems with no storage, any string can be used". And even includes the use of the word "none".
So a use case with none as first field in fstab is for tmpfs.
How do we use tmpfs?
Thank you.
 
Old 04-14-2017, 12:59 AM   #8
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by fanoflq View Post
So a use case with none as first field in fstab is for tmpfs.
How do we use tmpfs?
Thank you.
https://duckduckgo.com/?q=how+to+use+tmpfs
you're welcome.
 
Old 04-14-2017, 01:26 AM   #9
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
I see how tmpfs was mounted.
But how is it being used?
How to do processes use it or
make them aware of tmpfs so as to use it?
 
Old 04-14-2017, 04:16 AM   #10
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
tmpfs is using main memory as a filesystem for temporary use.

it is also used for holding the management information for shared memory.

Some distributions (fedora for one) use it to hold user credentials, temporary/dynamic mounts for portable media (CD/DVD/memory/USB memory sticks).

Most of the time "aware of tmpfs so as to use it" is transparent. For other uses, that depends on the user.

GUI users with the usual file display will get an added entry for the mount - and again is transparent.

Otherwise, it is up to the administrator.
 
Old 04-14-2017, 10:25 AM   #11
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,781

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Quote:
Originally Posted by fanoflq View Post
I see how tmpfs was mounted.
But how is it being used?
How to do processes use it or
make them aware of tmpfs so as to use it?
It's like any other mounted filesystem. It is mounted at some point in the system's directory hierarchy. Anything stored in that directory subtree is going into the tmpfs. Many systems have started using a tmpfs for /tmp, so any program that uses files in /tmp is using that tmpfs.
Code:
$ df /tmp
Filesystem     1K-blocks  Used Available Use% Mounted on
tmpfs            2097152  1504   2095648   1% /tmp
^^^^^
 
1 members found this post helpful.
Old 04-14-2017, 11:21 AM   #12
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
Thank you all.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] X: "loading extension glx" "no screens found" "fatal server error" (w/ nvidia driver) Geremia Slackware 7 12-29-2014 11:00 AM
What are the options "Nosuid" "mode" "size" in /etc/fstab? tuxfiles.org does not help pstein Linux - Newbie 1 11-16-2012 12:58 AM
[SOLVED] "data=writeback" in fstab mounts root partition as "read-only" holister Linux - General 7 11-28-2011 09:47 PM
server startup error: "cannot find / in /etc/fstab or /etc/mtab"; /etc/fstab readonly knee-co Linux - Newbie 8 09-12-2010 05:37 PM
Edit "read-only" /etc/fstab from "System Recovery#" (without boot cd?) charlweed Linux - General 1 12-31-2006 05:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration