Swap file remains unnecessarily large if system memory size decreases
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ec2-hibinit-agent (Ubuntu) |
Fix Released
|
Undecided
|
Mitchell Dzurick | ||
Focal |
Fix Released
|
Undecided
|
Graham Inggs | ||
Jammy |
Fix Released
|
Undecided
|
Graham Inggs | ||
Lunar |
Fix Released
|
Undecided
|
Graham Inggs |
Bug Description
Upstream Change - https:/
[FFE]
====
This change includes a small optimization to resize the swap partition. On hibernation, the contents of RAM is put onto SWAP, so if the amount of RAM reduces, the SWAP file will be too large, and waste space.
[SRU]
====
[Impact]
If an AWS EC2 user decreases the amount of RAM on an instance, unnecessary disk space will be used.
[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-
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-
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-
[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 bigger SWAP size for something else and dynamically resizing on instance change could cause issues? I'd say unlikely but could be a concern.
- [racb] I asked what might happen if a user has increased swap size manually and expects it to stay large. But I'm told that a specific swap filename is used that is specific to hibernation, so it seems reasonable that this would be automatically managed.
Related branches
- Graham Inggs (community): Approve
- Canonical Server Reporter: Pending requested
-
Diff: 60 lines (+38/-0)3 files modifieddebian/changelog (+7/-0)
debian/patches/lp2031345-recreate-swap-file.patch (+30/-0)
debian/patches/series (+1/-0)
- Graham Inggs (community): Approve
- Canonical Server Reporter: Pending requested
-
Diff: 60 lines (+38/-0)3 files modifieddebian/changelog (+7/-0)
debian/patches/lp2031345-recreate-swap-file.patch (+30/-0)
debian/patches/series (+1/-0)
- Graham Inggs (community): Approve
- Canonical Server Reporter: Pending requested
-
Diff: 60 lines (+38/-0)3 files modifieddebian/changelog (+7/-0)
debian/patches/lp2031345-recreate-swap-file.patch (+30/-0)
debian/patches/series (+1/-0)
- Julian Andres Klode (community): Approve
- Canonical Server Reporter: Pending requested
-
Diff: 60 lines (+38/-0)3 files modifieddebian/changelog (+7/-0)
debian/patches/lp2031345-recreate-swap-file.patch (+30/-0)
debian/patches/series (+1/-0)
Changed in ec2-hibinit-agent (Ubuntu): | |
assignee: | nobody → Mitchell Dzurick (mitchdz) |
summary: |
- Add Swap Optimization from upstream + Add recreating the swap file if the current size is sufficiently larger |
summary: |
- Add recreating the swap file if the current size is sufficiently larger + FFE+SRU: Add recreating the swap file if the current size is + sufficiently larger |
description: | updated |
description: | updated |
description: | updated |
Changed in ec2-hibinit-agent (Ubuntu Focal): | |
assignee: | nobody → Graham Inggs (ginggs) |
Changed in ec2-hibinit-agent (Ubuntu Jammy): | |
assignee: | nobody → Graham Inggs (ginggs) |
Changed in ec2-hibinit-agent (Ubuntu Lunar): | |
assignee: | nobody → Graham Inggs (ginggs) |
Changed in ec2-hibinit-agent (Ubuntu Focal): | |
status: | New → In Progress |
Changed in ec2-hibinit-agent (Ubuntu Jammy): | |
status: | New → In Progress |
Changed in ec2-hibinit-agent (Ubuntu Lunar): | |
status: | New → In Progress |
summary: |
- FFE+SRU: Add recreating the swap file if the current size is - sufficiently larger + Swap file remains unnecessarily large if system memory size decreases |
I'm planning on doing an FFE for Mantic, and then start the SRU process to Focal.