[Bug 2031345] Re: FFE+SRU: Add recreating the swap file if the current size is sufficiently larger
Launchpad Bug Tracker
2031345 at bugs.launchpad.net
Thu Aug 31 10:50:51 UTC 2023
This bug was fixed in the package ec2-hibinit-agent - 1.0.0-0ubuntu16
---------------
ec2-hibinit-agent (1.0.0-0ubuntu16) mantic; urgency=medium
* d/p/lp2031345-recreate-swap-file.patch: Recreate the SWAP file if instance
type changes (LP: #2031345)
-- Mitchell Dzurick <mitchell.dzurick at canonical.com> Mon, 28 Aug 2023
07:23:22 -0700
** Changed in: ec2-hibinit-agent (Ubuntu)
Status: Triaged => Fix Released
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to ec2-hibinit-agent in Ubuntu.
https://bugs.launchpad.net/bugs/2031345
Title:
FFE+SRU: Add recreating the swap file if the current size is
sufficiently larger
Status in ec2-hibinit-agent package in Ubuntu:
Fix Released
Bug description:
Upstream Change - https://github.com/aws/amazon-ec2-hibinit-
agent/commit/d2ce783d10d3a4437ebac468ed669666d8b6671b
[FFE]
====
This change includes a small bugfix to resize the swap partition. On hibernation, the contents of RAM is put onto SWAP, so if a user changes the amount of RAM on an instance, SWAP potentially needs to be recreated.
[SRU]
====
[Impact]
If an AWS EC2 user increases the amount of RAM on an instance, hibernation will fail.
This update dynamically allocates the SWAP to the necessary amount for
the user. This has the added benefit of downsizing SWAP on RAM
reduction thus optimizing disk space in those scenarios.
[Test Case]
1. create & start a c5.xlarge instance.
2. Upgrade to the new ec2-hibinit-agent package.
3. Stop the instance.
4. Modified to a smaller instance (c5.large)
5. `journalctl -b | grep "Swap already exists!"` verify swap is recreated
Aug 04 18:19:03 ip-172-31-22-174.ec2.internal hibinit-agent[2457]: Swap already exists! (have 8011616256, need 4194304000), deleting existing swap file /swap since current swap is sufficiently large and wasting memory
7. Stop and restart the instance again
8. `journalctl -b | grep "There's sufficient swap available"` to verified no recreation. of swap occured.
Aug 04 18:23:17 ip-172-31-22-174.ec2.internal hibinit-agent[2452]: There's sufficient swap available (have 4194304000, need 4194304000)
9. Stop the instance
10. Modify to larger (c5.xlarge) instance.
11. Start the instance.
12. `journalctl -b | grep "Swap already exists!"` to verify swap is created due to larger swap required.
Aug 04 18:25:03 ip-172-31-22-174.ec2.internal hibinit-agent[2600]: Swap already exists! (have 4194304000, need 8011620352), deleting existing swap file /swap
[Where things could go wrong]
- If Dynamic swap allocation fails, then hibernation may not properly save the state of the machine.
- Perhaps the user relies on the smaller/bigger SWAP size for something else and dynamically resizing on instance change could cause issues? I'd say unlikely but could be a concern.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ec2-hibinit-agent/+bug/2031345/+subscriptions
More information about the foundations-bugs
mailing list