Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4898

Raspberry Pi OS • Re: Increasing swap space without rebooting?

$
0
0
But I'm wondering if there is some "systemd-y" way to do it - some command that will read the /etc/dphys-swapfile and do the right thing(s) automatically. Is there?
Change the /etc/dphys-swapfile.conf file, then

Code:

sudo systemctl restart dphys-swapfile
Like this:

Code:

notpi@raspi15:~ $ free -h               total        used        free      shared  buff/cache   availableMem:           473Mi       110Mi       160Mi       204Ki       254Mi       362MiSwap:           99Mi       768Ki        99Minotpi@raspi15:~ $ sudo vi /etc/dphys-swapfile  # Changed swap size to 256notpi@raspi15:~ $ sudo systemctl restart dphys-swapfilenotpi@raspi15:~ $ free -h               total        used        free      shared  buff/cache   availableMem:           473Mi       111Mi       156Mi       656Ki       257Mi       361MiSwap:          255Mi          0B       255Mi
and what happened behind the scenes:

Code:

notpi@raspi15:~ $ journalctl --since "20 minutes ago" --unit dphys-swapfile                         May 02 08:46:29 raspi15 systemd[1]: Stopping dphys-swapfile.service - dphys-swapfile - set up, mount/unmount, and delete a swap file...May 02 08:46:29 raspi15 systemd[1]: dphys-swapfile.service: Deactivated successfully.May 02 08:46:29 raspi15 systemd[1]: Stopped dphys-swapfile.service - dphys-swapfile - set up, mount/unmount, and delete a swap file.May 02 08:46:30 raspi15 systemd[1]: Starting dphys-swapfile.service - dphys-swapfile - set up, mount/unmount, and delete a swap file...May 02 08:46:33 raspi15 dphys-swapfile[15188]: want /var/swap=256MByte, checking existing: deleting wrong size file (104857600), generating swapfile ... of 256MBytesMay 02 08:46:33 raspi15 systemd[1]: Finished dphys-swapfile.service - dphys-swapfile - set up, mount/unmount, and delete a swap file.
I'm not sure what happens if swap is busy at the time.

Statistics: Posted by rpdom — Thu May 02, 2024 7:48 am



Viewing all articles
Browse latest Browse all 4898

Trending Articles