How to Increase Swap on Ubuntu Linux

How to Increase Swap on Ubuntu Linux

Linux Handbook

4 года назад

40,411 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@ASHISH-yo2sh
@ASHISH-yo2sh - 26.05.2023 23:34

I use 30 GB of swap

Ответить
@killerdronegaming7471
@killerdronegaming7471 - 13.11.2022 07:03

I have a 2gb ram ( potato 🥔 pc ) should i increase the swappiness to free my ram or should I decrease the swappiness

Ответить
@MakkahLiveOfficial
@MakkahLiveOfficial - 06.11.2022 18:02

Yeah but from where it can increased I mean is he collect the other 2 gb from home dir or root dir

Ответить
@JRis44
@JRis44 - 05.11.2022 03:21

In my case i got this laptop with 2GB RAM and so i decided to partition off my ssd to have non mounted swap space. 32GB worth of swap now added and put the priority to 100. Not sure if that is what you are suppose to do but I did and hopefully it works! Thanks for the info man!

Ответить
@laynemccormic9102
@laynemccormic9102 - 01.11.2022 02:09

Thank you bro great tutorial

Ответить
@dudeveryfriendly8958
@dudeveryfriendly8958 - 24.10.2022 03:29

thankyou hehe

Ответить
@usamashakeel9747
@usamashakeel9747 - 17.09.2022 10:32

Exellent 💖

Ответить
@jamesh4129
@jamesh4129 - 25.08.2022 16:27

Incredible!

Ответить
@Vroslyn
@Vroslyn - 20.08.2022 10:24

didnt work

Ответить
@itsforhad_
@itsforhad_ - 01.08.2022 09:42

swapon -s command shows a partition. Not any swapfile is there. What can I do now?

Ответить
@rohankohalli6109
@rohankohalli6109 - 26.07.2022 07:39

very useful video

Ответить
@Webtas
@Webtas - 22.05.2022 01:32

swapon: /dev/npme0n1p3: insecure permissions 0644, 0600 suggested.
swapon: /dev/npme0n1p3: swapon failed: Invalid argument

Ответить
@3DComputing
@3DComputing - 05.05.2022 16:42

Excellent, concise and just works. Thanks.

Ответить
@user-fn6sb2tq4g
@user-fn6sb2tq4g - 31.03.2022 23:05

Thank you man!

Ответить
@jakesllama
@jakesllama - 07.03.2022 19:22

dude. thank you. that saved me a bunch of hassle!

Ответить
@georgetommymalenga
@georgetommymalenga - 06.03.2022 15:26

How do i save after entering the vm.swappiness=10?

Ответить
@HikikomoriDev
@HikikomoriDev - 29.01.2022 09:17

I set mine to 64GB on my nvm ;)

Ответить
@trungthuchuynh5424
@trungthuchuynh5424 - 12.10.2021 13:24

thanks a lot!

Ответить
@cosqunhsnov4887
@cosqunhsnov4887 - 23.09.2021 23:36

Thanks bro

Ответить
@areftv9705
@areftv9705 - 18.09.2021 04:39

Thanks a lot!

Ответить
@MrSnowMen
@MrSnowMen - 11.09.2021 18:59

Nice one, That was just what I needed, For some reason mine created a 2GB file and when I had used it all would pause machine while it moved things about. about 30 + mins.

Ответить
@chamindabandara3447
@chamindabandara3447 - 29.08.2021 17:10

I followed this method to increase swap file from 2GB to 4GB.... But now I want to reduce the size again in my Ubuntu machine. How to reduce it?

Ответить
@factsonthefly725
@factsonthefly725 - 25.08.2021 05:50

after reboot its get changed

Ответить
@thenujansandramohan8930
@thenujansandramohan8930 - 05.08.2021 08:10

Thank you

Ответить
@Turjak_art
@Turjak_art - 30.06.2021 13:54

Thankyou

Ответить
@hdjfjd8
@hdjfjd8 - 25.06.2021 19:32

thx , it works 100%

Ответить
@j1kl3j
@j1kl3j - 24.06.2021 12:02

Thanks for this great video

Ответить
@programming_tips_bd
@programming_tips_bd - 21.06.2021 11:44

Thanks a lot bro. Great and Easy tips.

Ответить
@danielherrera4488
@danielherrera4488 - 30.05.2021 10:22

THANKS BRO U LIKE A BOOS!

Ответить
@osamaanees8406
@osamaanees8406 - 09.05.2021 09:13

Will it work on manjaro?

Ответить
@selfstudy6582
@selfstudy6582 - 03.04.2021 22:12

Bro I have this problem (ls: cannot access '/swapfile': No such file or directory)

Ответить
@Rizzan8
@Rizzan8 - 29.03.2021 15:29

Worked like a charm. Thank you.

Ответить
@falimks
@falimks - 05.03.2021 06:26

How to add more ram to swap

Ответить
@m.anwrs59
@m.anwrs59 - 28.02.2021 12:57

Thanksss

Ответить
@june8998
@june8998 - 15.12.2020 21:01

I wanted to install setup of GTA 5...so how much swap size will it need?

Ответить
@BoRedfearn
@BoRedfearn - 28.11.2020 07:06

thanks! you sound like my friend that works at facebook lol

Ответить
@sipintarpatrick2937
@sipintarpatrick2937 - 27.11.2020 11:26

what this things can work on kali?

Ответить
@Harshesh
@Harshesh - 24.11.2020 12:58

mkswap: /swapfile: insecure permissions 0644, 0600 suggested.
what should i do with this? how do I change permission..

Ответить
@optimisticnilhist
@optimisticnilhist - 21.11.2020 09:56

Commands

swapon --show : shows the swapfile or swap partition you have in your system. If its swapfile (which is the default) in ubuntu then following commmand work.
ls /swapfile : shows your swap file and its size its in the root directory of your system.
sudo swapoff /swapfile: instructs your system to not use the swap file.
fallocate -l 4G /swapfile: fallocate command is used to allocate size to an existing file. Here we are making the size of the swapfile 4G
sudo mkswap /swapfile : making this file named 'swapfile' the new swap file
sudo swapon /swapfile: instrcuting the system to use this new swapfile.

Bonus Tip:

Swappiness: This is a parameter that tells how much your computer is using the swap space or should use the Swapspace. HIgher the swappiness higher the use of swap space so it would be slow because RAM is the fast memory. So Desktops have Swappiness 60 and high perfomant systems have very low swappiness typically 1.

To see the swapiness parameter and change it:

cat /proc/sys/vm/swappiness: show your swappiness

To make the changes permanent edit the file /etc/sysctl.conf and add the line
vm.swappiness={your intended swappiness value here}

Thanks Linux HandBook!
Gooday Everyone

Ответить
@shreyanshsaha6170
@shreyanshsaha6170 - 12.11.2020 07:07

i followed this method to reduce swap file from 16gb to 4gb.. But where does the reduced size goes?? i want to use the reduced size again in my windows,, as i have dual booted??

Ответить
@benzflynn
@benzflynn - 10.11.2020 14:36

Dropping swappiness is fine if your PC or server has adequate RAM capacity. Since the Ubuntu system will need ~ 7 GB, this means maybe 16 GB RAM for a PC or more for a server. Anyway you can set up log files for recording the exact nature of freeze events so we can tell if it's swap space, swappiness or just plain app overload ?

Ответить
@warrenmanning7991
@warrenmanning7991 - 25.10.2020 19:51

Thanks very helpful

Ответить
@Unknown-qq5hm
@Unknown-qq5hm - 10.10.2020 16:45

How to decrease the swap file size ?

Ответить
@uberleet01
@uberleet01 - 10.10.2020 04:26

Desktop$ sudo fallocate -1 4G /swapfile
fallocate: invalid option -- '1'
Try 'fallocate --help' for more information.
what???????????????????????????????????

Ответить
@lorenzweb
@lorenzweb - 24.07.2020 11:52

- - - COPY PASTE - - -
swapon --show
ls -l /swapfile
swapon --show
sudo swapoff /swapfile
free -h
sudo fallocate -l 4G /swapfile
ls -l /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
swapon --show

Ответить
@burnzy3210
@burnzy3210 - 24.07.2020 01:43

the way this guy pronounces swap lol

Ответить
@Tutterzoid
@Tutterzoid - 03.07.2020 10:27

Thanks Bro .. Now I have a SWAP FILE of note .. and my Ubuntu is not chugging along as before :) Most grateful for you sharing this with us to maintain our sanity :)

Ответить
@SuperDoggykong
@SuperDoggykong - 05.06.2020 06:59

How do you decrease it???

Ответить
@keltyll
@keltyll - 19.05.2020 23:27

Very useful, thank you!

Ответить