Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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
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.
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".
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.
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
^^^^^
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.