Answer the question
In order to leave comments, you need to log in
Swap file in CentOS - what to add to fstab?
In various manuals, for example here
https://www.centos.org/docs/5/html/5.2/Deployment_...
it is written that at the last stage, the line must be added to the fstab file
/swapfile swap swap defaults 0 0
#
# /etc/fstab
# Created by anaconda on Wed Jul 26 08:42:33 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=a58b04a6-13de-4b25-8e60-281854f89174 / ext4 quota,grpquota,usrquota,rw 0 1
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
swap /swapfile swap defaults 0 0
Answer the question
In order to leave comments, you need to log in
Why not read man fstab?
The first column is what will be mounted, which can be a file, a block device (which is also a file), a label, or a filesystem ID. The second - where to mount. The third is the file system type.
tmpfs, devpts, sysfs, proc are virtual filesystems, they ignore the first column.
swap is also tricky: if swap is specified in the first column, then swapon -a will be called; if it starts with /, then swapon /path will be called. And for swap, the second column should be none:
So you can try
swapon /swapfile
swapon -s
/dev/mapper/vg_none-lv_swap swap swap defaults 0 0
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question