mirror of
https://github.com/home-assistant/operating-system.git
synced 2026-05-04 07:27:08 +01:00
Make swap size configurable (#3882)
Allow configuration of the swap size via /etc/default/haos-swapfile file. By setting the SWAPSIZE variable in this file, swapfile get recreated on the next reboot to the defined size. Size can be either in bytes or with optional units (B/K/M/G, accepting some variations but always interpreted as power of 10). The size is then rounded to 4k block size. If no override is defined or the value can't be parsed, it falls back to previously used 33% of system RAM. Fixes #968
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Persistent /etc/default directory
|
||||
Requires=mnt-overlay.mount
|
||||
After=mnt-overlay.mount
|
||||
|
||||
[Mount]
|
||||
What=/mnt/overlay/etc/default
|
||||
Where=/etc/default
|
||||
Type=None
|
||||
Options=bind
|
||||
|
||||
[Install]
|
||||
WantedBy=hassos-bind.target
|
||||
@@ -1,8 +1,8 @@
|
||||
[Unit]
|
||||
Description=HAOS swap
|
||||
DefaultDependencies=no
|
||||
Requires=mnt-data.mount
|
||||
After=mnt-data.mount systemd-growfs@mnt-data.service
|
||||
Requires=etc-default.mount mnt-data.mount
|
||||
After=etc-default.mount mnt-data.mount systemd-growfs@mnt-data.service
|
||||
Before=mnt-data-swapfile.swap
|
||||
|
||||
[Service]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
[Unit]
|
||||
Description=HAOS swap file
|
||||
ConditionFileNotEmpty=/mnt/data/swapfile
|
||||
|
||||
[Swap]
|
||||
What=/mnt/data/swapfile
|
||||
|
||||
Reference in New Issue
Block a user