I have created a swap partition via GNOME Disks in my SD Card and I found that my Android system doesn't detect it until I used Aparted to activate it but still It is not persistent after a reboot and I don't know how to recognize the path of my swap partition according to Android But I knew the path of my SD card via Aparted: /dev/block/mmcblk1 so I don't know how to modify fstab.qcom for permanently using the swap partition in my SD card.

  • 1
    Do mkswap once and then you just need to run swapon on every boot: How to run an executable on boot? // Similar question: android.stackexchange.com/q/78177/218526. // Why using SD card as SWAP partition is a bad idea: android.stackexchange.com/a/220042/218526 Commented Aug 21, 2021 at 6:21
  • "swapon" just doesn't work alone as It needs a file argument and the android "swapon" is limited than another. Commented Aug 21, 2021 at 15:55
  • or tell me how to use mkswap/swapon with a swap partition I created on my sdcard? Commented Aug 21, 2021 at 16:01
  • It's obvious that you need to provide partition block device path to the swapon command. You can simply hard-code the path: /dev/block/mmcblk1p[N] in the boot script. Or to be on safe side, provide the UUID of the partition to swapon: man7.org/linux/man-pages/man8/swapon.8.html. Build a full swapon binary from util-linux package. Or do some scripting to get the block device path from UUID and provide that to the Android's minimal swapon. Commented Aug 21, 2021 at 16:11
  • yeah, I discovered that the path is /dev/block/mmcblk1p1 and swapon is working now but not persistent upon reboot. What about fstab.qcom I have added /dev/block/mmcblk1p1 none swap sw 0 0 to it and it didn't work. Commented Aug 21, 2021 at 17:31


You must log in to answer this question.

Browse other questions tagged .