0

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

2
  • On Buster dphys-swapfile is broken. It doesn't create a valid swapfile. See forums.raspberrypi.com/viewtopic.php?p=1933730#p1933730 for details of what you need to change to fix it.
    – Dougie
    Dec 31, 2021 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 1, 2022 at 16:08

1 Answer 1

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

1
  • 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 1, 2022 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.