-1

I trying move swap file to USB flash from SD card it work fine but after rebooting swap file falls off, command free -m show swap is 0

I move swap file to USB flash

  1. dphys-swapfile swapoff
  2. dphys-swapfile uninstall
  3. edit file /etc/dphys-swapfile set variable CONF_SWAPFILE=/media/usb/swap.file
  4. dphys-swapfile setup
  5. dphys-swapfile swapon

in fstab mount USB flash UUID=uuid /media/usb ext4 nofail defaults, 0 0

but after reboot swap file falls

Besha
  • 1
  • 1
  • On Buster dphys-swapfile is broken. It doesn't create a valid swapfile. See https://forums.raspberrypi.com/viewtopic.php?p=1933730#p1933730 for details of what you need to change to fix it. – Dougie Dec 31 '21 at 18:17
  • thanks, i use bulleye, maybe in bulleye dphys-swapfile have some problem too, i solve this problem other way set in file /etc/dphys-swapfile size of swap file 0 and enable swap file other way – Besha Jan 01 '22 at 16:08

1 Answers1

0

It could be when your SD card is reaching the end of its life that it is internally switching to readonly mode and that your changes on it (in the /etc/dphys-swapfile) are lost at reboot. It is a common phenomen with SD cards according to here: https://forums.raspberrypi.com/viewtopic.php?f=28&t=76351

  • thanks, but this problem appears only if i have change location swap file from SD card to USB drive, USB drive work fine – Besha Jan 01 '22 at 11:45