6

I've seen that sometimes the entry for the swapfile in fstab is specified as "none" for the mount point and sometimes as "swap" instead. For example:

/swapfile none swap defaults 0 0 /swapfile swap swap defaults 0 0 

The fsrtab man page says that "none" should be used, but Red Hat's documentation uses "swap" instead.

What is the difference between those two?

3
  • Are you using Red Hat? Commented Sep 22, 2016 at 15:59
  • I am using Centos. Commented Sep 23, 2016 at 9:08
  • Did you mean fstab? Generally, the second field of the fstab is the name, which is usually a pathname to mount on. A swap partition does not have a pathname, so it has no meaning here. You could name it "gobbledegook" and the mounter will not care. The use of 'none' or 'swap' are just conventions, and may aid some tools in managing such partitions. Commented Jul 11, 2021 at 21:26

2 Answers 2

5

It's only a name. You can use any string, for example: pinkunicorn.

0

I think the following may be useful: "All about Linux swap space"

Since swap space is a special type of filesystem, many of these parameters aren’t applicable. For swap space, add:

/dev/hdb1 none swap sw 0 0 

where /dev/hdb1 is the swap partition. It doesn’t have a specific mount point, hence none. It is of type swap with options of sw, and the last two parameters aren't used so they are entered as 0.

The /etc/fstab entry for a swap file would look like this:

/swapfile none swap sw 0 0 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.