Arg. the Install did not default a swap partition so I forgot to work it in when I divided the drive as I wanted...
I am using EXT4 for my / /boot /home partitions. Just plain partitioning. Been doing it this way for lots of builds.
But this time, I missed setting aside 16Gb as a physical swap partition, added to the memory swap. This system only has 16Gb memory, so the virtual swap starts out at 8Gb.
Since /dev/sdb4, /home is the last 800Gb with 500Gb unused, is there any way to safely shrink this partition 16Gb and then allocate that as swap?
thanks
On Wed, 2025-02-26 at 16:17 -0500, Robert Moskowitz wrote:
Arg. the Install did not default a swap partition so I forgot to work it in when I divided the drive as I wanted...
I am using EXT4 for my / /boot /home partitions. Just plain partitioning. Been doing it this way for lots of builds.
But this time, I missed setting aside 16Gb as a physical swap partition, added to the memory swap. This system only has 16Gb memory, so the virtual swap starts out at 8Gb.
Since /dev/sdb4, /home is the last 800Gb with 500Gb unused, is there any way to safely shrink this partition 16Gb and then allocate that as swap?
You don't need a swap partition. It's simple to create a swap file ('man mkswap'). In fact before I upgraded my RAM to 32GB I got by with just zram (which is compressed and much faster than a hard drive), but YMMV of course. If zram is enough, the only time you actually need swap on secondary storage is if you want to hibernate (not suspend) your system.
poc
On 2/26/25 5:21 PM, Patrick O'Callaghan wrote:
On Wed, 2025-02-26 at 16:17 -0500, Robert Moskowitz wrote:
Arg. the Install did not default a swap partition so I forgot to work it in when I divided the drive as I wanted...
I am using EXT4 for my / /boot /home partitions. Just plain partitioning. Been doing it this way for lots of builds.
But this time, I missed setting aside 16Gb as a physical swap partition, added to the memory swap. This system only has 16Gb memory, so the virtual swap starts out at 8Gb.
Since /dev/sdb4, /home is the last 800Gb with 500Gb unused, is there any way to safely shrink this partition 16Gb and then allocate that as swap?
You don't need a swap partition. It's simple to create a swap file ('man mkswap'). In fact before I upgraded my RAM to 32GB I got by with just zram (which is compressed and much faster than a hard drive), but YMMV of course. If zram is enough, the only time you actually need swap on secondary storage is if you want to hibernate (not suspend) your system.
poc
OK, I SHOULD have remembered that.
I thought that zram was now "built in" and that is why I am seeing:
$ free total used free shared buff/cache available Mem: 15616836 8473060 2279808 149220 5348312 7143776 Swap: 8388604 768 8387836
# zramctl NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT /dev/zram0 lzo-rle 8G 60K 12.9K 204K 4 [SWAP]
I did nothing to set up this zram swap and no swap partition is showing in /etc/fstab
Use zram until you REALLY need the memory for active apps (and with only 16GB that does happen), then bleed over to the physical swap. Or if you run out of battery on the flight because the outlets don't work then for hibernation.
Where is the settings for zram?
thanks
On 2/26/25 13:17, Robert Moskowitz wrote:
Arg. the Install did not default a swap partition so I forgot to work it in when I divided the drive as I wanted...
<snip/>
Since /dev/sdb4, /home is the last 800Gb with 500Gb unused, is there any way to safely shrink this partition 16Gb and then allocate that as swap?
It's been years since I did this but if you're game...
umount /dev/sda4
resize2fs (current size -8G) /dev/sda4
fdisk /dev/sda
delete sda4 new partition sda4 (previous size -8G) w(rite) q(uit)
** this works because deleting a partition doesn't touch the data, only the partition table. When you create the new, smaller smaller partition it will use the same blocks that contain the original resized filesystem.
Now create /dev/sda5 8G type swap.
Caveat: back up /home! use at your own risk! YMMV! This email is not from me!
Mike Wright
On 2/26/25 17:30, Mike Wright wrote:
On 2/26/25 13:17, Robert Moskowitz wrote:
Arg. the Install did not default a swap partition so I forgot to work it in when I divided the drive as I wanted...
<snip/> > > Since /dev/sdb4, /home is the last 800Gb with 500Gb unused, is there > any way to safely shrink this partition 16Gb and then allocate that as > swap? >
Dag nabbit! Replace 8G with 16G everywhere you find it ;/
On 2/26/25 8:34 PM, Mike Wright wrote:
On 2/26/25 17:30, Mike Wright wrote:
On 2/26/25 13:17, Robert Moskowitz wrote:
Arg. the Install did not default a swap partition so I forgot to work it in when I divided the drive as I wanted...
<snip/> > > Since /dev/sdb4, /home is the last 800Gb with 500Gb unused, is there > any way to safely shrink this partition 16Gb and then allocate that > as swap? >
Dag nabbit! Replace 8G with 16G everywhere you find it ;/
:)
Mike,
Your posts gave me a couple smiles this evening!
I am making a note in my install steps file to remember NEXT time (Fedora 43?) to create a swap partition, but I will just make do with a swap file this time.
Sounds exciting what you say to do. Exciting I don't need right now!
On Wed, 2025-02-26 at 21:00 -0500, Robert Moskowitz wrote:
I am making a note in my install steps file to remember NEXT time (Fedora 43?) to create a swap partition, but I will just make do with a swap file this time.
IMO there's really no point. A swapfile is much more flexible and for most workloads probably just as fast. The only caveat is that if you want to use hibernation you may have to jump through some additional hoops as it used to be a bit complicated with BTRFS but apparently is now easier. Ext4 shouldn't be a problem I think.
poc
On 2/27/25 7:02 AM, Patrick O'Callaghan wrote:
On Wed, 2025-02-26 at 21:00 -0500, Robert Moskowitz wrote:
I am making a note in my install steps file to remember NEXT time (Fedora 43?) to create a swap partition, but I will just make do with a swap file this time.
IMO there's really no point. A swapfile is much more flexible and for most workloads probably just as fast. The only caveat is that if you want to use hibernation you may have to jump through some additional hoops as it used to be a bit complicated with BTRFS but apparently is now easier. Ext4 shouldn't be a problem I think.
So you are saying is that I am carrying a caveat avoidance step from releases ago and now things just work right.
Well since now I will be using a swap file, and I do get cases of hibernation, I will see how well it does or does not work...
Always something to keep life interesting!
Meanwhile ebay just notified me that the x131e I purchased for $35 (no harddrive, but I go lots) will be delivered today and I can start testing out making a tamper evident CA using QR codes for the data transfer. Then update my Internet Draft of draft-ietf-drip-dki to explain this and get the policy OID for the CA certs from ICAO for such a CA for use in UAS applications. And stay compliant with the ICAO Cert Policy we have been trying to finish to publish for the past year.
What I am really being paid to do.... :)
On Thu, 2025-02-27 at 08:16 -0500, Robert Moskowitz wrote:
IMO there's really no point. A swapfile is much more flexible and for most workloads probably just as fast. The only caveat is that if you want to use hibernation you may have to jump through some additional hoops as it used to be a bit complicated with BTRFS but apparently is now easier. Ext4 shouldn't be a problem I think.
So you are saying is that I am carrying a caveat avoidance step from releases ago and now things just work right.
Well since now I will be using a swap file, and I do get cases of hibernation, I will see how well it does or does not work...
Hibernation has to be configured, e.g. in order to tell Grub how to find the saved system image (this is true even when using a separate swap partition). A web search will throw up plenty of HowTo docs, but Fedora is a moving target so be aware that some of them (especially regarding BTRFS) may be out of date.
poc