LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 02: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, 03:28 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,135

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

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
# 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, 05:55 AM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:30 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
Open Source Consulting | Domain Registration