Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › Linux swap necessary?
New Posts  All Forums:Forum Nav:

Linux swap necessary? - Page 3

post #21 of 31
Quote:
Originally Posted by enorbet2 View Post
This used to be a pet peeve of mine - the idea that swap should be directly proportional to RAM.. It should be inversely proportional since the more ram you have the less swap you need. Also huge amounts of swap are needed more for Windoze since it leaks so badly with all the unresolved prefetch and what-not. Besides, they have a vested interest in their hardware partners so they can afford to be sloppy.

It is better to have more than to run out but the heaviest use I have ever seen on any machine by a user who did magazine layouts and web design professionally was still under 2Gigs on a Win2K machine. I have never seen any Linux install (other than an overworked server with 40+ workstations) use even 2Gig. ever. Home systems? Less than 1G tops.
Mine too. Back in the days of 256MB people would swear by the formula 2-4X the amount of swap space. Nowadays if you think you need it 256MB will suffice.

I don't use swap: ever. It's pointless, and even harmful for SSDs.

Quote:
Originally Posted by Rookie1337 View Post
Question on why you need swap for Hibernate: Is this just so the session is saved to the HDD? I never used a swap space when I had 4GBs of RAM and Sleep worked fine. However, I never saw a hibernate option in the various power menus either.

I just don't know though what you could possibly be running that would consume 8GBs of RAM though.
Sleep is probably referring to suspend to RAM. MS and their retarded nomenclatures. Why not S1,2.3, etc.? After all that is the ACPI standard....
PWNzershreck
(15 items)
 
  
CPUMotherboardGraphicsRAM
4930K @ 4.6 GHz ASUS Rampage IV Black Edition MSI GTX 1080 FE Heatkiller Acetal 16 GB Corsair Vengeance 1600C9 
Hard DriveOptical DriveCoolingOS
2x Samsung 840 Pro  ASUS DVD-RW SATA Koolance 380i & 2x HW Labs 480GTX Arch Linux x86_64, Windows 7 x64 
MonitorKeyboardPowerCase
LG UC88-B Ultrawide, ASUS VS278Q Ducky Corsair AX1200i Caselabs STH10 
MouseMouse PadAudio
Logitech G500 Func 1030 ASUS Xonar Essence STX 
  hide details  
Reply
PWNzershreck
(15 items)
 
  
CPUMotherboardGraphicsRAM
4930K @ 4.6 GHz ASUS Rampage IV Black Edition MSI GTX 1080 FE Heatkiller Acetal 16 GB Corsair Vengeance 1600C9 
Hard DriveOptical DriveCoolingOS
2x Samsung 840 Pro  ASUS DVD-RW SATA Koolance 380i & 2x HW Labs 480GTX Arch Linux x86_64, Windows 7 x64 
MonitorKeyboardPowerCase
LG UC88-B Ultrawide, ASUS VS278Q Ducky Corsair AX1200i Caselabs STH10 
MouseMouse PadAudio
Logitech G500 Func 1030 ASUS Xonar Essence STX 
  hide details  
Reply
post #22 of 31
Quote:
Originally Posted by binormalkilla View Post
It's pointless, and even harmful for SSDs.
Dangerous? That's really exaggerating the impact, especially for Linux where SWAP is probably going to remain unused for the majority of the time.
    
CPUMotherboardGraphicsRAM
i7 920 D0 MSI X58 Pro-E GTX 560 Ti 448 3x2GB G.Skill DDR3-1333 9-9-9-24 
Hard DriveHard DriveOptical DriveOS
840 Pro Caviar Black LG BD-ROM Windows 8.1 Pro x64 
MonitorMonitorKeyboardPower
Dell U2713HM Dell U2311H Turbo-Trak (Google it :D) Corsair HX-520 
CaseMouseMouse PadAudio
CM690 Mionix Avior 7000 Everglide Titan AKG K 242 HD 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
i7 920 D0 MSI X58 Pro-E GTX 560 Ti 448 3x2GB G.Skill DDR3-1333 9-9-9-24 
Hard DriveHard DriveOptical DriveOS
840 Pro Caviar Black LG BD-ROM Windows 8.1 Pro x64 
MonitorMonitorKeyboardPower
Dell U2713HM Dell U2311H Turbo-Trak (Google it :D) Corsair HX-520 
CaseMouseMouse PadAudio
CM690 Mionix Avior 7000 Everglide Titan AKG K 242 HD 
  hide details  
Reply
post #23 of 31
Quote:
Originally Posted by binormalkilla View Post
/Snipped:
Sleep is probably referring to suspend to RAM. MS and their retarded nomenclatures. Why not S1,2.3, etc.? After all that is the ACPI standard....
Well I was actually talking about my experience in Linux there. I never really used sleep with Windows because I for some reason just never trusted it to be left alone for very long.
     
CPUGraphicsRAMHard Drive
Intel Core m3-6Y30 Intel HD515 8GB 1866DDR3L Micron M600 MTFDDAV256MBF M.2, 256 GB 
CoolingOSOSMonitor
Fanless Win10 Home x64 Kubuntu 16.04 (requires Linux kernel 4.5/4.6) 13.3 inch 16:9, 1920x1080 pixel, AU Optronics A... 
CPUMotherboardGraphicsRAM
AthlonIIX4 640 3.62GHz (250x14.5) 2.5GHz NB Asus M4A785TD-M EVO MSI GTX275 (Stock 666) 8GBs of GSkill 1600 
RAMHard DriveHard DriveHard Drive
4GBs of Adata 1333 Kingston HyperX 3k 120GB WD Caviar Black 500GB Hitachi Deskstar 1TB 
Optical DriveCoolingOSOS
LG 8X BDR (WHL08S20) Cooler Master Hyper 212+ Kubuntu x64 Windows 7 x64 
OSMonitorPowerCase
Bodhi Linux x64 Acer G215H (1920x1080) Seasonic 520 HAF912 
CPUMotherboardGraphicsRAM
N450 1.8GHz AC and 1.66GHz batt ASUS proprietary for 1001P GMA3150 (can play bluray now!?) 1GB DDR2 
Hard DriveOptical DriveOSOS
160GB LGLHDLBDRE32X Bodhi Linux Fedora LXDE 
OSOSMonitorKeyboard
Kubuntu SLAX 1280x600 + Dell 15inch Excellent! 
PowerCase
6 cells=6-12hrs and a charger 1001P MU17 Black 
  hide details  
Reply
     
CPUGraphicsRAMHard Drive
Intel Core m3-6Y30 Intel HD515 8GB 1866DDR3L Micron M600 MTFDDAV256MBF M.2, 256 GB 
CoolingOSOSMonitor
Fanless Win10 Home x64 Kubuntu 16.04 (requires Linux kernel 4.5/4.6) 13.3 inch 16:9, 1920x1080 pixel, AU Optronics A... 
CPUMotherboardGraphicsRAM
AthlonIIX4 640 3.62GHz (250x14.5) 2.5GHz NB Asus M4A785TD-M EVO MSI GTX275 (Stock 666) 8GBs of GSkill 1600 
RAMHard DriveHard DriveHard Drive
4GBs of Adata 1333 Kingston HyperX 3k 120GB WD Caviar Black 500GB Hitachi Deskstar 1TB 
Optical DriveCoolingOSOS
LG 8X BDR (WHL08S20) Cooler Master Hyper 212+ Kubuntu x64 Windows 7 x64 
OSMonitorPowerCase
Bodhi Linux x64 Acer G215H (1920x1080) Seasonic 520 HAF912 
CPUMotherboardGraphicsRAM
N450 1.8GHz AC and 1.66GHz batt ASUS proprietary for 1001P GMA3150 (can play bluray now!?) 1GB DDR2 
Hard DriveOptical DriveOSOS
160GB LGLHDLBDRE32X Bodhi Linux Fedora LXDE 
OSOSMonitorKeyboard
Kubuntu SLAX 1280x600 + Dell 15inch Excellent! 
PowerCase
6 cells=6-12hrs and a charger 1001P MU17 Black 
  hide details  
Reply
post #24 of 31
Quote:
Originally Posted by randomizer View Post
Dangerous? That's really exaggerating the impact, especially for Linux where SWAP is probably going to remain unused for the majority of the time.
Why risk it? There is really no point in running a swap partition on an SSD.
PWNzershreck
(15 items)
 
  
CPUMotherboardGraphicsRAM
4930K @ 4.6 GHz ASUS Rampage IV Black Edition MSI GTX 1080 FE Heatkiller Acetal 16 GB Corsair Vengeance 1600C9 
Hard DriveOptical DriveCoolingOS
2x Samsung 840 Pro  ASUS DVD-RW SATA Koolance 380i & 2x HW Labs 480GTX Arch Linux x86_64, Windows 7 x64 
MonitorKeyboardPowerCase
LG UC88-B Ultrawide, ASUS VS278Q Ducky Corsair AX1200i Caselabs STH10 
MouseMouse PadAudio
Logitech G500 Func 1030 ASUS Xonar Essence STX 
  hide details  
Reply
PWNzershreck
(15 items)
 
  
CPUMotherboardGraphicsRAM
4930K @ 4.6 GHz ASUS Rampage IV Black Edition MSI GTX 1080 FE Heatkiller Acetal 16 GB Corsair Vengeance 1600C9 
Hard DriveOptical DriveCoolingOS
2x Samsung 840 Pro  ASUS DVD-RW SATA Koolance 380i & 2x HW Labs 480GTX Arch Linux x86_64, Windows 7 x64 
MonitorKeyboardPowerCase
LG UC88-B Ultrawide, ASUS VS278Q Ducky Corsair AX1200i Caselabs STH10 
MouseMouse PadAudio
Logitech G500 Func 1030 ASUS Xonar Essence STX 
  hide details  
Reply
post #25 of 31
Quote:
Originally Posted by binormalkilla View Post
Why risk it? There is really no point in running a swap partition on an SSD.
Exactly, why risk it?

The worst it will be is just a couple of gigs of HDD space sitting there doing nothing. So its probably best to just keep a small swap space.

I would rather have 2gigs sitting there than to have my PC crash later on down the road and have to add one.
My Build
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD Athlon II X4 630 @3.5 GIGABYTE GA-790XT-USB3 NVIDIA GeForce GTX 260 BFG MAXCORE 55 OC 216 Core 4094MB Mushkin Enhanced Blackline 1600 @1666 
Hard DriveOptical DriveOSKeyboard
200GB Samsung, 160GB Seagate Sony Optiarc Black Windows 7 Ultimate 64bit, Linux Ubuntu 11.04 64bit Logitech 
PowerCaseMouseMouse Pad
COOLMAX 700 Watt COOLER MASTER Storm Scout SGC-2000-KKN1-GP Logitech MX 518 Huskers 
  hide details  
Reply
My Build
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD Athlon II X4 630 @3.5 GIGABYTE GA-790XT-USB3 NVIDIA GeForce GTX 260 BFG MAXCORE 55 OC 216 Core 4094MB Mushkin Enhanced Blackline 1600 @1666 
Hard DriveOptical DriveOSKeyboard
200GB Samsung, 160GB Seagate Sony Optiarc Black Windows 7 Ultimate 64bit, Linux Ubuntu 11.04 64bit Logitech 
PowerCaseMouseMouse Pad
COOLMAX 700 Watt COOLER MASTER Storm Scout SGC-2000-KKN1-GP Logitech MX 518 Huskers 
  hide details  
Reply
post #26 of 31
Quote:
Originally Posted by binormalkilla View Post
Why risk it?
Because SWAP is slow, and it's much slower on a HDD. I'd prefer the lesser of the two evils... or more RAM.
    
CPUMotherboardGraphicsRAM
i7 920 D0 MSI X58 Pro-E GTX 560 Ti 448 3x2GB G.Skill DDR3-1333 9-9-9-24 
Hard DriveHard DriveOptical DriveOS
840 Pro Caviar Black LG BD-ROM Windows 8.1 Pro x64 
MonitorMonitorKeyboardPower
Dell U2713HM Dell U2311H Turbo-Trak (Google it :D) Corsair HX-520 
CaseMouseMouse PadAudio
CM690 Mionix Avior 7000 Everglide Titan AKG K 242 HD 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
i7 920 D0 MSI X58 Pro-E GTX 560 Ti 448 3x2GB G.Skill DDR3-1333 9-9-9-24 
Hard DriveHard DriveOptical DriveOS
840 Pro Caviar Black LG BD-ROM Windows 8.1 Pro x64 
MonitorMonitorKeyboardPower
Dell U2713HM Dell U2311H Turbo-Trak (Google it :D) Corsair HX-520 
CaseMouseMouse PadAudio
CM690 Mionix Avior 7000 Everglide Titan AKG K 242 HD 
  hide details  
Reply
post #27 of 31
You guys need to read about the swappiness portion of the kernel dev tree. Trust me, swap isn't needed with an SSD. Most guides will tell you to set swappiness to 1 (from the default of 60). There is much debate amongs kernel devs on the mailing list regarding the default swappiness.

Do what you want, but you're wasting SSD space and read/writes. If you run VMs then it WILL happen. I've tested it myself. If the value is set to high, the kernel will prefer to swap to RAM frequently.
https://wiki.archlinux.org/index.php...nce#Swappiness
Edited by binormalkilla - 12/20/10 at 2:14am
PWNzershreck
(15 items)
 
  
CPUMotherboardGraphicsRAM
4930K @ 4.6 GHz ASUS Rampage IV Black Edition MSI GTX 1080 FE Heatkiller Acetal 16 GB Corsair Vengeance 1600C9 
Hard DriveOptical DriveCoolingOS
2x Samsung 840 Pro  ASUS DVD-RW SATA Koolance 380i & 2x HW Labs 480GTX Arch Linux x86_64, Windows 7 x64 
MonitorKeyboardPowerCase
LG UC88-B Ultrawide, ASUS VS278Q Ducky Corsair AX1200i Caselabs STH10 
MouseMouse PadAudio
Logitech G500 Func 1030 ASUS Xonar Essence STX 
  hide details  
Reply
PWNzershreck
(15 items)
 
  
CPUMotherboardGraphicsRAM
4930K @ 4.6 GHz ASUS Rampage IV Black Edition MSI GTX 1080 FE Heatkiller Acetal 16 GB Corsair Vengeance 1600C9 
Hard DriveOptical DriveCoolingOS
2x Samsung 840 Pro  ASUS DVD-RW SATA Koolance 380i & 2x HW Labs 480GTX Arch Linux x86_64, Windows 7 x64 
MonitorKeyboardPowerCase
LG UC88-B Ultrawide, ASUS VS278Q Ducky Corsair AX1200i Caselabs STH10 
MouseMouse PadAudio
Logitech G500 Func 1030 ASUS Xonar Essence STX 
  hide details  
Reply
post #28 of 31
Thread Starter 
Quote:
Originally Posted by binormalkilla View Post
With an SSD card: no swap. Never. It's pointless.

Create a RAMdisk using /dev/shm as well, and make a RAMdisk that mounts to /tmp. This will allow you to compile to /tmp (RAM) instead of your SSD.

Swap will NEVER be used unless you're running a large virtual machine as well as a bunch of other programs on the host OS. I've tested this myself and found that I only used 2 MB of swap.


you should also change the 'swappiness' parameter on the kernel. I'm a bit drunk now so a quick google should give you the results You basically echo 1 to swappiness (default is 60 in the current kernel).

Swappiness is a hot debate amonst kernel devs ATM.

TL;DR

DO NOT USE SWAP ON AN SSD. If you REALLY think you need it buy a cheap USB drive and create a swap partition there.

I would suggest using suspend to RAM, but if you must use hibernate then buy a cheap 8GB flash drive, create a swap partition, activate the swap, then add it to fstab.

Also you might want to mount an old hard drive to your Torrents/Downloads folder to prevent excessive read/write.


You should really use suspend to ram using pm-utils to suspend to RAM. Swap should NOT be used on an SSD. Ever. I can't stress this enough. The number of writes is just not worth it.
Excellent post, thanks a lot for covering what I was worried about.

I'm already using a 2TB Western Digital hard drive for my ordinary files, so that's not a problem (I don't store anything on the SSD disks; they're mainly there for operating system purposes). I also have a 500GB USB hard drive but I'm not using it yet.

Is it even possible to install say, Ubuntu without a swap? If I remember correctly, it's always mandatory to install Linux with a swap partition (shouldn't it be optional in this day and age?).

Also I never hibernate so that's one less reason for me to use swap.
post #29 of 31
Quote:
Originally Posted by EliasAlucard View Post
/Snipped:
Is it even possible to install say, Ubuntu without a swap? If I remember correctly, it's always mandatory to install Linux with a swap partition (shouldn't it be optional in this day and age?).

Also I never hibernate so that's one less reason for me to use swap.
Yes, you can definitely install any distro that let's you do the "advanced" partitioning options without a swap. I don't use swap except on the netbook and that's only because MeeGo doesn't give you the option. On a rig with 2+GBs of RAM I just can't fathom the reason to have an hard drive space used for swap if you never plan to use hibernate. Also, what distro allows you to use hibernate (through GUIs since I know some of you guys are terminal geniuses) without meeting the requirements? In both windows and Linux as soon as I removed paging file and swap respectively, I lost the hibernate option in both OSes.
     
CPUGraphicsRAMHard Drive
Intel Core m3-6Y30 Intel HD515 8GB 1866DDR3L Micron M600 MTFDDAV256MBF M.2, 256 GB 
CoolingOSOSMonitor
Fanless Win10 Home x64 Kubuntu 16.04 (requires Linux kernel 4.5/4.6) 13.3 inch 16:9, 1920x1080 pixel, AU Optronics A... 
CPUMotherboardGraphicsRAM
AthlonIIX4 640 3.62GHz (250x14.5) 2.5GHz NB Asus M4A785TD-M EVO MSI GTX275 (Stock 666) 8GBs of GSkill 1600 
RAMHard DriveHard DriveHard Drive
4GBs of Adata 1333 Kingston HyperX 3k 120GB WD Caviar Black 500GB Hitachi Deskstar 1TB 
Optical DriveCoolingOSOS
LG 8X BDR (WHL08S20) Cooler Master Hyper 212+ Kubuntu x64 Windows 7 x64 
OSMonitorPowerCase
Bodhi Linux x64 Acer G215H (1920x1080) Seasonic 520 HAF912 
CPUMotherboardGraphicsRAM
N450 1.8GHz AC and 1.66GHz batt ASUS proprietary for 1001P GMA3150 (can play bluray now!?) 1GB DDR2 
Hard DriveOptical DriveOSOS
160GB LGLHDLBDRE32X Bodhi Linux Fedora LXDE 
OSOSMonitorKeyboard
Kubuntu SLAX 1280x600 + Dell 15inch Excellent! 
PowerCase
6 cells=6-12hrs and a charger 1001P MU17 Black 
  hide details  
Reply
     
CPUGraphicsRAMHard Drive
Intel Core m3-6Y30 Intel HD515 8GB 1866DDR3L Micron M600 MTFDDAV256MBF M.2, 256 GB 
CoolingOSOSMonitor
Fanless Win10 Home x64 Kubuntu 16.04 (requires Linux kernel 4.5/4.6) 13.3 inch 16:9, 1920x1080 pixel, AU Optronics A... 
CPUMotherboardGraphicsRAM
AthlonIIX4 640 3.62GHz (250x14.5) 2.5GHz NB Asus M4A785TD-M EVO MSI GTX275 (Stock 666) 8GBs of GSkill 1600 
RAMHard DriveHard DriveHard Drive
4GBs of Adata 1333 Kingston HyperX 3k 120GB WD Caviar Black 500GB Hitachi Deskstar 1TB 
Optical DriveCoolingOSOS
LG 8X BDR (WHL08S20) Cooler Master Hyper 212+ Kubuntu x64 Windows 7 x64 
OSMonitorPowerCase
Bodhi Linux x64 Acer G215H (1920x1080) Seasonic 520 HAF912 
CPUMotherboardGraphicsRAM
N450 1.8GHz AC and 1.66GHz batt ASUS proprietary for 1001P GMA3150 (can play bluray now!?) 1GB DDR2 
Hard DriveOptical DriveOSOS
160GB LGLHDLBDRE32X Bodhi Linux Fedora LXDE 
OSOSMonitorKeyboard
Kubuntu SLAX 1280x600 + Dell 15inch Excellent! 
PowerCase
6 cells=6-12hrs and a charger 1001P MU17 Black 
  hide details  
Reply
post #30 of 31
Quote:
Originally Posted by EliasAlucard View Post
Excellent post, thanks a lot for covering what I was worried about.

I'm already using a 2TB Western Digital hard drive for my ordinary files, so that's not a problem (I don't store anything on the SSD disks; they're mainly there for operating system purposes). I also have a 500GB USB hard drive but I'm not using it yet.

Is it even possible to install say, Ubuntu without a swap? If I remember correctly, it's always mandatory to install Linux with a swap partition (shouldn't it be optional in this day and age?).

Also I never hibernate so that's one less reason for me to use swap.
It's not optional at all. You will receive a warning during installation, but it's not needed. Trust me, I've been doing this for years (professionally and personally).

As for utilizing your mechanical drives I would do this:

set your boot, root, and home partitions on the SSD.

Create a RAMdisk using /dev/shm for about 1GB (if you have enough RAM). This will allow you to compile packages within the RAM instead of the SSD.

Create a separate partition for /var/ (preferably ReiserFS, the filesystem that makes you kill your wife. Make this on the mechanical drive. This will keep all of your log files and package management databases (CONSTANTLY being written) off the SSD.

If you have any questions I'll show you my fstab so you know what I mean.

Also you can store your Firefox and/or Chromium profiles in your /tmp RAMdisk to prevent excessive writes (cookies, bookmarks, etc.), plus it speeds up your browser.

Feel free to PM me whenever you like

Oh I forgot to mention, I mount my extra 500GB WDC black to /home/l33/Torrents and a USB drive to /home/l33/DLs for all of my downloads. This allows me to further lessen writes to the SSD.
PWNzershreck
(15 items)
 
  
CPUMotherboardGraphicsRAM
4930K @ 4.6 GHz ASUS Rampage IV Black Edition MSI GTX 1080 FE Heatkiller Acetal 16 GB Corsair Vengeance 1600C9 
Hard DriveOptical DriveCoolingOS
2x Samsung 840 Pro  ASUS DVD-RW SATA Koolance 380i & 2x HW Labs 480GTX Arch Linux x86_64, Windows 7 x64 
MonitorKeyboardPowerCase
LG UC88-B Ultrawide, ASUS VS278Q Ducky Corsair AX1200i Caselabs STH10 
MouseMouse PadAudio
Logitech G500 Func 1030 ASUS Xonar Essence STX 
  hide details  
Reply
PWNzershreck
(15 items)
 
  
CPUMotherboardGraphicsRAM
4930K @ 4.6 GHz ASUS Rampage IV Black Edition MSI GTX 1080 FE Heatkiller Acetal 16 GB Corsair Vengeance 1600C9 
Hard DriveOptical DriveCoolingOS
2x Samsung 840 Pro  ASUS DVD-RW SATA Koolance 380i & 2x HW Labs 480GTX Arch Linux x86_64, Windows 7 x64 
MonitorKeyboardPowerCase
LG UC88-B Ultrawide, ASUS VS278Q Ducky Corsair AX1200i Caselabs STH10 
MouseMouse PadAudio
Logitech G500 Func 1030 ASUS Xonar Essence STX 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Linux, Unix
Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › Linux swap necessary?