[Software] How to know if my swap partition is big enough?

If none of the specific sub-forums seem right for your thread, ask here.
Message
Author
Enigma83
Posts: 155
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 5 times

Re: [Software] How to know if my swap partition is big enough?

#21 Post by Enigma83 »

CwF wrote: 2024-06-25 03:52
Enigma83 wrote: 2024-06-25 02:39 You trying to be funny? If so, I'm quite difficult to humor
Yes, of course.
Text 'is quite difficult to humor'
KVM+QEMU+libvirt+Virt Manager is quite the mouthful. A few post back, after typing out various combinations in various orders for years, I decided to be simple and simply use 'libvirt' to refer to this 'ball of wax'. It is the core for the most part.
Just saying I use libvirt is too simplistic. It's the power behind Virt Manager, along with the KVM kernel component. But there are numerous ways to go about setting up a VM on Linux. I could go QEMU standalone, without either KVM or libvirt. Or I could combine QEMU with them to make it more powerful. Or I could use libvirt alone. You already know this, but Virt Manager is just a GUI frontend, it cant do anything without the other pieces. It just simplifies the process of VM creation. But someone who wanted to set up a VM via CLI only would probably avoid Virt Manager. I doubt it can do anything that cant be done through commands.

Say what you mean, mean what you say, is my approach to talking about anythjng. If you're using just libvirt, fine, it's all you need to mention. But for more precision, it's better to go into detail.

friendlysalmon88
Posts: 186
Joined: 2023-12-08 16:48
Location: Seattle,Wa USA
Has thanked: 7 times
Been thanked: 12 times

Re: [Software] How to know if my swap partition is big enough?

#22 Post by friendlysalmon88 »

I used to sware buy using a swap partition however, I've now fully embraced the use of a swapfile instead. My rule is to divide your total physical ram by 2. For example I have 16GB physical memory so I run with an 8 GB swap file as I don't do a lot of heavy compiling and programming-related stuff.

Enigma83
Posts: 155
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 5 times

Re: [Software] How to know if my swap partition is big enough?

#23 Post by Enigma83 »

friendlysalmon88 wrote: 2024-06-25 04:07 I used to sware buy using a swap partition however, I've now fully embraced the use of a swapfile instead. My rule is to divide your total physical ram by 2. For example I have 16GB physical memory so I run with an 8 GB swap file as I don't do a lot of heavy compiling and programming-related stuff.
Swap files don't work on all filesystems. And, being a file, they're more likely to fragment. A swap partition doesn't have a filesystem, just the swap partition type which nothing else can use and no files can be stored on it, so fragmentation isn't an issue. But a swap file is probably easier to dynamically resize. I've mostly seen swap partitions being recommended vs swap files.

User avatar
wizard10000
Global Moderator
Global Moderator
Posts: 1292
Joined: 2019-04-16 23:15
Location: southeastern us
Has thanked: 132 times
Been thanked: 232 times

Re: [Software] How to know if my swap partition is big enough?

#24 Post by wizard10000 »

Enigma83 wrote: 2024-06-25 10:25I've mostly seen swap partitions being recommended vs swap files.
I'd resisted swapfiles for quite a few years and a lot of people still do. IMO swapfiles are still kind of a hack because the kernel expects to be talking to a block device. But - I think most folks create their swapfile right after install so not sure I agree on the fragmentation issue, which would only be an issue on a mechanical drive.

You're right that not all filesystems support a swapfile and it can make hibernation challenging and the textbook way to do it would be to use a swap partition. I'm exploring reducing the amount of disk-based swap I use and that's a whole lot easier to do with a file than it would be with a partition :)
we see things not as they are, but as we are.
-- anais nin

Enigma83
Posts: 155
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 5 times

Re: [Software] How to know if my swap partition is big enough?

#25 Post by Enigma83 »

wizard10000 wrote: 2024-06-25 10:37
Enigma83 wrote: 2024-06-25 10:25I've mostly seen swap partitions being recommended vs swap files.
I'd resisted swapfiles for quite a few years and a lot of people still do. IMO swapfiles are still kind of a hack because the kernel expects to be talking to a block device. But - I think most folks create their swapfile right after install so not sure I agree on the fragmentation issue, which would only be an issue on a mechanical drive.

You're right that not all filesystems support a swapfile and it can make hibernation challenging and the textbook way to do it would be to use a swap partition. I'm exploring reducing the amount of disk-based swap I use and that's a whole lot easier to do with a file than it would be with a partition :)
What filesystem's do you use for root/home? Ext4? I'm on that right now, it's stable but not optimized for SSDs. I'm considering f2fs or btrfs.

User avatar
None1975
df -h | participant
df -h | participant
Posts: 1560
Joined: 2015-11-29 18:23
Location: Russia, Kaliningrad
Has thanked: 63 times
Been thanked: 93 times

Re: [Software] How to know if my swap partition is big enough?

#26 Post by None1975 »

Enigma83 wrote: 2024-06-25 11:17
What filesystem's do you use for root/home? Ext4? I'm on that right now, it's stable but not optimized for SSDs. I'm considering f2fs or btrfs.
Ext4 is stable as hell. This file system is perfectly fine for SSDs. BTRFS is terribly slow.
OS: Debian 12.4 Bookworm / DE: XFCE
Debian Wiki | DontBreakDebian, My config files on github

User avatar
wizard10000
Global Moderator
Global Moderator
Posts: 1292
Joined: 2019-04-16 23:15
Location: southeastern us
Has thanked: 132 times
Been thanked: 232 times

Re: [Software] How to know if my swap partition is big enough?

#27 Post by wizard10000 »

Enigma83 wrote: 2024-06-25 11:17What filesystem's do you use for root/home? Ext4? I'm on that right now, it's stable but not optimized for SSDs. I'm considering f2fs or btrfs.
I use ext4 but it's been years since I used a separate /home partition. I'm pretty anal about backups and can restore home from more than one location in about ten minutes so for me the added complexity just gets in the way. I've run the same distribution for close to 15 years so pretty sure distrohopping isn't happening anytime soon :)

On alternate filesystems, I used ReiserFS years ago but quit doing that when Hans Reiser went to prison. These days I don't really have an overpowering reason to *not* use ext4. One 500MB EFI partition and ext4 for the rest of the disk :)
we see things not as they are, but as we are.
-- anais nin

Enigma83
Posts: 155
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 5 times

Re: [Software] How to know if my swap partition is big enough?

#28 Post by Enigma83 »

wizard10000 wrote: 2024-06-25 12:13
Enigma83 wrote: 2024-06-25 11:17What filesystem's do you use for root/home? Ext4? I'm on that right now, it's stable but not optimized for SSDs. I'm considering f2fs or btrfs.
I use ext4 but it's been years since I used a separate /home partition. I'm pretty anal about backups and can restore home from more than one location in about ten minutes so for me the added complexity just gets in the way. I've run the same distribution for close to 15 years so pretty sure distrohopping isn't happening anytime soon :)

On alternate filesystems, I used ReiserFS years ago but quit doing that when Hans Reiser went to prison. These days I don't really have an overpowering reason to *not* use ext4. One 500MB EFI partition and ext4 for the rest of the disk :)
I like to compartmentalize and separate my partitions to fit how I will use them. Every partition I create has its' own discrete purpose. I've gone pretty crazy with partition layouts. I do believe GPT can hold up to 128 partitions, so that's plenty of breathing room.

User avatar
wizard10000
Global Moderator
Global Moderator
Posts: 1292
Joined: 2019-04-16 23:15
Location: southeastern us
Has thanked: 132 times
Been thanked: 232 times

Re: [Software] How to know if my swap partition is big enough?

#29 Post by wizard10000 »

Enigma83 wrote: 2024-06-25 12:25I like to compartmentalize and separate my partitions to fit how I will use them. Every partition I create has its' own discrete purpose. I've gone pretty crazy with partition layouts. I do believe GPT can hold up to 128 partitions, so that's plenty of breathing room.
Then BTRFS may be a good fit for you - it'd make it a whole lot easier to adjust subvolumes if you need to :)
we see things not as they are, but as we are.
-- anais nin

Enigma83
Posts: 155
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 5 times

Re: [Software] How to know if my swap partition is big enough?

#30 Post by Enigma83 »

wizard10000 wrote: 2024-06-25 12:34
Enigma83 wrote: 2024-06-25 12:25I like to compartmentalize and separate my partitions to fit how I will use them. Every partition I create has its' own discrete purpose. I've gone pretty crazy with partition layouts. I do believe GPT can hold up to 128 partitions, so that's plenty of breathing room.
Then BTRFS may be a good fit for you - it'd make it a whole lot easier to adjust subvolumes if you need to :)
But you say it's a big hit on performance? Not good for SSDs? Surely if it sucks for SSDs, then it cant be any better for HDDs.

User avatar
wizard10000
Global Moderator
Global Moderator
Posts: 1292
Joined: 2019-04-16 23:15
Location: southeastern us
Has thanked: 132 times
Been thanked: 232 times

Re: [Software] How to know if my swap partition is big enough?

#31 Post by wizard10000 »

Enigma83 wrote: 2024-06-25 12:44But you say it's a big hit on performance? Not good for SSDs? Surely if it sucks for SSDs, then it cant be any better for HDDs.
I think somebody else said that as I've never used BTRFS :)

My heartburn with BTRFS is actually pretty simple - it's Yet Another Layer between my data and the kernel so I imagine there's some performance hit but I have no idea what kind of a hit that would be.
we see things not as they are, but as we are.
-- anais nin

Enigma83
Posts: 155
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 5 times

Re: [Software] How to know if my swap partition is big enough?

#32 Post by Enigma83 »

wizard10000 wrote: 2024-06-25 12:47
Enigma83 wrote: 2024-06-25 12:44But you say it's a big hit on performance? Not good for SSDs? Surely if it sucks for SSDs, then it cant be any better for HDDs.
I think somebody else said that as I've never used BTRFS :)

My heartburn with BTRFS is actually pretty simple - it's Yet Another Layer between my data and the kernel so I imagine there's some performance hit but I have no idea what kind of a hit that would be.
If you're looking at it that way, then an OS is yet another layer between you and your hardware. And yet you need it to interact with the hardware. An OS is just an abstraction in software to interface with hardware. But it's still a middleman nonetheless. Surely there must be some penalty, however small, to have to use this software to make your hardware useful. It's all just a matter of how much of a hit you can accept. If neglible, fine, it's a necessary evil.

User avatar
wizard10000
Global Moderator
Global Moderator
Posts: 1292
Joined: 2019-04-16 23:15
Location: southeastern us
Has thanked: 132 times
Been thanked: 232 times

Re: [Software] How to know if my swap partition is big enough?

#33 Post by wizard10000 »

Enigma83 wrote: 2024-06-25 12:51If you're looking at it that way, then an OS is yet another layer between you and your hardware. And yet you need it to interact with the hardware. An OS is just an abstraction in software to interface with hardware. But it's still a middleman nonetheless. Surely there must be some penalty, however small, to have to use this software to make your hardware useful. It's all just a matter of how much of a hit you can accept. If neglible, fine, it's a necessary evil.
I don't disagree - for my own use case this particular evil is a bit less than necessary but not everybody does things the same way I do even though they should - it would certainly make my life easier :mrgreen:
we see things not as they are, but as we are.
-- anais nin

Enigma83
Posts: 155
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 5 times

Re: [Software] How to know if my swap partition is big enough?

#34 Post by Enigma83 »

wizard10000 wrote: 2024-06-25 12:58
Enigma83 wrote: 2024-06-25 12:51If you're looking at it that way, then an OS is yet another layer between you and your hardware. And yet you need it to interact with the hardware. An OS is just an abstraction in software to interface with hardware. But it's still a middleman nonetheless. Surely there must be some penalty, however small, to have to use this software to make your hardware useful. It's all just a matter of how much of a hit you can accept. If neglible, fine, it's a necessary evil.
I don't disagree - for my own use case this particular evil is a bit less than necessary but not everybody does things the same way I do even though they should - it would certainly make my life easier :mrgreen:
Sorry, but it's not your right to decide how others "should" do things. Just because they dont do it like you doesnt necessarily make you right and them wrong. Anyone that believes their way is the only way, are quite frankly full of themselves, even if it turns out they're right. That is the realm of things like Christianity.

I prefer to treat other adults as generally competent and able to make their own decisions. Whether I think they're right or wrong makes no difference in the bigger scheme of things, it's just an opinion. I'm not qualified to be the judge of right and wrong, and I dont think anyone is. But for the sake of keeping working societes, we do have to have individuals appointed to judge, make decisions, etc. A justice of the courts, a police officer, govt officials, regulatory types, forum admins/mods, on and on.

User avatar
wizard10000
Global Moderator
Global Moderator
Posts: 1292
Joined: 2019-04-16 23:15
Location: southeastern us
Has thanked: 132 times
Been thanked: 232 times

Re: [Software] How to know if my swap partition is big enough?

#35 Post by wizard10000 »

That was a joke, honest :)
we see things not as they are, but as we are.
-- anais nin

DebianFox
Posts: 204
Joined: 2024-05-05 14:11
Has thanked: 26 times
Been thanked: 15 times

Re: [Software] How to know if my swap partition is big enough?

#36 Post by DebianFox »

Enigma83 wrote: 2024-06-25 11:17
What filesystem's do you use for root/home? Ext4? I'm on that right now, it's stable but not optimized for SSDs. I'm considering f2fs or btrfs.
@Enigma83 what are the reasons for ext4 not being optimized for SSDs? Also F2FS (i.e. Flash-Friendly File System) has some well known issues.

Post Reply