FORUMS
Remove All Ads from XDA

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

471 posts
Thanks Meter: 233
 
By HP_TOUCHPAD, Senior Member on 21st January 2019, 03:43 AM
Post Reply Email Thread
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://forum.xda-developers.com/hp-...-swap-t3901773


Before making this modifications, do this first:


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://forum.xda-developers.com/hp-...d-lvm-t3889068
Code:
For the Experience User this are the simple steps, to get it out of the way and not need to read all the details. 
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
Code:
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.

Code:
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

Code:
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

Code:
./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

Code:
mkswap /dev/store/swap
Result: /boot/usr/sbin # mkswap /dev/store/swap
Setting up swapspace version 1, size = 864022528 bytes

Code:
./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://forum.xda-developers.com/hp-...te-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://forum.xda-developers.com/hp-...40-rc-t3894042

Everlvolv:
https://forum.xda-developers.com/hp-...ition-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
The Following User Says Thank You to HP_TOUCHPAD For This Useful Post: [ View ] Gift HP_TOUCHPAD Ad-Free
 
 
27th January 2019, 05:10 PM |#2  
shumash's Avatar
Senior Member
Thanks Meter: 2,823
 
Donate to Me
More
Quote:
Originally Posted by HP_TOUCHPAD

Before making this modifications, do this first:


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

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://forum.xda-developers.com/hp-...d-lvm-t3889068
For the Expert is as simple as:
Have unallocated space.

(make a partition of whatever free space is avalaible ) or it can be specified.

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

Code:
mkswap /dev/store/swap
Where? adb shell? That's where I'm doing it, and I get "unable to create new logical volume with no extents"

Add to the fstab in Ramdisk:
/dev/store/swap swap swap defaults swapprio=1, 0 0

Optimize Swapping settings.


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.

Is this where we're supposed to start. Is all the rest above this just commentary?

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.

Code:
novacom boot mem:// <uImage.TWRP
<<< TWRP >>>

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

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

Is this actually the place where the lvm volumes are created after we go through TPTB and reinstall TWRP?
adb shell

Code:
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

Code:
./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

Code:
mkswap /dev/store/swap
Result: /boot/usr/sbin # mkswap /dev/store/swap
Setting up swapspace version 1, size = 864022528 bytes

Code:
./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.

15. To modify the Ramdisk, click on this link:
https://forum.xda-developers.com/hp-...te-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 Touchap 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.

<<--link will be here --->>

This may be clear to you, but it isn't to me. See my comments in red above. How about cleaning this up? Anything you want to add that is extraneous to just getting this done should be in a second post.
The Following User Says Thank You to shumash For This Useful Post: [ View ] Gift shumash Ad-Free
16th February 2019, 03:13 AM |#3  
Junior Member
Thanks Meter: 1
 
More
I kinda get the feeling you are hoping the ROM builders will add this to their Roms but i don't think we have too many programmers left for the touchpad.

I can't even get this far

8. Open a terminal in the directory of the unzip file. ( on windows? with what?)

9. Copy and paste the following in terminal.

Sorry ...i'm trying though...Thanks for your effort
16th February 2019, 03:19 AM |#4  
OP Senior Member
Thanks Meter: 233
 
More
Quote:
Originally Posted by Touchie Pad

I kinda get the feeling you are hoping the ROM builders will add this to their Roms but i don't think we have too many programmers left for the touchpad.

I can't even get this far

8. Open a terminal in the directory of the unzip file. ( on windows? with what?)

9. Copy and paste the following in terminal.

Sorry ...i'm trying though...Thanks for your effort

The tablet originally came with a swap partition on webOS, is nothing new.
Do not worry about doing this, I already created a zip file that can be install using TWRP Recovery!
Everything will be done in less than two minutes and everything will be created!
Working on getting the files on here...
16th February 2019, 03:23 AM |#5  
Junior Member
Thanks Meter: 1
 
More
my touchpads are in twrp and attached to my computer!
16th February 2019, 03:26 AM |#6  
OP Senior Member
Thanks Meter: 233
 
More
Quote:
Originally Posted by Touchie Pad

my touchpads are in twrp and attached to my computer!

It will be very quick thing to apply, download the zip file. Flash it and in less than 2 minutes is done!
16th February 2019, 01:35 PM |#7  
Senior Member
Thanks Meter: 55
 
More
Quote:
Originally Posted by HP_TOUCHPAD

It will be very quick thing to apply, download the zip file. Flash it and in less than 2 minutes is done!

I did not see the zip available anywhere. Where is the zip file?
18th February 2019, 03:51 PM |#8  
Junior Member
Thanks Meter: 1
 
More
Well I was able to create the swap partition by following your instructions in the terminal of the twrp on the touchpad. When i type in #free it does show a swap file with numbers, so i think i got it right. Did it on a DU Rom and a Lineage build. Never could get your optimized settings to boot though. Or get into the ramdisk yet. I used 3ctoolbox to try to mimic your suggested settings. It does seem to be quite a bit improved...especially when watching videos on youtube etc...I still do come across lag at times, if more than a couple things are running at the same time...and some apps are still tough for it to handle, but every bit helps.
18th February 2019, 04:08 PM |#9  
OP Senior Member
Thanks Meter: 233
 
More
Quote:
Originally Posted by Touchie Pad

Well I was able to create the swap partition by following your instructions in the terminal of the twrp on the touchpad. When i type in #free it does show a swap file with numbers, so i think i got it right. Did it on a DU Rom and a Linaro build. Never could get your optimized settings to boot though. Or get into the ramdisk yet. I used 3ctoolbox to try to mimic your suggested settings. It does seem to be quite a bit improved...especially when watching videos on youtube etc...I still do come across lag at times, if more than a couple things are running at the same time...and some apps are still tough for it to handle, but every bit helps.

Thanks for trying it out!
Today I will upload all the zip files than can be easily flash using TWRP, it will be extremely simple, just touch and install and it will do a complete fresh install of everything, like a brand new Device!
Also the DU optimized Kernel and Evervolv, just touch and Install.
You will see how fast and stable the HP Touchpad really is!
The Following User Says Thank You to HP_TOUCHPAD For This Useful Post: [ View ] Gift HP_TOUCHPAD Ad-Free
19th February 2019, 12:51 PM |#10  
OP Senior Member
Thanks Meter: 233
 
More
Here are the Flash files to Install ! Thanks to shumash for the help of providing the script binary and for initiating the idea to make it easy!
https://forum.xda-developers.com/hp-...-swap-t3901773
The Following User Says Thank You to HP_TOUCHPAD For This Useful Post: [ View ] Gift HP_TOUCHPAD Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes