LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 03-11-2016, 03:12 AM   #1
scriptkiddy
LQ Newbie
 
Registered: Feb 2016
Posts: 18

Rep: Reputation: Disabled
Question swap file and partition reboot issue with free cmd


I had a standard CentOS 7 partition layout with /boot, /, /var, and swap (2G) partitions carved out.
So the free cmd showed me that I had 2G total.

As a test, I added roughly 500MB more swap through a swap file:

Code:
# free
# dd if=/dev/zero of=/extra-swap bs=1M count=500
# mkswap /extra-swap
# swapon -a
# free
At this point, the free command returned same amount, roughly 2G. So I added the swap file to my fstab to make it persistent then rebooted:
Code:
# vim /etc/fstab
...
/extra-swap          swap        swap       defaults 0 0 
...
# reboot
Upon reboot, the free cmd now showed 2.5G

My question is, why did free not show the swap until reboot?

Ideas and / or better ways to do this?

SK
 
Old 03-11-2016, 04:28 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,840

Rep: Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823
Code:
swapon /extra-swap
 
1 members found this post helpful.
Old 03-11-2016, 04:44 AM   #3
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 2,324
Blog Entries: 1

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
# swapon -s

to list active swaps. Free lists if you have some, but not much else about it. And as above use swapon to add the file/partition in the absence of having it auto-magically happen because of fstab.
 
1 members found this post helpful.
Old 03-11-2016, 06:55 AM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,130
Blog Entries: 2

Rep: Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825
swap file and partition reboot issue with free cmd

swapon -a scans the fstab file for entries. It will not scan your partition layout.
 
1 members found this post helpful.
  


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
nagios.cmd file not created after reboot ubuntu server pjonkers Linux - Software 2 05-30-2012 05:31 AM
Issue sg_modes cmd at cmd line, want to see the cmd in binary form NuUser Linux - Newbie 1 03-28-2012 09:08 AM
Can swap file or a swap partition be mounted and read? Mr-Bisquit Linux - General 3 06-08-2009 03:16 PM
Hard Drive Partition Management - Mandriva Double Partition with Swap File partition moshebagelfresser Linux - Hardware 2 05-23-2008 11:46 AM
Can't reboot RHEL WS4 - swap space issue? genemob Red Hat 3 01-31-2007 11:40 AM


All times are GMT -5. The time now is 05:13 AM.

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