-
Notifications
You must be signed in to change notification settings - Fork 66
Description
Add swap in installed system
I noticed that the system can lock up in low-RAM situations, which can happen when editing video with Shotcut while running a web browser on a machine with 4 GB RAM. Hence we should add some swap space by default.
One way would be to use a swap partition/dataset. This would probably be the cleanest way.
Another way would be to add a swap file along those lines. This has the advantage that it can be done retroactively without having to repartition the disk. (But thinking about ZFS, one can probably also retroactively add a dedicated dataset for swap without having to repartition...)
# See https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/adding-swap-space.html
# TODO: Check whether we have 8192 MB free and only continue if so
# TODO: Check whether swap0 is already mentioned in /etc/fstab and only continue if it is not
# Create swap file
dd if=/dev/zero of=/usr/swap0 bs=1m count=8192
chmod 0600 /usr/swap0
# Inform the system about the swap file
cat >> /etc/fstab <<\EOF
md99 none swap sw,file=/usr/swap0,late 0 0
EOF
# Add swap space immediately
swapon -aL
What is the best practice when it comes to swap on ZFS?
Windows automatically uses dynamically growing swap files (I think).
What does the Mac do?