[TouchPad General] HP_TOUCHPAD:
No need to follow this instructions, but only if you want to learn!

Flash files are available here that will automatically do all this in TWRP Recovery.

https://xdaforums.com/hp-touchpad/general/hp-touchpad-optimize-android-swap-t3901773

Before making this modifications, do this first:​

https://xdaforums.com/hp-touchpad/general/how-to-backup-restore-using-twrp-copy-t3892047​

How to create a Swap partition of any size for any Android ROM

This is only need it to be create one time only and will work with any OS install in the Tablet( Any Android ROM, Any Linux OS, LunesOS, WebOS, Sailfish and many more ).

The following steps will partition the storage to create a swap partition that can be use for all Android ROM ever created for the HP Touchpad.

Also take a look at this link:

https://xdaforums.com/hp-touchpad/general/powerful-feature-hp-touchpad-lvm-t3889068

[B]For the Experience User this are the simple steps, to get it out of the way and not need to read all the details. [/B]
If you know what you are doing, you can use it inside Android, TWRP using adb shell with root access is up to you.
Have unallocated space after creating all partitions.
(make a partition of whatever free space is available ) or you can specified the size you want, you know how to do it or
read above link)
./lvm.static lvcreate -l 100%FREE -C y -M y --major 254 --minor 0 -n /dev/store/swap
mkswap /dev/store/swap
Add to the fstab in Ramdisk:
/dev/store/swap swap swap defaults swapprio=1, 0 0

This steps are for the learning user, hopefully I am explaining it clearly and correctly!

My comments and Suggestion

I am making the steps as simple as I can. You can achieve this faster if you have done this before.
Basically is creating all the partitions but have 824MB unallocated free space for swap.
You can assign any size you want.
I recommend the following:

Media at least 1GB, this will be the USB Storage. This partition is the best to shrink if you ever need more space on other partitions.
cm-cache 200MB. If you want to use more you can, but I have not found any issues using 200MB.
cm-system 2048MB. If you ever want to install the FULL google open apps, it will take over 1.5GB. This will ensure, you can install anything and not have an issue.
cm-data (as much as you need to only have unallocated free space for swap )

A size of 500MB will be enough ( WebOS has a swap file size of 400 MB )
The maximum I will recommend is 1GB, but you can make it any size you want. Is all up to what you use your tablet for.

Starting all fresh, from zero. All Data will be erase. Back up your data before proceeding.

THE BEGINNING of the process.

1. Load the ToolBox v42 2015-01-08

2. Complete Data Reset ( If you want to clear all partitions )

3. Resize Android Volumes (Using the ToolBox)

3.A Select Media ( select -1024 ) press home button 28 times

New size 1112

unallocated 28672

Select BACK (on top)

3.B Select cm-cache (select +8 ) press home button 25 times

New size 200

unallocated 28472

Select BACK (on top)

3.C Select cm-system (select +1024) press home button 2 times

New size 2048

unallocated 26424

Select BACK (on top)

3.D Select cm-data (select +1024) press home button 25 times

New size 25600

unallocated 824

Select Back (on top)

4. Select Apply Changes

5. Select Reboot

<<< moboot 0.3.8 >>>

6. Select boot webOS Recovery (connect the TP to computer)

7. Unzip FLINTMAN-TWRP-touch-data_media-SELINUX-f2fs-3.1.0-0-5-09-17.zip

8. Open a terminal in the directory of the unzip file.

9. Copy and paste the following in terminal.

novacom boot mem:// <uImage.TWRP

At this point The ToolBox already created all the partitions or volumes, but the unallocated space left is the one that we need to manually create

and format as a native Linux partition. This is why we need to use TWRP Recovery and to enter two lines of code, create the partition and format it.!

<<< TWRP >>>

10. Select Mount --->> check BOOT --->> select back (triangle lower left)

11. Entering adb shell :In the open Terminal paste the following

adb shell

cd /boot/usr/sbin

./lvm.static vgchange -ay

Result: /boot/usr/sbin # ./lvm.static vgchange -ay

4 logical volume(s) in volume group "store" now active

./lvm.static lvcreate -l 100%FREE -C y -M y --major 254 --minor 0 -n /dev/store/swap

Result: /boot/usr/sbin # ./lvm.static lvcreate -l 100%FREE -C y -M y --major 254 --minor

0 -n /dev/store/swap

ffff0000-ffff1000 r-xp 00000000 00:00 0 [vectors]: mlock failed: Cannot allocate memory

ffff0000-ffff1000 r-xp 00000000 00:00 0 [vectors]: munlock failed: Cannot allocate memory

Logical volume "swap" created

mkswap /dev/store/swap

Result: /boot/usr/sbin # mkswap /dev/store/swap

Setting up swapspace version 1, size = 864022528 bytes

./lvm.static vgchange -ay

Result: /boot/usr/sbin # ./lvm.static vgchange -ay

5 logical volume(s) in volume group "store" now active

<<<-- All Done Swap partition created -->>>

12. Copy FLINTMAN-TWRP-touch-data_media-SELINUX-f2fs-3.1.0-0-5-09-17.zip file in the Micro SDCard showing on your Computer.

13. Select Install --->> Up one level --->> external_sd ( the TWRP.zip file should be there ) Install it, Reboot System.

14. TWRP is on the moboot menu. Now you can install any ROM.

But Files in the Ramdisk needs to be modified for Android to mount the swap partition at boot.

I have done all this already, you can use the boot uImages that I posted below for Dirty Unicorns and Evervolv. If you feel like doing it yourself then keep having fun!

15. To modify the Ramdisk, click on this link:

https://xdaforums.com/hp-touchpad/development/make-root-permanet-read-write-to-t3846567

16. The following needs to be added to fstab.tenderloing

/dev/store/swap swap swap defaults swapprio=1, 0 0

The zRAM needs to be disable, by placing # in front of the mount point.

# /dev/block/zram0

The fun has just started and now Android will see the swap partition and start swapping, but changes need to be made on more files in the ramdisk to optimize Android to work on a Tablet with swapping and not be use as a smartphone with zRAM and limited resources like it has been use from all this years.

The system is not optimized and it will not work properly with current settings. I have created modified boot images for the Evervol 7.1.2 and Dirty Unicorns V12.5.3 with all the best optimization possible to use the Touchpad as a tablet and not a smartphone. The links are below, just copy the files into your boot directory.

Before you boot using the new image, disable any optimization apps or changes that you have done because it will override any settings done after boot is completed and make the system very slow.

Dirty Unicorns:

https://xdaforums.com/hp-touchpad/development/dirty-unicorns-v12-5-3-20181116-0140-rc-t3894042

Everlvolv:

https://xdaforums.com/hp-touchpad/development/evervol-7-1-2-skz-kernel-swap-partition-t3892091

Attention: This is extremely easy to deploy by all developers creating any ROM or Kernel for the TP. The regular user does not need to do none of this.

The only thing the user needs to do is left some space available when creating the Android partitions using the ToolBox, which everyone needs to do.

Is up to the user to select how much space they want for their Swap partition.

Then the developer that provides the ROM or Kernel can create an script to run after installation that will create the partition from whatever free space is available and format it. No input is need it by the user to do so. And if the partition is already created, nothing will happen, LVM is smart enough to not recreated.

./lvm.static lvcreate -l 100%FREE -C y -M y --major 254 --minor 0 -n /dev/store/swap

mkswap /dev/store/swap