[Solved] Swap File/Swap Partition

Ask for help with issues regarding the Installations of the Debian O/S.
Post Reply
Message
Author
User avatar
supusr
Posts: 44
Joined: 2016-11-09 20:07
Location: Mountain West, USA

[Solved] Swap File/Swap Partition

#1 Post by supusr »

I installed Debian (testing) from a netinst usb. Did it automatically install a swap partition or a swap file? swapon -s shows no such bash command exists, but my conky display shows some swap is available.
Last edited by supusr on 2020-06-09 04:15, edited 1 time in total.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 134 times

Re: Swap File/Swap Partition

#2 Post by Head_on_a_Stick »

supusr wrote:swapon -s shows no such bash command exists
http://forums.debian.net/viewtopic.php?f=16&t=142973
deadbang

User avatar
supusr
Posts: 44
Joined: 2016-11-09 20:07
Location: Mountain West, USA

Re: Swap File/Swap Partition

#3 Post by supusr »

OK. Using su - and then swapon -s gives me:

Filename Type Size Used Priority
/dev/dm-1 partition 999420 420 -2

So, it looks like I have a swap partition of about 1G (?) and no swap file?

Is this, then, the installation default?

cuckooflew
Posts: 677
Joined: 2018-05-10 19:34
Location: Some where out west
Been thanked: 1 time

Re: Swap File/Swap Partition

#4 Post by cuckooflew »

see the installation manual: https://debian-handbook.info/browse/sta ... steps.html
You do not even tell us what partitioning method you used, ? If it was guided, then:
---edit-- added for clarification:
From:https://debian-handbook.info/browse/sta ... steps.htmlAfter choosing the type of partition, the software calculates a suggestion, and describes it on the screen; the user can then modify it if needed. You can, in particular, choose another filesystem if the standard choice (ext4) isn't appropriate. In most cases, however, the proposed partitioning is reasonable and it can be accepted by selecting the “Finish partitioning and write changes to disk” entry.
Image
1.1 gb ,......
Based on what the installation manual says, but the default swap partition size will vary,depending on how much ram /memory is available, more information you neglect to give us.
This: https://wiki.debian.org/Swap
Is also educational. Maybe take the time to read it.
Postby supusr »So, it looks like I have a swap partition of about 1G (?) and no swap file?
Well, based on what you show, or say swapon shows, yes. Why do you expect a additional swap file ? Did you create one ?
Here is what mine looks like, and it also is a netinstall, default,..I have not modified or added any swap partitions, mine is aprox 498mb. Please note also, the use of code boxes:

Code: Select all

root@debian:~# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
fd0      2:0    1    4K  0 disk 
sda      8:0    0   20G  0 disk 
├─sda1   8:1    0 19.5G  0 part /
├─sda2   8:2    0    1K  0 part 
└─sda5   8:5    0  498M  0 part [SWAP]
sr0     11:0    1 1024M  0 rom  
root@debian:~# swapon -s
Filename                                Type            Size    Used    Priority
/dev/sda5                               partition       509948  0       -2
root@debian:~# swapon --show
NAME      TYPE      SIZE USED PRIO
/dev/sda5 partition 498M   0B   -2 
========================

Code: Select all

cuckoo@debian:~$ free -m
              total        used        free      shared  buff/cache   available
Mem:            961          87         610           0         263         735
Swap:           497           0         497 
Last edited by cuckooflew on 2020-06-08 16:15, edited 1 time in total.
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!

User avatar
supusr
Posts: 44
Joined: 2016-11-09 20:07
Location: Mountain West, USA

Re: Swap File/Swap Partition

#5 Post by supusr »

Thanks to all for the input. I read the links you provided, and neither answers my specific question, which is: what is the default swap partitioning scheme? I used the graphical installation and selected guided, but under that method there is no option regarding swap. This is my output for lsblk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 29G 0 disk
└─sda1 8:1 1 29G 0 part /media/rocket/backup1
sdb 8:16 1 14.4G 0 disk
└─sdb1 8:17 1 14.4G 0 part /media/rocket/backup21
sr0 11:0 1 1024M 0 rom
nvme0n1 259:0 0 238.5G 0 disk
├─nvme0n1p1 259:1 0 512M 0 part /boot/efi
├─nvme0n1p2 259:2 0 488M 0 part /boot
└─nvme0n1p3 259:3 0 237.5G 0 part
├─pc--vg-root 254:0 0 236.5G 0 lvm /
└─pc--vg-swap_1 254:1 0 976M 0 lvm [SWAP]
This shows a swap partition of around 1G. I am wondering how the installer decides this, and whether it can make different decisions based on one's hardware, etc. I have not stated that I expected a swap file or a swap partition, only that I would like to know the default swap process.

cuckooflew
Posts: 677
Joined: 2018-05-10 19:34
Location: Some where out west
Been thanked: 1 time

Re: Swap File/Swap Partition

#6 Post by cuckooflew »

supusr wrote:I installed Debian (testing) from a netinst usb. Did it automatically install a swap partition or a swap file? swapon -s shows no such bash command exists, but my conky display shows some swap is available.
Geez, another one of these,....ok let's try again, but also now you are asking a totally different question, from the above,..
Post by supusr » 2020-06-08 13:21
Thanks to all for the input. I read the links you provided, and neither answers my specific question, which is: what is the default swap partitioning scheme? I used the graphical installation and selected guided, but under that method there is no option regarding swap.
Yes there is, it is right there when you approve the suggested scheme, :
From:https://debian-handbook.info/browse/sta ... steps.htmlAfter choosing the type of partition, the software calculates a suggestion, and describes it on the screen; the user can then modify it if needed. You can, in particular, choose another filesystem if the standard choice (ext4) isn't appropriate. In most cases, however, the proposed partitioning is reasonable and it can be accepted by selecting the “Finish partitioning and write changes to disk” entry.
Also see the image they use, I also included it in my previous post.
Apparently you did not really read them, and your original question was not about " What is the default swap partitioning scheme ? " Also, you seem to choose to ignore my request that you use code boxes,..it makes it easier to read the output you show.
Please re-read the link to the Debian wiki, I will quote part, but you need to read it all,..
From:https://wiki.debian.org/SwapInformation and considerations related to the amount of swap to use

The recommended amount of swap space has traditionally been double the amount of system memory. This has changed over time to one and half times system memory, both answers are decent baselines but are becoming less and less useful answers to the question as time passes. There are many variables about your system and intended use that will determine the available system swap you will want to have.
IF you use the guided partitioning, that is decided by the installer based on the baselines mentioned, (more details on the wiki).
"supusr" I have not stated that I expected a swap file or a swap partition, only that I would like to know the default swap process

But your question implies you are expecting swap file ?
So, it looks like I have a swap partition of about 1G (?) and no swap file?
There is NO set default process, the size of the swap partition will automatically decided by the installer, based on the amount of memory the HD has,... PLEASE read the install documentation, also I all read did tell you this, and the documentation is much better written, any way , PLEASE read it.
If you do not want a swap partion:
In order for the installer not to format a swap partition, it must manually be marked "Do not use" during partitioning. The installer will format any swap partition not marked "Do not use" and use it for swap space on the installed system
OR also if you want a specific size, then you MUST use the manual partitioning method.
From: https://debian-handbook.info/browse/sta ... steps.htmlThe partitioning step is traditionally difficult for new users. It is necessary to define the various portions of the disks (or “partitions”) on which the Linux filesystems and virtual memory (swap) will be stored. This task is complicated if another operating system that you want to keep is already on the machine. Indeed, you will then have to make sure that you do not alter its partitions (or that you resize them without causing damage).
Fortunately, the partitioning software has a “guided” mode which recommends partitions for the user to make — in most cases, you can simply validate the software's suggestions.
There are more screen shots, to help explain,....please do not try to tell me you read it, obviously you did not, it is very detailed,
4.2.13.2. Manual Partitioning
Manual partitioning allows greater flexibility, allowing the user to choose the purpose and size of each partition. Furthermore,----snip---------
I also suggest that you read some of the other Debian documentation, it is not recommended that new users use the SID and Testing branch of Debian, for various reasons,...we expect someone that is using the testing or SID releases would know these basic things, and know how to do some simple searches to find common information,....I need to do that myself, especially since I am not a "sudoer" or "super user",.. have a good day, and I apologize for not being able to answer your many questions, .... I suppose I should not have even tried. Use some logic :
Did it automatically install a swap partition or a swap file?
Obviously it did, unless you created it :
but my conky display shows some swap is available.
===
So, it looks like I have a swap partition of about 1G (?) and no swap file?

Is this, then, the installation default?

Again, I must remind my self , use some logic,... I missed these hints at first, well, unless you added , modified, or resized what was created when you installed, then obviously that is the installation default,
gee whiz, I should have realized,.....ok, well the joke is on me, and it was fun,...it was real, and it was nice, but by no means was it real nice,... funny games people play. I Looooove it :mrgreen:
Last edited by cuckooflew on 2020-06-08 16:41, edited 1 time in total.
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!

cuckooflew
Posts: 677
Joined: 2018-05-10 19:34
Location: Some where out west
Been thanked: 1 time

Re: Swap File/Swap Partition

#7 Post by cuckooflew »

Head_on_a_Stick wrote:
supusr wrote:swapon -s shows no such bash command exists
http://forums.debian.net/viewtopic.php?f=16&t=142973
Should have done this before trying to answer:
Funny guy/gal we have here:
http://forums.debian.net/viewtopic.php? ... 28#p721128

[Solved] UFW Not Behaving Properly

Postby supusr » 2020-05-20 20:59
I have installed ufw, but when I try to enable it in the terminal as root I get: bash: ufw: command not found
I have tried uninstalling and reinstalling, to no avail. Any ideas?
Then either read or just scroll down to:
http://forums.debian.net/viewtopic.php? ... 28#p721073
Yes it does work as root, but using "sudo" works as well, it did not work as root, because you did not use 'su -' , just using 'su' does not put you in the correct path to correctly,
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!

sbellone
Posts: 2
Joined: 2022-01-07 16:56

Re: Swap File/Swap Partition

#8 Post by sbellone »

cuckooflew wrote: 2020-06-08 15:58 Geez, another one of these,....
Of these what? :/ I too, when I reinstalled debian after more than 10 years faced that kind of issues. A long time ago we were just learning "to go root, use su". It's impossible to re-read all man pages in a timely manner..
cuckooflew wrote: 2020-06-08 15:58 Yes there is, it is right there when you approve the suggested scheme, :
Well like supusr, I'm not entirely satisfied by what is written there. You've quoted it yourself: "In most cases, however, the proposed partitioning is reasonable and it can be accepted"
And like supusr, I trusted that and went ahead... Only to have severe performance issues a few weeks later: my machine has 16Go of RAM, and 1Go of swap is not enough we "modern" tools. Firefox itself by default consumes a LOT of it, adds to this a full dev environment including some hungry-for-RAM TypeScript tools and suddenly your whole machine freezes until the OS manages to kill something :(
cuckooflew wrote: 2020-06-08 15:58 Please re-read the link to the Debian wiki, I will quote part, but you need to read it all,..
I've read that too, but it's completely out-of-date. Most content is from 10 years ago, and what you've quoted doesn't seem to be used anymore in recent installs: "one and half times system memory,"
It seems to be far less nowadays, and actually when searching online it even seems to be a fixed 1Go:
- on my machine (512 SSD / 16 RAM) it was 1Go
- on this user's machine (1To HDD / 8 RAM) it was also 1Go :o https://lists.debian.org/debian-user/20 ... 00264.html
cuckooflew wrote: 2020-06-08 15:58 There is NO set default process, the size of the swap partition will automatically decided by the installer, based on the amount of memory the HD has,... PLEASE read the install documentation, also I all read did tell you this, and the documentation is much better written, any way , PLEASE read it.
But I think our question (at least mine when I arrived on this thread) is more HOW it is decided. Based on what I said above, it seems to be a fixed 1Go, which doesn't look great to me.
The documentation only explains quickly what swap is, but I would love to have more info about modern recommendations (8/16/32Go RAM, SSD, depending on the usage, ...)
Another doc still recommends to use the same amount of swap than we have memory: https://www.debian.org/releases/bullsey ... 03.en.html
cuckooflew wrote: 2020-06-08 15:58 I also suggest that you read some of the other Debian documentation, it is not recommended that new users use the SID and Testing branch of Debian, for various reasons,...we expect someone that is using the testing or SID releases would know these basic things
You could be right, but here this sounds a bit like bashing afterwards, because here we are, 1.5 years later and this default scheme is in the Stable branch, with still no more explanations, hitting regular users like me :| (that's the kind of things that keep Linux away from even more normal users).

To sum-up, sorry to bump the thread, but I wanted to highlight that everything is not that obvious for everyone, especially when the docs are not in sync with the installer, and for people arriving on this thread, that some interesting recent info are on this thread: https://lists.debian.org/debian-user/20 ... 00258.html
Best,

User avatar
sunrat
Administrator
Administrator
Posts: 6771
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 122 times
Been thanked: 543 times

Re: [Solved] Swap File/Swap Partition

#9 Post by sunrat »

No point talking to cuckooflew, he abandoned the nest some time ago.
You are right though, I've heard guided partitioning in the installer doesn't set up partitions optimally for some use cases. Can't confirm though as I always have used manual partitioning.
I use and recommend 4GB for swap, more if you use hibernation. With 16GB RAM the only time I ever saw swap used go a lot over several hundred MB was when doing video recoding of a whole TV series and even then only 6GB RAM was used.

Also I'm curious - in what language is "Go" used instead of the almost universal "GB"? I've noticed it in a few posts. :?
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: [Solved] Swap File/Swap Partition

#10 Post by p.H »

"o" stands for "octet". It is commonly used in french, but also exists in english and should be used instead of "byte" which does not universally mean "8 bits". There have been bytes of less or more than 8 bits.
https://en.wikipedia.org/wiki/Byte

I can confirm that guided partitioning sucks big time, even worse since it has been decided to set a fixed swap size of 1 Go, which makes hibernation impossible on some systems.

CwF
Global Moderator
Global Moderator
Posts: 2813
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 48 times
Been thanked: 221 times

Re: [Solved] Swap File/Swap Partition

#11 Post by CwF »

I still think it should be two check boxes to decide;
Enable hibernate y/n
Enable zramswap y/n
for neither, one, both.

Post Reply