Linux swap with dphys-swapfile

This is a solution for a #RaspberryPi, some #VPS without swap of some machine setup without swap where you need swap for something without wanting to fiddle with the drive partitions or so. This is a quick and dirty “short manual” for #Debian based #Systemd environments (such as #Ubuntu, #Mint or #Raspbian). First run this: cat > dphys-swap.sh << EOF #!/bin/bash #~/up apt-get install dphys-swapfile echo "CONF_SWAPSIZE=2048"|tee -a /etc/dphys-swapfile dphys-swapfile setup dphys-swapfile swapon systemctl restart dphys-swapfile.service systemctl status dphys-swapfile.service free -h EOF This will just create a short #bash #script with the needed commands to run to get #dphys setup and running. Please alter the number 2048 to your need, it is the size of the swap memory that will be setup. The size of the swap should most likely by equal to the real memory installed, sometimes twice the size seems to be a good choice too. ...

20. April 2020 · 2 Minuten · utzer

How to add a swap drive to your system

How to add a swap drive to your system, in this case I did this for a virtual machine (qemu) running Arch Linux. See at the bottom for information about the virtual drive for qemu. List current available to system disks: sudo blkid List all disks: sudo lsblk Format as swap: sudo mkswap /dev/vdb gives back the UUID Now the new swap disk will be shown when executing this again: sudo blkid (also give the UUID) ...

2. Oktober 2019 · 1 Minute · utzer