LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-10-2017, 02:17 AM   #1
tranphat
Member
 
Registered: Dec 2013
Posts: 86

Rep: Reputation: Disabled
entry for swap in fstab


Hi all,

as I know, this is the default for swap entry in fstab

/swap/swapfile swap swap defaults 0 0


But sometimes, I also see with none instead of swap:
UID=<UUID> none swap defaults 0 0

what is the difference between them?
 
Old 02-10-2017, 03:37 AM   #2
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
AFAIK: There is no difference, it is the name/mountpoint field but as swap doesn't use those, it is just a pretty field that does nothing. Just to note, the field is still required for formatting purposes as other filing systems/mounts do require it and so it's not like you can leave it empty.

Last edited by r3sistance; 02-10-2017 at 03:40 AM.
 
Old 02-10-2017, 08:12 AM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,911

Rep: Reputation: 1692Reputation: 1692Reputation: 1692Reputation: 1692Reputation: 1692Reputation: 1692Reputation: 1692Reputation: 1692Reputation: 1692Reputation: 1692Reputation: 1692
Using "none" can sometimes cause confusion. An error message like, "xxxx error on none" isn't very informative.
 
Old 02-10-2017, 08:27 AM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Slackware 14.2 / Slackware 14.2 current / Manjaro
Posts: 6,348

Rep: Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228Reputation: 1228
slackware swap entry added by Slackware during install
Code:
(userx@slacko⚡️~)>>$ cat /etc/fstab
/dev/mmcblk0p1   swap             swap        defaults         0   0
Void Linux Swap entry add by myself
Code:
UUID=9799b83a-f733-4f65-b4e0-e8e8f419fc20  sw swap  none 0 0
every entry in fstab is important. But as far as the file type swap , sw , none , are all variations of telling the OS what type of partition it is so it knows how to deal with it.

It was all brought about by the ones that developed Linux. whatever their logic was at the time they wrote the code to use that key word to indicate a use for swap, which is, someone correct me if I am wrong, like a raw data partition, just garbage to the untrained eyes if one was to look at it. No folders and file names. Just numbers and characters.


ArchLinux Wiki states to write that entry as the one you put to question.
https://wiki.archlinux.org/index.php/swap
Code:
To enable this swap partition on boot, add an entry to fstab:

UUID=<UUID> none swap defaults 0 0
here they do the same free bsd
https://www.freebsd.org/doc/handbook...wap-space.html
Code:
To automatically add this swap partition on boot, add an entry to /etc/fstab:

/dev/ada1s1b	none	swap	sw	0	0

oh hell I might even have my swap entry wrong?
oh well My system doesn't use the swap anyways. Lots of RAMs

changed it anyways.. thanks for your question.

Last edited by BW-userx; 02-10-2017 at 08:38 AM.
 
Old 02-10-2017, 09:17 AM   #5
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
No, the field really is only there for keeping the formatting consistent to other entries that need it, it doesn't matter what you put there, so this is a before and after of changing swap to herpyderp, at most it'll potentially change a few log entries here or there.

Code:
# grep swap /etc/fstab
/dev/mapper/centos-swap swap                    swap    defaults        0 0
# swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-4                               partition       3145724 0       -1
# nano /etc/fstab

---- reboot

# uptime
 15:15:14 up 1 min,  1 user,  load average: 0.42, 0.24, 0.09
# grep swap /etc/fstab
/dev/mapper/centos-swap herpyderp               swap    defaults        0 0
# swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-4                               partition       3145724 0       -1
Naturally keeping a consistent format is extremely important in /etc/fstab but what name you give to your swap doesn't really matter.

Last edited by r3sistance; 02-10-2017 at 09:22 AM.
 
1 members found this post helpful.
Old 02-13-2017, 01:19 AM   #6
tranphat
Member
 
Registered: Dec 2013
Posts: 86

Original Poster
Rep: Reputation: Disabled
Hi all,

I got it tks for your comments. I understand now, it doesn't matter whether swap has a name/mountpoint or not.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] fstab entry hasancbe123 Linux - Newbie 4 05-07-2012 06:51 PM
entry into /etc/fstab wetnose23 Slackware 2 01-07-2006 04:30 PM
problem with swap entry in /etc/fstab? kpachopoulos Linux - General 1 10-26-2005 04:19 PM
/etc/fstab entry ryedunn Linux - Newbie 1 01-17-2005 01:45 AM
fstab entry albean Linux - Newbie 1 12-04-2002 01:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:17 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration