LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-21-2016, 10:59 PM   #1
happydog500
Member
 
Registered: Dec 2006
Location: Washington St.
Distribution: Linux Mint 18.2, Windows 7, 10, Ubuntu-MATE, Xubuntu, devuan, and about a dozen others-Hopper
Posts: 304

Rep: Reputation: 5
Questions on Swap Partition, How did Anyone Pass This Along? Next Ubuntu No Swap Partition


OK, I don't understand something about swap partition. It's not the usual question.

All over the Internet, the rule of thumb is, a swap partition should be about the amount of RAM you have. Repeat, this is all over the Internet, including Linux forums.

This is preposterous. It is so stupid, how did this ever get passed along as the way it should be?

Let me give an example (exaggerated to make the point clearer). Lets say you have 25GB's of RAM. The suggestion would be you need a 25GB swap. If you have 2GB's of RAM, you need a 2GB swap.

This is so stupid. It's NOT if it's right or wrong, I'm way past that, I'm wondering how come the first time that appeared on the net, it didn't get 25 responses saying this is stupid.

How did this get past along as the correct way to set up the computer?

I read yesterday that the new Ubuntu 17.04 was not going to come out with a swap partition, but a swap file. The reasoning was with a lot of RAM people use now, and SSD's, it's not really needed. Sounds like good reasoning to me.

I have 8GB's of RAM, was told I should make at least an 8GB swap partition. I have an SSD HD. Knowing I didn't need the full 8GB's of RAM, I used 6GB's.

I'm using the equivalent of 14GB's of RAM, to do basic computer stuff. Back in the early days, I used to do heavy video editing with 1 to 2GB's of RAM.

Is there an easy way to install Ubuntu without a swap partition, and make it use a swap file before Ubuntu 17.04?

Can I change my swap partition from 6GB's to 2GB's on an already working computer?

Thank you,
Chris.

Last edited by happydog500; 12-21-2016 at 11:03 PM. Reason: changed typo from 2mb to 2GB's
 
Old 12-21-2016, 11:02 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,773

Rep: Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571Reputation: 3571
Yes.
 
Old 12-22-2016, 01:49 AM   #3
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 363Reputation: 363Reputation: 363Reputation: 363
HOT off the presses (no more swap partition! as you referred to):
http://www.omgubuntu.co.uk/2016/12/u...ons-swap-files

?3: maybe manual/custom partition?

?4: edit fstab (#swap) & reboot (or swapoff) Then repartition&mkswap ... maybe

?1&2: same as how any opinion [e.g. systemd] travels the internet

Last edited by Jjanel; 12-22-2016 at 02:00 AM.
 
Old 12-22-2016, 04:21 AM   #4
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 4,206

Rep: Reputation: Disabled
It all started when we had little ram on our computers, I'm talking 128MB, nowadays it is only necessary if you only have less than 1GB.

But, if you have a laptop, & use suspend/hibernate, you will need double the amount of your ram, as that is where your computer state is stored.

Last edited by fatmac; 12-23-2016 at 10:31 AM.
 
1 members found this post helpful.
Old 12-22-2016, 08:19 AM   #5
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,852

Rep: Reputation: 339Reputation: 339Reputation: 339Reputation: 339
If you intend to use "hibernate" as opposed to "suspend", you will need to have a swap partition at least equal to the amount of ram. That's why the advice is given to have a swap partition the size of your ram. With hibernation, on shut down the contents of ram are written and stored in the swap partition. When you reboot from hibernation, that info stored in swap is read and written back to ram and the system is restored to the condition it was in when you shut down.
Hibernation used to be used to speed up the boot process but today with SSDs hibernation is generally not needed or used. Hibernation was generally pretty buggy as well.
 
Old 12-22-2016, 08:29 AM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,555

Rep: Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088
Quote:
Originally Posted by kilgoretrout View Post
Hibernation used to be used to speed up the boot process
Not really. The time needed to read 4 to 8 GB from a rotating disk can be longer than it takes to boot. The advantage, though, is that you get your whole running environment back just the way you left it.
 
Old 12-22-2016, 08:40 AM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,229
Blog Entries: 4

Rep: Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260
In most cases, I see swap files, not partitions, and I see little reason to allocate a partition to swap.
 
Old 12-22-2016, 09:35 AM   #8
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,852

Rep: Reputation: 339Reputation: 339Reputation: 339Reputation: 339
Quote:
In most cases, I see swap files, not partitions, and I see little reason to allocate a partition to swap.
Don't know if hibernation will work off of a swap file. IIRC you used to have to designate the swap partition for hibernation in grub.conf under "resume". However, with Grub2 you might be able to use a swap file.
 
Old 12-22-2016, 10:27 AM   #9
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
I agree and have said things similar to what you stated. I do not even have a swap partition anymore, running 16GB RAM Laptop. Void Linux. it never used swap so I just got rid of it, and have never had any problems as a result of it.
 
Old 12-22-2016, 11:08 AM   #10
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
OOPS lloookie here what I discovered, this solaris knock off seems to understand you.
Quote:
The default size of the OpenIndiana swap file is 50% of installed memory.
 
Old 12-22-2016, 02:10 PM   #11
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 4,206

Rep: Reputation: Disabled
On my installations on machines with 2GB ram, I don't use swap at all, just / & /home partitions.
 
Old 12-22-2016, 08:55 PM   #12
Myk267
Member
 
Registered: Apr 2012
Location: California
Posts: 422
Blog Entries: 16

Rep: Reputation: Disabled
Quote:
Originally Posted by happydog500 View Post
All over the Internet, the rule of thumb is, a swap partition should be about the amount of RAM you have.
A rule of thumb is a heuristic at the time of creation. It's definitely not a rule or a law you can't break if you see differently.

Today's
Quote:
Originally Posted by happydog500 View Post
Sounds like good reasoning to me.
is tomorrow's
Quote:
Originally Posted by happydog500 View Post
This is preposterous. It is so stupid, how did this ever get passed along as the way it should be?
Quote:
Originally Posted by happydog500 View Post
Is there an easy way to install Ubuntu without a swap partition, and make it use a swap file before Ubuntu 17.04?

Can I change my swap partition from 6GB's to 2GB's on an already working computer?

Thank you,
Chris.
It doesn't look too difficult of a task, from the looks of it here https://wiki.archlinux.org/index.php/Swap#Swap_file

GParted (named "Parted" in Ubuntu) is a useful GUI tool for partition management. You can use it to shrink a swap partition just fine.
 
Old 12-23-2016, 01:41 AM   #13
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 363Reputation: 363Reputation: 363Reputation: 363
Is anyone *actually using* hibernation to a swap *file* [successfully 'for sure']? What distroVers&'how'?
This & this etc seem to say 'yes'. (are there some [common current] releases where you can't?)
 
Old 12-23-2016, 07:01 AM   #14
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
Quote:
Originally Posted by Jjanel View Post
Is anyone *actually using* hibernation to a swap *file* [successfully 'for sure']? What distroVers&'how'?
This & this etc seem to say 'yes'. (are there some [common current] releases where you can't?)
hibernation I keep forgetting about swap needed for hibernation. I don't use hibernation. I am not a bear.
 
Old 12-23-2016, 07:20 AM   #15
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 3,829

Rep: Reputation: 1735Reputation: 1735Reputation: 1735Reputation: 1735Reputation: 1735Reputation: 1735Reputation: 1735Reputation: 1735Reputation: 1735Reputation: 1735Reputation: 1735
Quote:
Originally Posted by happydog500 View Post
OK, I don't understand something about swap partition. It's not the usual question.

All over the Internet, the rule of thumb is, a swap partition should be about the amount of RAM you have. Repeat, this is all over the Internet, including Linux forums.

This is preposterous. It is so stupid, how did this ever get passed along as the way it should be?

Let me give an example (exaggerated to make the point clearer). Lets say you have 25GB's of RAM. The suggestion would be you need a 25GB swap. If you have 2GB's of RAM, you need a 2GB swap.

This is so stupid. It's NOT if it's right or wrong, I'm way past that, I'm wondering how come the first time that appeared on the net, it didn't get 25 responses saying this is stupid.

How did this get past along as the correct way to set up the computer?

I read yesterday that the new Ubuntu 17.04 was not going to come out with a swap partition, but a swap file. The reasoning was with a lot of RAM people use now, and SSD's, it's not really needed. Sounds like good reasoning to me.

I have 8GB's of RAM, was told I should make at least an 8GB swap partition. I have an SSD HD. Knowing I didn't need the full 8GB's of RAM, I used 6GB's.

I'm using the equivalent of 14GB's of RAM, to do basic computer stuff. Back in the early days, I used to do heavy video editing with 1 to 2GB's of RAM.

Is there an easy way to install Ubuntu without a swap partition, and make it use a swap file before Ubuntu 17.04?

Can I change my swap partition from 6GB's to 2GB's on an already working computer?

Thank you,
Chris.
First, advice is only "stupid" if you do not understand it. It might also be wrong, but understanding it is key.
Second, the term is misleading. The recommendation is for swap SPACE, not swap partition. The swap space may be a partition, a swap file, or swap device.
Third, the reasons for the rules of thumb are several. For a low ram machine the rule is 2.5 times the amount of ram. For most modern machines the rule is the amount of ram because more is not needed. Under certain conditions a crash will dump the image of ALL RAM to swap space, and detailed analysis of that image may be critical to troubleshooting the cause. All of those are secondary reasons for HAVING swap, but valid reasons to SIZE it. The best reasons for HAVING it involve system stability under extreme conditions.
Fourth, a rule of thumb is only that, and the only penalty for violating one will be the behavior of your system. We have no "THUMBRULE POLICE" to send to your door if you disable swap or set the size to half of ram. No one really cares. It is just advice from the most experienced and intelligent system administrators on the planet, so do whatever you want.
 
  


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] Swap partition against swap file: how much performance do I loose? stf92 Slackware - Installation 12 03-15-2014 05:48 PM
Would a Linux swap partition work as a FreeBSD swap partition? Froggy192 *BSD 11 07-27-2013 02:06 PM
Hard Drive Partition Management - Mandriva Double Partition with Swap File partition moshebagelfresser Linux - Hardware 2 05-23-2008 10:46 AM
Swap partition questions... chiefreborn Linux - Newbie 5 06-08-2005 07:59 PM
Need for a swap partition? And some other questions! deasel Linux - Newbie 3 02-04-2004 12:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:56 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