r/linuxmint • u/tamburasi • 1d ago
Discussion What would the ideal partitioning scheme for Mint look like?
I’ve just had a discussion...Under Mint 27 there’s apparently no swap partition...just a swapfile which should be the size of the RAM plus a 2 GB buffer. Is it a problem if I create a swap file of 18 GB? I think it’s better for swap to have its own partition rather than a swap file in the root directory or am I missing something here?
Also I’d like to know if there’s a problem with setting the EFI partition to 1 GB?
6
Upvotes
6
u/tuvaniko 23h ago
There is zero performance benefit to a separate swap partition, but it becomes a heak of alot harder to adjust swap size if you use a partition. The only advantage is really if you are dual booting multiple Linux distros on one drive. Then they can share the swap.
You can make your swap file as big or small as you want, but I would recommend using zswap first so your computer will more efficiently use the RAM you have before messing with large swaps. if your swap is smaller than your ram you can't hibernate.
The EFI partition only needs to large enough to hold your bootloader.
3
u/friendlyreminder_ 23h ago
If it's a large drive its best to set the EFI partition to 4gb. Mint won't use any of that space, it uses only a few mb, but other distros do. It makes distro hopping easier if youd ever want to switch in the future.
As for swap file vs partition it's up to you. Doesn't really matter.
What I would recommend however is turning on zswap. The archwiki has a guide on how to do that. It compresses data in RAM so you have to swap to disk less often. There's no reason not to use it, it's strictly superior to only relying on disk swap.
4
u/Due-Result7928 20h ago
swap partition were good before ssd to diminish fractionning. a swap file is now a better option.
2
u/rbmorse 23h ago
I agree with r/tuvaniko, but for the record I'm using the 27 beta with a swap partition and it works just fine. You just set it up like any other partition after selecting manual partitioning from the previous screen.
If you don't have an existing swap partition, you can use gparted option to create one before running the partition setup. Make the appropriate entry in the popup (select linux-swap as the filesystem and swap for the partition label).
2
u/_Lost-In-The-Weeds_ LMDE7 Cinnamon 22h ago edited 21h ago
I have a swap partition in Mint 27 beta
Swapoff -a then delete the swapfile. Add your swap partition to fstab.
2
u/dumplank 22h ago
You can always switch from swap file to swap partition and vice versa. Many Linux distributions today choose swap file over swap partition because it is easier to resize later.
1
u/rarsamx 2h ago
This is one of the many situations where there is no "ideal". For me the ideal partition is one partition for EFI and another btrfs partition with subvolumes and a swap file without COW.
2
u/BenTrabetere 22h ago
Linux Mint has defaulted to a swap file since 19.0, and that is what I recommend people use. Since the swap file is dynamic and grows/shrinks according to need, It makes better use of disk space than a partition with a fixed size.
As for the starting size, the default is 2GiB and that should be enough for a system with 8 GiB RAM. Unless....
According to the announcements Linux Mint 27 is bringing back hibernation, and it will offer three modes: Standard Suspend, Hybrid Sleep, and Suspend-then-Hibernate. I do not feel comfortable making recommendations on how to set up and use hibernation until I know more about the LM27 hibernation modes and their requirements.
My gut says the starting point for a swap file should be 1.5x-2x physical RAM and a partition should be at least 2x physical RAM - but I do not like to rely on my gut for this sort of jiggery pokery.
2
u/activedusk 21h ago edited 21h ago
If using low power modes size it 2x memory. If not keep it at default value.
Assume hibernation and most of the RAM is used, 1x memory plus surplus for swap. Some might say 1.5x but there are always unexpected situations, there is no point above 2x memory. Translation for 16GB, make swap 32 GB. If you no low power mode, search zswap or zram.
2
u/don-edwards Linux Mint 22.3 18h ago
Easy one first: if you can put the EFI partition at either the beginning or the end of its device, 32 megabytes - rather less than one gigabyte - is sufficient for booting Linux Mint.
If you're dual-booting with Windows and have the two OSes sharing an EFI partition (bad idea: Windows updates will occasionally tell the system to boot Windows first out of that partition, and it doesn't offer a menu like grub does), or if you're distro-hopping in one EFI partition, then go larger. However it's generally better for each OS to have its own EFI partition.
Gparted, as of the last time I checked, will not move or resize a FAT partition smaller than 256 MB. So if you can't put the EFI partition at one end of the device, make it that large or larger.
---
Another easy one: external backup devices. On each one install Ventoy letting it have the entire device. Then delete the Ventoy partition, create a new FAT partition of 32 to 100 GB labelled VENTOY, and in the remaining space create a BTRFS partition - same label on all the backup devices. On the latter create a folder where all your backups will go. Then execute this command:
sudo btrfs property set {path to that folder} compression zstd:15And finally copy some bootable ISO files into the Ventoy partition, and point your backup software at the designated folder. You can tell the system to mount the backup and VENTOY partitions by label, rather than UUID, so good backup software won't care which of those devices is mounted. (Never mount external devices by device name as these names aren't stable).
(If you boot from a device set up with Ventoy, it presents a menu of all the bootable ISO files it finds in the VENTOY partition and lets you pick which one to boot from. So the above layout means you can boot, install the OS, and restore your data, all from one device.)
---
Now the harder ones.
Swap file versus partition: of course, the ideal answer is to have so much memory you never need any swap. However that isn't always feasible. Looking over the comparative advantages versus disadvantages, I'd favor a swap file. Mainly because it's more flexible. However it's perfectly acceptable to have both a swap partition and swap files.
In fact there's a program in the repository, "swapspace", that will automatically create and delete swap files for you as the load on your memory varies, so you don't even have to guess how much swap space you need. Note, I DO NOT KNOW if this will be sufficient, or used at all, for hibernating.
Special note: you'll find many suggestions to consider turning on "zram" which is built into the kernel. DO NOT combine this with a swap file or partition; it will either make the latter pointless, or decrease system performance as compared to not using zram. Instead, install and turn on "zswap". The difference: zram creates a compressed swapfile in RAM, and once that is full what goes to disk is what's most recently swapped out - and therefore likely to be needed soonest; zswap instead creates a compressed buffer and actively manages moving stuff from that buffer to disk, choosing the least recently used which is likely to remain unused the longest.
(I don't know if zswap works with no disk swap space at all, but it works just fine with the aforementioned "swapspace" program and no permanent disk swap space.)
---
Separate home partition: if you're cramped for space, then no. You don't want to run out of space in your home partition while there's still space in your system partition, or (worse) vice versa. But otherwise... there are good arguments both ways. I prefer having it separate, and so far that hasn't caused me any problems.
---
Partition formats: FAT (all versions) and NTFS are generally dis-recommended. FAT is required for EFI partitions and the VENTOY partition, and sharing with certain external devices such as cameras and phones. Also for sneakernet to unknown devices. NTFS is good for sharing with Windows, either dual-boot, across a network, or sneakernet. Otherwise, avoid them.
BTRFS I like for the system partition, due to the speed of BTRFS snapshots. Nearly instantaneous. A new snapshot takes nearly no space. So no excuse for not having a current one. Restores are similarly fast (does require reboot though). They provide a fallback after a buggy update or most idiot-administrator moments (which we all have occasionally). However, they do not provide any protection against anything that makes the partition unreadable. Such as formatting the wrong partition, or device failure, or a thief stealing your computer. So also have external backup.
Either BTRFS or EXT4 for everything not already covered, unless you have some specific reason for choosing something else. A few other formats, such as VFS, are also good but rather more technical. The typical home user doesn't need to combine multiple devices into a single partition...
Drive encryption: so far, I vote no.
Cloud storage: I vote no. I've thought about using it with local encryption provided by something other than the cloud-storage drivers, but so far haven't seen it as worth the effort.
1
u/loomynartylenny 20h ago
Just don't forget to make separate partitions for
/and/home