Proxmox – Move Swap Partition from USB Boot Disk to another disk
First remove swap & partion
swapoff /dev/pve/swap
lvchange -a n /dev/pve/swap
lvremove /dev/pve/swap
Make swap file on another disk:
dd if=/dev/zero of=/pathondisk/swapfile bs=1024 count=2000000
chown root:root /pathondisk/swapfile
chmod 0600 /pathondisk/swapfile
mkswap /pathondisk/swapfile
swapon /pathondisk/swapfile
To activate /pathondisk/swapfile after Linux system reboot, add entry to /etc/fstab file.
nano /etc/fstab
/pathondisk/swapfile none swap sw 0 0
Save and close the file. After reboot, it enables the new swap file for you automatically.
To check swap is working:
free -m