[GUIDE] How to create a swap partition at my way (the easiest) - XPERIA X8 General

I know this topic has been covered many times already, but since I couldn't find a easy and straight forward how-to to create a swap partition on my X8, I am going to walk you through few easy steps that will let you create a swap partition in 5 mins or so.
First things first I assume you have already the latest version of miniCM7 and nAa kernel, although this mini howto should apply for any phone and any rom out there, as long as the kernel supports swap partition.
First thing you want to partition your SD card in order to create our swap partition, I recommend you to follow this accurately.
Now that we have successfully created our swap partition, we want to boot up the phone and enable our swap partition in order to be accessible to the kernel.
To detect the swap partition that we have just created open up a ADB terminal and type
Code:
fdisk -l dev/block/mmcblk0
it will look something like this
Code:
/dev/block/mmcblk0p3 862 966 843412+ 82 Linux swap
write down the exact number of the swap partition and let's activate it by typing
Code:
swapon /dev/block/mmcblk0pX
** where X is the number of the swap partition **
We can now check if our swap partition has been activated by executing the command free
Now we want to make our swap partition to be activated at boot time, without having to activate it manually everytime we reboot the phone.
Assuming you know how to at least write and save a text file in VI, let's go back to our fido ADB shell and type
Code:
vi /data/local/userinit.sh
now lets drop few lines in
Code:
#!/system/bin/sh
#Swap
swapon /dev/block/mmcblk0pX
** where X is the number of the swap partition **
If you are not really comfortable with VI you can also use Nano or even RootExploer or any other root file manager if you are more comfortable with UI.
save it and once again in ADB shell lets make it executable
Code:
chmod a+x /data/local/userinit.sh
As last step you may want to change the swappiness value, note that most of the roms have it set to 60 by default, which is good enough in my opinion, although setting it to higher (max is 100) may help to improve overall performance, while setting it to lower may increase interactivity and overall stability.
Temporary change (until next reboot)
Code:
echo 60 > /proc/sys/vm/swappiness
Permanent change
Code:
echo vm.swappiness=60 >> /system/etc/sysctl.conf
As result
Code:
~ # free
total used free shared buffers
Mem: 186704 177248 9456 0 116
-/+ buffers: 177132 9572
Swap: 843404 53760 789644
** few notes **
I don't intend to take credit for this how-to as it takes few pieces of commands and hints from any guides out there which covers this topic, and anyways its basic linux knowledge really..
So cheers you all and enjoy

mmcblk0p3 is used when we have 3 partitions on SD and last one is swap.
If we have only 2 (fat+swap like me) it need to be mmcblk0p2
Also mkswap /dev/block/mmcblk0pX need to be done b4 you call swapon.

rav3n_pl said:
mmcblk0p3 is used when we have 3 partitions on SD and last one is swap.
If we have only 2 (fat+swap like me) it need to be mmcblk0p2
Also mkswap /dev/block/mmcblk0pX need to be done b4 you call swapon.
Click to expand...
Click to collapse
Yea I forgot to mention that mmcblk0p3 is in my case the swap partition and the number vary depends on how many partitions you have on your SD card.
Btw mkswap isn't needed if you follow my how-to, because Linux Swap file system is already selected when partitioning the SD card, you don't really need to format the swap partition again by using mkswap .

I tought that a partition is need it, to run the swap file, but now I am running it in my sd card without partition it. Is any difference, between partition my sd?

You are using swap file, it can be created by swapper. Swap partition is easier - it will persist when you connect to pc.

Sir_gpm said:
I tought that a partition is need it, to run the swap file, but now I am running it in my sd card without partition it. Is any difference, between partition my sd?
Click to expand...
Click to collapse
If you meant what's the difference between using swapper2 and partitioning the SD card is that basically you can assign as much space as you want to your swap partition, while with swapper2 you can't really have more than 250mb of swap.
Also like @rav3n_pl said, when you mount the sdcard on your computer the swap will stay available since it uses its own partition.
Personally I found 250mb of swap too little, my suggestion is to give at least 600mb to the swap partition.
My setup is 800mb of swap and swappiness value set to 70.

I would like to ask you why & in what situation was 256mb swap insufficient?
Did you actually run 'free' in terminal to see how much swap was being used?
I just can't imagine anything running on our phone that will actually use up the whole 256mb swap, unless you are running a linux distro over the top...(less than 1% of users & those users know what they are doing)...the only thing a greater than 256mb swap space partition is doing is decreasing your over-all sd-card capacity for music/files/apps2sd/whatever2sd...
Swap doesn't 'add' ram. We don't magically have 1gb of ram with 800mb swap...
I'm not bashing, I just think new users could easily take this idea the wrong way.
Same as other people advising newer users to set up 1gig+ of swap...it is just unused space on your sd-card.
The best thing about setting up a partition and not using swapper2 is you don't have an app on your phone that is notorious for auto-running, has root access, as well as internet permission. Root access means they can send any info about your phone straight through. Even with Droidwall+similar apps, they don't mean anything to root.

i have fat32 ext3 and swap,ext3 and swap works,but i cant use storage(fat32) phone say its wrong sd card..but in another rom with same kernel works..

hajiborojobo said:
i have fat32 ext3 and swap,ext3 and swap works,but i cant use storage(fat32) phone say its wrong sd card..but in another rom with same kernel works..
Click to expand...
Click to collapse
In the linked article is adviced to put a SD card of 2GB or smaller on FAT, maybe that's your solution?

lrakkarl said:
I would like to ask you why & in what situation was 256mb swap insufficient?
Did you actually run 'free' in terminal to see how much swap was being used?
I just can't imagine anything running on our phone that will actually use up the whole 256mb swap, unless you are running a linux distro over the top...(less than 1% of users & those users know what they are doing)...the only thing a greater than 256mb swap space partition is doing is decreasing your over-all sd-card capacity for music/files/apps2sd/whatever2sd...
Swap doesn't 'add' ram. We don't magically have 1gb of ram with 800mb swap...
I'm not bashing, I just think new users could easily take this idea the wrong way.
Same as other people advising newer users to set up 1gig+ of swap...it is just unused space on your sd-card.
The best thing about setting up a partition and not using swapper2 is you don't have an app on your phone that is notorious for auto-running, has root access, as well as internet permission. Root access means they can send any info about your phone straight through. Even with Droidwall+similar apps, they don't mean anything to root.
Click to expand...
Click to collapse
I have never said that swap adds ram, not that I want new users to believe that, but in my case 256mb of swap was way too little, especially when it comes to play games and at the same times running apps in background while the phone still remains snappy. Maybe 800mb of swap is a little bit exaggerated, but in my opinion 500mb of swap is a must to have..

rav3n_pl said:
mmcblk0p3 is used when we have 3 partitions on SD and last one is swap.
If we have only 2 (fat+swap like me) it need to be mmcblk0p2
Also mkswap /dev/block/mmcblk0pX need to be done b4 you call swapon.
Click to expand...
Click to collapse
Wow, if only I read the second post and not gaze at the OP for 2h, it would have saved me two hours of googling. The OP needs to be modified.

I Create Partion Using ClockwordRecovery MOD its that simple
even swapper works great can any body tell me i am doing something wrong

Can i do this in my wt19i?
Sent from my WT19i using xda premium

bind9 said:
Can i do this in my wt19i?
Sent from my WT19i using xda premium
Click to expand...
Click to collapse
Yes you can. Not sure why you'd need to though, you already have 512Mb RAM.
Sent from my X8 using xda premium

Hi all, why I always get this?
mkswap /dev/block/mmcblk0p2
Setting up swapspace version 1, size = 255593472 bytes
swapon /dev/block/mmcblk0p2
swapon: /dev/block/mmcblk0p2: Invalid argument
Also swapper2 is not working either...
I am using last nAa kernel and ROM.
Thanks.

cenovita said:
Hi all, why I always get this?
mkswap /dev/block/mmcblk0p2
Setting up swapspace version 1, size = 255593472 bytes
swapon /dev/block/mmcblk0p2
swapon: /dev/block/mmcblk0p2: Invalid argument
Also swapper2 is not working either...
I am using last nAa kernel and ROM.
Thanks.
Click to expand...
Click to collapse
If you have an ext partition then its mmcblk0p3.
Sent from my X8 using xda premium

NIMBAH said:
If you have an ext partition then its mmcblk0p3.
Sent from my X8 using xda premium
Click to expand...
Click to collapse
I have just 2, one FAT32 (7gb) and the rest is for the SWAP part, I have tried formatting it with swap and ext3, no case...
look at this:
Disk dev/block/mmcblk0: 8064 MB, 8064598016 bytes
255 heads, 63 sectors/track, 980 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
dev/block/mmcblk0p1 1 922 7405933+ b Win95 FAT
dev/block/mmcblk0p2 923 980 465885 83 Linux
[email protected]:/ # mkswap /dev/block/mmcblk0p2
mkswap /dev/block/mmcblk0p2
Setting up swapspace version 1, size = 255593472 bytes
[email protected]:/ # swapon /dev/block/mmcblk0p2
swapon /dev/block/mmcblk0p2
swapon: /dev/block/mmcblk0p2: Invalid argument
1|[email protected]:/ # free
free
total used free shared buffers
Mem: 189448 162852 26596 0 24
-/+ buffers: 162828 26620
Swap: 0 0 0
[email protected]:/ # swapon /dev/block/mmcblk0p3
swapon /dev/block/mmcblk0p3
swapon: can't stat '/dev/block/mmcblk0p3': No such file or directory
1|[email protected]:/ # swapon /dev/block/mmcblk0p3
Click to expand...
Click to collapse
BTW, if i partition with minitool, the card is not mountable by the phone... I have to partition with recovery...
---------- Post added at 04:24 PM ---------- Previous post was at 04:14 PM ----------
OK, I have partitioned with Recovery and created 1 ext partition of 256Mb and 1 swap partition of 256Mb.
After that, i was able to mount swap in p3 (the swap one).
Minitool, useless for me...

hI DEVS!
I have 2 partitions: Fat32-1,6GB (my files) and ext4-200MB (linked files)
Can i use swap?
If yes... the command will be: swapon /dev/block/mmcblk0p2 ?

hI DEVS!<br />
I have 2 partitions: Fat32-<b>1,6GB </b>(my files) and ext4-<b>200MB</b> (linked files)<br />
Can i use swap?<br />
If yes... the command will be: <b>swapon /dev/block/mmcblk0p2</b> ?
Click to expand...
Click to collapse
No you will need to create another partition for swap. The best way is through recovery but that will require reformatting your SD Card.
Sent from my X8 using xda premium

Android ICS 4.0.3
Hello,
i have Script und working fine with gscript. But i wont do it in autostart. I copy userinit.sh in data\local\ reboot but i have no swap. I mus the script with gscript.
can anyone help me please.
i have HRC HD2 with CLK-NexusHD2.1HWA ICS-Android 4.0.3
thanks

Related

Swap FILE on Hero?

I've been digging around trying to find out the benefits and drawbacks of using swap on android devices, and the general consensus is 'not worth it since SD card is slow', and 'android is good at killing programs when necessary and starting them up where they left off'
Well, that got me thinking, since I have the MoDaCo ROM installed, and I'm utilizing Apps2SD - i've got all this free space on the (relatively) fast internal flash memory that's going unused.
It seems to me that a swap file (not partition) in /data would potentially be a boon to system stability for people using *lots* of applications simultaneously. My reasoning:
1) Internal memory is much faster than the SD card interface, even at class 6.
2) Using Apps2SD in combo with android's default mem management, if an app is auto-killed and needs to be restored into memory, it's reloading the apk from the SD card. Due to this behavior, there's little difference between using a swap partition on the card vs android reloading apps from the card and restoring state.
A swap partition or file on internal memory would avoid touching the SD card interface alltogether except when inititally starting up a new app. Storage space benefits of apps2sd is retained, while potentially speeding access to a sleeping app.
So, to test out the theory, I tried to create a 64mb swap file in /data/swap/swapfile, using the following steps (again, this is on the MoDaCo ROM):
Code:
./adb shell
# mkdir /data/swap
# dd if=/dev/zero of=/data/swap/swapfile bs=1024 count=65536
65536+0 records in
65536+0 records out
# mkswap /data/swap/swapfile
Setting up swapspace version 1, size = 67104768 bytes
UUID=ca4e84af-2533-4072-8c66-7bf6f494dc34
Awesome so far. Now I hit a snag:
Code:
# swapon /data/swap/swapfile
swapon: /data/swap/swapfile: Invalid argument
It appears that the swapon function in BusyBox doesn't support swap files, unless I'm overlooking a step in here.
Has anyone tried this sort of thing before (on previous android phones, or other roms that is)? A quick google search showed lots of people doing this exact thing to enable swap files on their G1's, rooted with BusyBox installed, nad having it work just fine.
For reference, the MoDaCo ROM has this version of BusyBox:
BusyBox v1.15.2 (2009-10-08 09:47:18 BST) multi-call binary
Any hints or help would be greatly appreciated.
could you possibly use a symlink to trick it into thinking it's not a file, but a partition instead maybe?
EDIT: Just saw this thread too, don't know if you've seen it or not, but it seems like an app that could do this for you. Again, you'd have to trick it by using a symlink or something I bet, since you're wanting to do it on the internal memory.
http://forum.xda-developers.com/showthread.php?p=3329186#post3329186
symlink trickery didn't work for me unfortunately, but I think I have another approach.
swapon appears to be looking for a device node, so I'm going to try to trick the system into giving it one by mounting a fake disk image with loopback, and assigning it's 'partition' as swap space.
not really sure if android will let me do that sort of crazyness, or if loopback is even compiled into the fs drivers, but will find out shortly.
[edit]
So, it turned out to be far simpler than all that nonsense above. This kind of thing is why I love linux:
Code:
# * made 8mb swapfile using steps in previous post, to /data/swap/swapfile *
# losetup /dev/block/loop0 /data/swap/swapfile
# swapon /dev/block/loop0
magic!
Code:
# free
total used free shared buffers
Mem: 196824 191320 5504 0 24
Swap: 8184 0 8184
Total: 205008 191320 13688
Now, just need to figure out how to mount it up at boot and set a reasonable swappiness.
Well, it was a good experiment. One that I *do not recommend* for others to try.
After getting the swap file setup and running for a few days, most things work really well - the SenseUI interface is always snappy, applications running in the foreground are generally very responsive and smooth.
Unfortunately, *anything* that gets swapped out of main memory will hang your phone for a good 30-40 seconds at least trying to read it back in to main mem (therefore swapping something else out simultaneously). Things like the web browser, the notification pulldown, the apps menu, just become completely unusable. And this was with 'swappiness' set down to 10 - so theoretically there should not have been excessive swapping.
Good to know we have these tools available in times of need, however I again do not recommend swap of any kind, SD card or otherwise.
Too bad we can't upgrade the RAM on these devices

[Q] Cannot Format /Data

Whenever I try to format /data through CWM 3.0.2.8, it returns the message.
error while formatting /data
Click to expand...
Click to collapse
Also when I try to restore a backup, CWM cannot format /data.
I've also tried to install CM7. It says it completed its install in CWM but when I reboot, it retains the OS (rooted stock 1.2) I was currently on.
Me too. I just updated to MR1 and I am trying to restore the /data directory and I can't.
There's one thing I noticed about this refurb'd nook color. The space available in the device info is 1GB. Shouldn't it be higher or did they change the file structure with the latest models?
Also, I went into ADB and mounted EMMC. The last modified date for the files in there is May 4th.
Edit
Not sure if this would help.
~ # fdisk -l /dev/block/mmcblk0
fdisk -l /dev/block/mmcblk0
Disk /dev/block/mmcblk0: 7944 MB, 7944011776 bytes
255 heads, 63 sectors/track, 965 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 * 1 9 72261 c Win95 FAT32 (LB
A)
/dev/block/mmcblk0p2 10 18 72292+ c Win95 FAT32 (LB
A)
/dev/block/mmcblk0p3 19 56 305235 83 Linux
/dev/block/mmcblk0p4 57 965 7301542+ 5 Extended
/dev/block/mmcblk0p5 57 114 465853+ 83 Linux
/dev/block/mmcblk0p6 115 789 5421906 83 Linux
/dev/block/mmcblk0p7 790 834 361431 83 Linux
/dev/block/mmcblk0p8 835 965 1052226 c Win95 FAT32 (LB
A)
~ #
Click to expand...
Click to collapse
~ # parted /dev/block/mmcblk0
parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
print
print
Model: MMC SEM08G (sd/mmc)
Disk /dev/block/mmcblk0: 7944MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 74.0MB 74.0MB primary fat32 boot, lba
2 74.0MB 148MB 74.0MB primary fat32 lba
3 148MB 461MB 313MB primary ext2
4 461MB 7937MB 7477MB extended
5 461MB 938MB 477MB logical ext2
6 938MB 6490MB 5552MB logical ext3
7 6490MB 6860MB 370MB logical ext3
8 6860MB 7937MB 1077MB logical fat32 lba
(parted)
Click to expand...
Click to collapse
Someone responded back to me on this forum.
http://androidforums.com/b-n-nookcolor/333668-format-internal-partition.html#post2672750
Barnes & Noble has started shipping new NOOK Color devices that are partitioned to allow only 1 GB of "user sideloaded" storage. The remaining 7 GB are partitioned for the OS, apps from the new B&N Apps store, and items downloaded directly from B&N. For the typical (non-rooted) device, the user would have to use the microSD slot for additional storage. I suspect you got one of the newly partitioned devices, which is why you are now seeing only 1 GB instead of the previous 5 GB of storage available.
Click to expand...
Click to collapse
Is there anyway to repartition the new devices or I'm stuck with this? If not, it's going to prevent me from dualbooting. This might also be the cause of my second problem, installing CM7 and still ending up with the original OS.
Oh man am I glad I found this thread. I was freakin' out when I couldn't load phiremod onto my newly purchased NC. Turns out I can only see 1GB of storage like the others in this thread. Hopefully some one will find a way to repartition the newer devices otherwise I am stuck with a rooted NC running the stock ROM with no way to return it.
You can just "Reset to factory default" and it'll remove the root. Then you can try to return it or exchange it. I'd probably say this if they ask for a reason...
"It's showing 1GB space as opposed to 8GB space as advertised"
Though I'm wondering why install CM7 doesn't change anything. After installation, it still boots up the stock OS.
jb7038 said:
You can just "Reset to factory default" and it'll remove the root. Then you can try to return it or exchange it. I'd probably say this if they ask for a reason...
"It's showing 1GB space as opposed to 8GB space as advertised"
Though I'm wondering why install CM7 doesn't change anything. After installation, it still boots up the stock OS.
Click to expand...
Click to collapse
Trying to load new ROMS fails because I can't do a data wipe as instructed.
I wonder if they made it so that outside sources can't write or modify /data now but it's still rootable with manualnooter.. I can format the other partitions through CWM and restore them easily.
EDIT
http://www.barnesandnoble.com/nookcolor/features/index.asp?cds2Pid=35583
*1GB = 1 billion bytes; Actual formatted capacity may be less. Approximately 5GB available to store content, of which up to 4GB may be reserved for content purchased from the Barnes & Noble NOOK Store.
I am not sure what kind of security they could have on the actual partitions, but the dual boot ROMS show that resizing the partitions should not be to hard, though it does mean you may lose data (possibly).
I don't mind losing my /data. I rather be able to install CM7 or something on the EMMC as opposed to running it on the SD.
I'd be grateful if someone could show me how to partition it so it's back to the original partition, 4gb/4gb as opposed to 7gb/1gb I think.
I hope something is figured out soon.
Here's the solution to anyone following this thread.
http://forum.xda-developers.com/showpost.php?p=13971291&postcount=110
I had this problem too.. bought a brand new nook color... this is what i did using CWM 3.0.2.8 to boot off SD...
1. used manual nooter 4.5.6
(after applying had all types of popup force close messages about /media this /media that)
2. changed my patitions to match this post
http://forum.xda-developers.com/showpost.php?p=13003431&postcount=166
(Note: Although it said that it didnt write the partitions it actually did)
3. did the 8 boot reset and nook button reset...
(This didn't reset the partitions actually and I had 5.sumthin GB free space not 1GB as before)
4. Manual nooted again then installed Phiremod 6.2 and Dalingrin's Kernel 042411 for cm7....
Sparks1641 said:
I had this problem too.. bought a brand new nook color... this is what i did using CWM 3.0.2.8 to boot off SD...
1. used manual nooter 4.5.6
(after applying had all types of popup force close messages about /media this /media that)
2. changed my patitions to match this post
http://forum.xda-developers.com/showpost.php?p=13003431&postcount=166
(Note: Although it said that it didnt write the partitions it actually did)
3. did the 8 boot reset and nook button reset...
(This didn't reset the partitions actually and I had 5.sumthin GB free space not 1GB as before)
4. Manual nooted again then installed Phiremod 6.2 and Dalingrin's Kernel 042411 for cm7....
Click to expand...
Click to collapse
I did this too and it scared the crap out of me when it kicked me out of fdisk. I thought I hosed it for good. Then when I did the 8 resets it kept going into CWM on the 8th reset. It wasn't until I rebooted it from CWM did it go and reflash itself.
Man that was scary. I thought I had a $250 paper weight.
I was a little freaked out when the fdisk said it didn't work... But reading around I seen that its almost impossible to break it as long as you don't mess with the first 3 partitions so what was the worse case I figured... This must be an issue with the CWR though.. Probably just updating the CWR to format different sizes of the partitions... A format with offset and length feature in an advanced menu... then we can change the sizes to what we want.. But going forward until CWR gets updated every new nook probably gonna have to do the partition change... Not like that's a big deal...
I bought a Nook Color used off craigslist cus they "bricked" it. I thought, no prob, through in the CWM uSD card, erase the data and system, and throw 1.2 on to root.
Can't erase the Data!
They said it was only a few weeks old. I'm guessing it was a refurb with new partition, they tried to root it somehow, and messed it up, then gave up.
Let's hope this fixes it!
Let us know if the partition thing works.. that would be cool.. GL.....
Sparks1641 said:
Let us know if the partition thing works.. that would be cool.. GL.....
Click to expand...
Click to collapse
I did the repartition here:
http://forum.xda-developers.com/showthread.php?t=1094371
and it worked like a charm - finally have CM7 on my 4th Nook!
Thanks to DeanGibson.

[Q] How do I partition the eMMC to support Custom ROMs?

I bought my NC last week and immediately rooted it with out a hitch using ManualNooter for stock 1.2. In the process of trying to flash Phiremod my NC locked up in CWM when doing a wipe data/factory reset as instructed. I did a hard reset and tried to load Phiremod any way, which failed. I ended up using the backup I made of the rooted clean stock OS and it is working.
I read this thread
http://forum.xda-developers.com/showthread.php?t=1077973
and mine has the same issue of a partitioned eMMC that only reports 1GB. This prevents me from loading custom ROMs and side loading any applications.
One of the posts on that last thread mentions how dual booting essentially repartitions your eMMC to allow for the said dual booting, so I tried the "Step 1" in the repartition process here...
http://forum.xda-developers.com/showthread.php?t=959461
And it failed, but did boot back into my stock rooted OS.
My question is...
Is there a way to repartition my NC with what seems to be a new partition scheme that B&N moved to so that I can load custom ROMs, sideload programs, and/or dual boot off of eMMC?
Would like to see this answered as well.
grab your oars....
I'm in the same boat.... I have the 1 gig partition on my new Nook.
I can boot from SD ok but I would rather blow out the stock and save my SD.
Help?
MBK
Anyone out there can help us repartition the newer nooks?
side load partition 1 gb on newer NC's
guys check this out. I am doing it now and will report back after I get this done.
http://forum.xda-developers.com/showthread.php?t=914690
boot repartition with stock 1.0.0 or 1.0.1, then side load 1.2 update from b&n site:
http://www.barnesandnoble.com/u/nookcolor-support-software-update/379002520/
If I read all this correctly.. this should do the trick. as well as re-enabling apk installs correctly with rooted stock?
Already tried that.
You'll get a 1.0.0 or 1.0.1 with 0 Space available and you cannot sideload because of that. All that does is re-write the folders and not partition it.
I even tried changing the factory.zip with an older version in the /emmc and did a system/data wipe through the 8 boot fails and power + n reset.
One possibility
jb7038 said:
Anyone out there can help us repartition the newer nooks?
Click to expand...
Click to collapse
If you are familiar with fdisk and mkfs.ext2 or are willing to learn, and can boot a rooted OS from the SDcard, it should be trivial to delete, resize, repartition, and reformat /data (0p6 -- ext3), /cache (0p7 -- ext3) and /media (0p8 -- vfat). Do note the size of the partitions (especially 0p7/cache) before deleting them.
Then, when you restart the NC, it should recreate the contents of /data and /media to virgin content (meaning you better have backed up any non-B&N content). You will have to reregister with B&N, so you should probably do this on an UNROOTED Nook.
This is an experiment that I have wanted to try, but have not had the time; I've been too busy doing other experiments, like having B&N do the intentional repartitioning. I was using internal dual boot before, but uninstalled it before the repartitioning, because I knew there would not be enough space for dual boot afterwards.
I'm just unfamiliar with the block sizes and the commands to partition/change it.
/dev/block/mmcblk0p6 115 789 5421906 83 Linux
/dev/block/mmcblk0p7 790 834 361431 83 Linux
/dev/block/mmcblk0p8 835 965 1052226 c Win95 FAT32 (LBA)
Click to expand...
Click to collapse
6 938MB 6490MB 5552MB logical ext3
7 6490MB 6860MB 370MB logical ext3
8 6860MB 7937MB 1077MB logical fat32 lba
Click to expand...
Click to collapse
____________________________________________
I do have the NC I'm suppose to send back that's fully wiped.
~ # fdisk -l /dev/block/mmcblk0
fdisk -l /dev/block/mmcblk0
Disk /dev/block/mmcblk0: 7944 MB, 7944011776 bytes
4 heads, 16 sectors/track, 242432 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Device Boot Start End Blocks Id System
~ #
Click to expand...
Click to collapse
~ # parted /dev/block/mmcblk0
parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
print
print
Model: MMC SEM08G (sd/mmc)
Disk /dev/block/mmcblk0: 7944MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
(parted)
Click to expand...
Click to collapse
I'd be willing to partition it myself before I send it back if someone could walk me through it.
DeanGibson said:
If you are familiar with fdisk and mkfs.ext2 or are willing to learn, and can boot a rooted OS from the SDcard, it should be trivial to delete, resize, repartition, and reformat /data (0p6 -- ext3), /cache (0p7 -- ext3) and /media (0p8 -- vfat). Do note the size of the partitions (especially 0p7/cache) before deleting them.
Then, when you restart the NC, it should recreate the contents of /data and /media to virgin content (meaning you better have backed up any non-B&N content). You will have to reregister with B&N, so you should probably do this on an UNROOTED Nook.
This is an experiment that I have wanted to try, but have not had the time; I've been too busy doing other experiments, like having B&N do the intentional repartitioning. I was using internal dual boot before, but uninstalled it before the repartitioning, because I knew there would not be enough space for dual boot afterwards.
Click to expand...
Click to collapse
Dear God I would love to try but honestly I don't know a think about command line linux. Also, mine is already rooted, but I can always take it back to stock.
If someone gets this to work please document the process. I would really like to be able to use the internal memory for custom ROMs and be able to side load programs.
Anyone that can help us?

[Q] Defy Swap Partition

Please can some one who succeeded to enable Swap on defy can explain me how did he did.
I have my sd card partitioned on a normal fat32 partition and a linux swap partition
Im on cm7.2 defy+ nightly 06.5.2012 with the cm9 kernel as a base with walter's 4.5.2_DHT-22_kernel on top.
solution
kHron0S said:
Please can some one who succeeded to enable Swap on defy can explain me how did he did.
I have my sd card partitioned on a normal fat32 partition and a linux swap partition
Im on cm7.2 defy+ nightly 06.5.2012 with the cm9 kernel as a base with walter's 4.5.2_DHT-22_kernel on top.
Click to expand...
Click to collapse
Well last night i just installed this app on my defy mb525 running cm10 2ndboot latest build and quarx kernel and it worked for me just install this app and then open it click on help and you will understand the whole thing! it works for me now i got 1 gb memory
Internal Swap
You can create a swap file inside your /data partition (faster than SD Card) and enable it (I've tested it on my Galaxy 5 but never on my Defy+).
Create the file: (131072/1024=128MiB)
dd if=/dev/zero of=/data/internal_swapfile bs=1024 count=131072
Prepare the file:
mkswap /data/internal_swapfile
Activate swap:
swapon /data/internal_swapfile
rafaelsoaresbr said:
You can create a swap file inside your /data partition (faster than SD Card) and enable it (I've tested it on my Galaxy 5 but never on my Defy+).
Create the file: (131072/1024=128MiB)
dd if=/dev/zero of=/data/internal_swapfile bs=1024 count=131072
Prepare the file:
mkswap /data/internal_swapfile
Activate swap:
swapon /data/internal_swapfile
Click to expand...
Click to collapse
It works! Thanks :laugh: :highfive:
rafaelsoaresbr said:
You can create a swap file inside your /data partition (faster than SD Card) and enable it (I've tested it on my Galaxy 5 but never on my Defy+).
Create the file: (131072/1024=128MiB)
dd if=/dev/zero of=/data/internal_swapfile bs=1024 count=131072
Prepare the file:
mkswap /data/internal_swapfile
Activate swap:
swapon /data/internal_swapfile
Click to expand...
Click to collapse
diamond_lover said:
It works! Thanks :laugh: :highfive:
Click to expand...
Click to collapse
hi mate .. i was just goin trough this post and i am like interested in doing this ... can you help me pliz
i create the file 128mb ... ( can i create a bigger one Example: 256mb or 512 mb ????
and do i need to type those commands in terminal ???
if yes .. then just by typing this command the Rom Just start using the file...
But y do we need a swap file .. please any1 answer me post
Thanks
mRibti
ibtihaaz said:
hi mate .. i was just goin trough this post and i am like interested in doing this ... can you help me pliz
i create the file 128mb ... ( can i create a bigger one Example: 256mb or 512 mb ????
and do i need to type those commands in terminal ???
if yes .. then just by typing this command the Rom Just start using the file...
But y do we need a swap file .. please any1 answer me post
Thanks
mRibti
Click to expand...
Click to collapse
you can set any size just replace the count with the amount of swap you want (for 256Mb it would be 256*1024=262144)
however,
i'm no expert but i would seriously consider using data partition for swap as i don't think it's suitable for continous reading and writing which can decrease your internal memory's lifetime. i'd choose to create swap partition on sdcard if it's class is good enough rather than using internal memory as the sdcards can be easily replaced contrarary to nand memory.

Zram vs Swap

So let's start this off by explaining both of them.
Zram basically compresses unused apps within the system RAM. This allows the system to swap less needed processes to the Zram partition for faster access at a later time, instead of killing them. This does take up some of your ram though, so I imagine that the value you are setting is determining exactly what percentage of your ram that the zram partition is allotted.
Swap instead uses a small portion of the SDcard like RAM. The phone will attempt to keep as much within the ram as possible until fill, and then begin using the swap partition on the SDcard. At that point, the phone will begin moving inactive blocks of memory to the SD, freeing up RAM for active processes. If one of the pages on the SD needs to be accessed again, it will be moved back into RAM, and a different inactive page in RAM will be moved onto the SD ('swapped').
Swap files don't restrict available RAM but writing to the sdcard impacts the speed of opening apps.
And if I'm not wrong, swap also shorten the lifespan of your SD Card.
So what do you think? Zram or swap is better?
Sent From My Sony Xperia Arc S
For me the swap is better
I'm using swapit expander and it let me use 1600 mb as ram and give me better gaming experience(mutch less lag)
Sent from my Lt15i using xda app-developers app
MontyAlHabbash said:
For me the swap is better
I'm using swapit expander and it let me use 1600 mb as ram and give me better gaming experience(mutch less lag)
Sent from my Lt15i using xda app-developers app
Click to expand...
Click to collapse
Much less lag...? With that amount of swap memory it should FLY.
Can you please share with us the file of swapit expander,. the link that google is giving us is not working anymore,. please:crying: i think it's the prev. version 1.3.3
omersonster said:
Can you please share with us the file of swapit expander,. the link that google is giving us is not working anymore,. please:crying: i think it's the prev. version 1.3.3
Click to expand...
Click to collapse
isn't sharing paid apps against the ROLL
MontyAlHabbash said:
isn't sharing paid apps against the ROLL
Click to expand...
Click to collapse
Oops sorry didnt know about that, this is my first post by the way,,. :laugh:
I think swap is better, maybe with a class 10 microSD, but how can I make my phone use a swap partition? Is there a mod, a script or a root-app?
Use swapper2 from the market, it's free. Use a partition app on windows or gparted on linux to create a swap partition for best results, but with that app you don't have to.
No need for partition for swap
Sent from my R800i using xda app-developers app
Anyone had their sdcard that died in swap before?
Sent From My Sony Xperia Arc S
Using swap didn't kill you sd-card, you have to wait for 10 years for.
Anyway, there is a simple way to activate swap and take more apps on multitask, just do this.
Create with minitools in your sd-card these partitions in this order :
- fat 32 (any size)
- ext2 (512MB, to use with link2sd and move apps on)
- swap (min 256, max 1gb)
Then, go on adb shell and enter these commands :
- swapon /dev/block/mmcblk0p3 (3 partitions, otherwise put mmcblk0p2)
- free (to verify swap working)
To get a permanent swap, create a script named userinit.sh in /data/local/ and put this on it :
#!/system/bin/sh
#Swap
swapon /dev/block/mmcblk0pX (x is 2 or 3, see higher)
Save it, and in adb shell enter this command: chmod a+x /data/local/userinit.sh
Finally also on adb shell, this last command :echo vm.swappiness=60 >> /system/etc/sysctl.conf
Personnaly i use 0 on swappiness to got more reactivity.
Reboot and enjoy.
mekayzer said:
Using swap didn't kill you sd-card, you have to wait for 10 years for.
Anyway, there is a simple way to activate swap and take more apps on multitask, just do this.
Create with minitools in your sd-card these partitions in this order :
- fat 32 (any size)
- ext2 (512MB, to use with link2sd and move apps on)
- swap (min 256, max 1gb)
Then, go on adb shell and enter these commands :
- swapon /dev/block/mmcblk0p3 (3 partitions, otherwise put mmcblk0p2)
- free (to verify swap working)
To get a permanent swap, create a script named userinit.sh in /data/local/ and put this on it :
#!/system/bin/sh
#Swap
swapon /dev/block/mmcblk0pX (x is 2 or 3, see higher)
Save it, and in adb shell enter this command: chmod a+x /data/local/userinit.sh
Finally also on adb shell, this last command :echo vm.swappiness=60 >> /system/etc/sysctl.conf
Personnaly i use 0 on swappiness to got more reactivity.
Reboot and enjoy.
Click to expand...
Click to collapse
Do this work on locked bootloader?
Sent from my LT18i
KradEdis said:
Do this work on locked bootloader?
Sent from my LT18i
Click to expand...
Click to collapse
Nope, since the kernel dont monitor ext and swap partition.
seems like swap works with 587 stock
mekayzer said:
Nope, since the kernel dont monitor ext and swap partition.
Click to expand...
Click to collapse
I try this with the 587 firmware, AND IT'S WORK : http://forum.xda-developers.com/showthread.php?t=1821071&highlight=swap
On 481, trying to activate swap leads to error.
but do you have stock kernel too??
mortillo said:
but do you have stock kernel too??
Click to expand...
Click to collapse
yes, stock kernel, locked bootloader.
and now swap is working properly?
Lol, i tested it and yes Swapper2 is working with stock kernel!! wow!!
mortillo said:
and now swap is working properly?
Click to expand...
Click to collapse
yes, but i don't see any improvment. And now i don't know how to get rid off those swap
I turn swap off, delete file and uncheck start on boot with swapper_2, but the file is always recreated on boot. It's the same for zram, there is no script that enable it, but on reboot swaps are enabled again :crying:
mekayzer said:
Using swap didn't kill you sd-card, you have to wait for 10 years for.
Anyway, there is a simple way to activate swap and take more apps on multitask, just do this.
Create with minitools in your sd-card these partitions in this order :
- fat 32 (any size)
- ext2 (512MB, to use with link2sd and move apps on)
- swap (min 256, max 1gb)
Then, go on adb shell and enter these commands :
- swapon /dev/block/mmcblk0p3 (3 partitions, otherwise put mmcblk0p2)
- free (to verify swap working)
To get a permanent swap, create a script named userinit.sh in /data/local/ and put this on it :
#!/system/bin/sh
#Swap
swapon /dev/block/mmcblk0pX (x is 2 or 3, see higher)
Save it, and in adb shell enter this command: chmod a+x /data/local/userinit.sh
Finally also on adb shell, this last command :echo vm.swappiness=60 >> /system/etc/sysctl.conf
Personnaly i use 0 on swappiness to got more reactivity.
Reboot and enjoy.
Click to expand...
Click to collapse
Hi mekayzer,
On new .587 fw for Arc, Sony (Ericsson) crew added zram and swap support.
And zram is activated on kernel level (no init.d on stock rom).
Now I added and linux swap partition of 300MB (new class 10 micro SD).
So totally 360 MB for swap.
Any advice how to fine tune this?

Categories

Resources