LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Using "none" in /etc/fstab (https://www.linuxquestions.org/questions/linux-newbie-8/using-none-in-etc-fstab-4175603741/)

fanoflq 04-12-2017 09:26 PM

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.

frankbell 04-12-2017 10:23 PM

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.

fanoflq 04-12-2017 10:51 PM

Quote:

Originally Posted by frankbell (Post 5696269)
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.

astrogeek 04-12-2017 11:10 PM

Quote:

Originally Posted by fanoflq (Post 5696279)
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).

rknichols 04-13-2017 09:11 AM

Quote:

Originally Posted by astrogeek (Post 5696281)
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.

jpollard 04-13-2017 05:22 PM

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".

fanoflq 04-13-2017 05:30 PM

Quote:

Originally Posted by jpollard (Post 5696630)
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.

ondoho 04-14-2017 12:59 AM

Quote:

Originally Posted by fanoflq (Post 5696634)
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.

fanoflq 04-14-2017 01:26 AM

Quote:

Originally Posted by ondoho (Post 5696732)

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?

jpollard 04-14-2017 04:16 AM

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.

rknichols 04-14-2017 10:25 AM

Quote:

Originally Posted by fanoflq (Post 5696741)
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
^^^^^


fanoflq 04-14-2017 11:21 AM

Thank you all.


All times are GMT -5. The time now is 03:30 PM.