[MOD][EMMC][I9070/P][8/16GB] Internal Memory Repartition - Galaxy S Advance I9070 Android Development

Internal Memory Repartition
Hey guys, after a very long time I show you the way to repartition your internal memory (EMMC).
You can modify partitions as you want, increase data partition to install more apps, increase internal storage for media files...
It's based on a little Linux binary called Parted, it's a part of CWM/TWRP recovery ramdisk.
This means that you can repartition in any recovery of any 4.2/4.3/4.4 ROM.
==========WARNING==========
Operations on EMMC partitions could be EXTREMELY DANGEROUS if you don't understand well what you do.
If you touch wrong partitions (CSPSA, EFS, SBLs...) you can lose your IMEI or hardbrick your device (in this case only JTAG can save you) so...
READ CAREFULLY!!!!!
Responsibility is all yours, but if you follow well this guide you will not risk anything.
Stock partition table is designed to be used in stock ROM, since it uses preload partition to store some system apps and needs bigger system (ROM is heavier than CM-based ones) and bigger cache partitions (more system apps=more dalvik-cache).
This mod is compatible with any ROM except stock and stock-based.
This is the stock partition table:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
You can touch ONLY:
Kernel2
SYSTEM
DATAFS
CACHEFS
HIDDEN
FOTA
UMS
Kernel2 is the backup of stock kernel, we don't need it.
SYSTEM is the /system partition (where the ROM is installed/stored).
DATAFS is /data partition (default 1.97 GB where are stored installed apps, Android settings, contacts, messages... User data).
CACHEFS is /cache partition (art/dalvik-cache is stored here, together with recovery logs/temporary files. In stock ROM here is stored also CSC. If you repartition to the minimum (at least 5 MB needed for recovery) you need to put dalvik.vm.dexopt.data-only=1 flag in system/build.prop
HIDDEN is /preload partition (some Samsung TouchWiz system apps are stored here and symlinked with /system/app. This is a swap partition on MIUI v5, CM10.2 and all CM11/Omni 4.4 builds (these 4.4 before 15 June), also every custom ROM based on Canjica device tree 4.3/4.4 (always before 15 June), resize it to the minimum (128 KB to format it as EXT2).
FOTA is Firmware Over The Air, so is needed to get OTA updates while on stock ROM, can be directly deleted.
UMS is the internal storage (3.96 GB one), you can repartition this to have less/more space, or repartition to the minimum (8 MB or less, you will need to swap internal/external storages).
Parted commands useful for us:
rm (to delete a partition)
mkpart primary (to make a partition)
format (to format a partition, only in ext2)
name (to rename a partition)
For an extended list/explanation of commands, type "help" without quotes
Let's go!
First make a nandroid backup of your current ROM, to be restored after repartition
If you touch UMS you will lose all the content of /sdcard (internal storage), so make a backup first!
You need a Linux distro or Windows with ADB configured.
Reboot device in recovery and connect to USB, then open ADB and write:
Code:
adb shell
parted /dev/block/mmcblk0
You can choose to display partitions as Gigabytes, Megabytes, Kilobytes (suggested), or Bytes by "unit **" command, where ** can be gb/mb/kb or b
Now type "print" to display partition table.
Parted create new partitions by following "Number", for example SYSTEM is 3, CACHEFS is 4 and DATAFS is 5 (for other partitions is the same), so when you create new partitions, you need to make them in order!! For example:
SYSTEM is 3 and its size is from 105906KB to 747635KB
CACHEFS is 4 and its size is from 2895118KB to 3215983KB
DATAFS is 5 and its size is from 747635KB to 2895118KB
The "end" of a partition is the "start" of the next partition
As you can see, DATAFS is between SYSTEM and CACHEFS. This means that after you create SYSTEM, you need to calculate new DATAFS size that you want and then first create CACHEFS (at the end of calculated DATAFS size) then create DATAFS from the end of SYSTEM to the start of CACHEFS.
To understand more:
We will resize now CACHEFS from 320864 KB to 5000 KB gaining 315864 KB for DATAFS:
Unmount /cache from recovery first!
Code:
rm 4 (to delete CACHEFS)
rm 5 (to delete DATAFS)
calculate now the new size of DATAFS, in this case add 315864 KB to DATAFS end: 2895118+315864=3210982 KB
calculate now the new end of CACHEFS, in this case add 5000 KB to 3210982 KB: 3210982+5000=3260982 KB
mkpart primary 3210982 (end of DATAFS and start of CACHEFS) 3260982 (end of CACHEFS, start of the next partition)
Now we made a new partition, its number is 4. Do: name 4 CACHEFS
It's time to make new DATAFS partition: from the end of SYSTEM to the start of CACHEFS
mkpart primary 747635 (end of SYSTEM and start of DATAFS) 3210982 (end of DATAFS and start of CACHEFS)
New partition has number 5, name it DATAFS by name 5 DATAFS
Basically the method is this, you can apply it to partitions listed above.
Remember to reboot recovery, go in Mounts and storage then (depending on what partitions you touched in Parted, excluding /preload) do the appropriate formats after repartition. Now you're ready to restore your nandroid backup (needs to have less size than new partitions) or install a ROM.
I suggest an useful program to check partition size on Android, Partition Table
If you touch HIDDEN partition and you are on 4.2 ROM or 4.4 builds after 15 June:
Code:
format
y
9
ext2
If you repartition UMS to the minimum, you will need to swap internal and external storages (MicroSD card will be the new internal storage):
On 4.2 open system/etc/vold.fstab and replace the content with this:
Code:
# MicroSD as internal storage
dev_mount sdcard0 /storage/sdcard0 auto /devices/sdi0/mmc_host/mmc1/mmc1
# UMS as external storage
dev_mount sdcard1 /storage/sdcard1 8 /devices/sdi2/mmc_host/mmc0/mmc0 nonremovable,encryptable
# usbdisk
dev_mount usbdisk0 /storage/usbdisk0 auto /devices/platform/msm_hsusb_host.0
On 4.3 ROMs open system/build.prop and add these lines at the end of the file:
Code:
persist.sys.vold.switchexternal=1
ro.vold.switchablepair=/storage/sdcard0,/storage/sdcard1
On 4.4 ROMs just open NovaThor Settings and enable "Swap Storages"
To restore original partition table flash stock ROM through Odin with "Repartition" enabled and correct PIT file for your model, in attachment (extract zip), soon CHN pits too
I know that it's difficult to understand well the first times, but think at me that I developed this method, a lot of testing and bricks on bricks
If you found this useful, you can support me at least by pressing "Thanks" or considering to offer me a beer, a coffee... Any kind of support will be very appreciated ​

Reserved for "The PIT Zone" (soon available!)

Reserved

Another reserved just in case!!

So, I want to shrink UMS (let's say by 1GB) and use it in DATAFS.
What would be the command sequence?
Thank you,
Tasos

tasosf said:
So, I want to shrink UMS (let's say by 1GB) and use it in DATAFS.
What would be the command sequence?
Thank you,
Tasos
Click to expand...
Click to collapse
All what you should know it's wrote in the OP.
You can make our way... rm anything after Kernel2, calculate datafs+1024MB more and make again all partitions, name and format them. Read again and well the OP for clarifications, it's all wrote there
Inviato dal mio GT-I9505

I didnt found any info about it in OP so i ask:
Every partition made using this guide will be formatted as ext2? Ext2 is worse than ext4 so probably it will affect performance, am i right about it?

Command "format" didnt work for me
Instead i used "mkfs <number> ext2" (however it asks about number and filesystem later) and i think "mkpartfs primary ext2 <start> <end>" could be the easiest as it create partition and format it in the same moment so its not needed to remember later

ch3mn3y said:
Command "format" didnt work for me
Instead i used "mkfs <number> ext2" (however it asks about number and filesystem later) and i think "mkpartfs primary ext2 <start> <end>" could be the easiest as it create partition and format it in the same moment so its not needed to remember later
Click to expand...
Click to collapse
Format didn't work for me either. I formatted everything through TWRP to ext4.
So, this method works! I now have 3GB for data so to have all the apps installed in the internal storage and not the internal sd card (ums). This way all apps are faster because ums is formatted as fat 32 in order to be recognised on Windows.
One tricky thing was that you have to mkpart from low numbers to high, regardless if you leave for a moment organ intermediate megabytes. The system always gives the next available number to the partition you make. It may not make sense how I try to explain it, but keep it in mind when you try it.
Sent from my GT-I9070 using XDA Free mobile app

I do exactly opposite thing as made smaller DATAFS, SYSTEM and CACHEFS to have bigger UMS. Its googd that Kernel2, HIDDEN and Fota are after "more" important partitions, so we can get rid of them and get lot of space
tasosf said:
The system always gives the next available number to the partition you make. It may not make sense how I try to explain it, but keep it in mind when you try it.
Click to expand...
Click to collapse
Yep, its important to not make mistakes, coz who wants to do something few times?

ch3mn3y said:
I do exactly opposite thing as made smaller DATAFS, SYSTEM and CACHEFS to have bigger UMS. Its googd that Kernel2, HIDDEN and Fota are after "more" important partitions, so we can get rid of them and get lot of space
Click to expand...
Click to collapse
How come you want to have bigger UMS? Not all apps can be installed there and DATAFS gets full very easily. Also, it's fat32 which creates some problems by itself.
Sent from my GT-I9070 using XDA Free mobile app

I just dont use this phone as my primary and as i have xplay for games i dont need to have lots of apps on it. Additionaly i have only 4gb sdcard for it, so my internal memory is now bigger than external
Sent using TF300T - CyanogenMod 11.0/GRIMLOCK (F2FS)

i'd really like to repartition my phone's memory but i fear i'm gonna screw everything up
i see a coming soon "pit zone" in the second post, does that mean that there is an automatic way to repartition the internal memory without directly using commands?

If u knows how to make pit file after repartitioning its probably possible to use odin to repartition
Sent using GT-i9070 - VanirAOSP

You need to use "format" command in ext2 only for HIDDEN partition that it's unneeded on custom ROMs.
For other partitions (SYSTEM, CACHEFS, DATAFS) format through recovery mode (automatically formatted in ext4), and for UMS through Android.
Yes, the PIT zone will have PIT files ready to be flashed to autorepartition along with a kernel that brings you CWM recovery to install/restore your ROM after repartition.
Inviato dal mio GT-I9505

AntaresOne said:
You need to use "format" command in ext2 only for HIDDEN partition that it's unneeded on custom ROMs.
For other partitions (SYSTEM, CACHEFS, DATAFS) format through recovery mode (automatically formatted in ext4), and for UMS through Android.
Yes, the PIT zone will have PIT files ready to be flashed to autorepartition along with a kernel that brings you CWM recovery to install/restore your ROM after repartition.
Inviato dal mio GT-I9505
Click to expand...
Click to collapse
i will definitely wait for the pit files then all i'm looking for is to get rid of those useless partitions like FOTA, Kernel2 etc. just to have more space on the internal memory for apps

TheSteve87 said:
i will definitely wait for the pit files then all i'm looking for is to get rid of those useless partitions like FOTA, Kernel2 etc. just to have more space on the internal memory for apps
Click to expand...
Click to collapse
Completely agree mate. Also HIDDEN, you don't need it on CM/CM-based custom ROMs
Inviato dal mio GT-I9505

I really have to say this guide is just A-W-E-S-O-M-E
The process is not that easy but very well explained

A complicated by well explained method for partition........But i am a bit afraid to use .... Can u help out with the step for my issue...?
My Phone: S Advance
(Rooted with the help of http://forum.xda-developers.com/showthread.php?t=2087424)
RAM= 768 MB RAM,
ROM= 2 GB //*Note phone shows this as device storage, Pl correct if I am wrong*//
Internal=16 GB (user available=11.31 GB), //*Note phone shows this as USB storage, Pl correct if I am wrong*//
external micro SD card = Nil
I want to increase the RAM Or ROM so that my mobile should not lags/hangs
I feel that mobile is slow mainly due to less RAM......pl correct if I am wrong
I want to use the the 1GB/2GB/3GB/4GB out of Internal 16 GB to increase the size of ROM from 2GB to 3GB/4GB or RAM from 768 MB to 1GB/2GB/3GB/4GB more.....
Pl help me out with the specific steps.....
Thanks a lot @AntaresOne

@anil.xda
Yes, just 768 MB of RAM is one of the biggest performance limiting factors of this phone but sadly you can't just "increase it". You'll have to use something like a zRAM or a SWAP script. But this is just a workaround - and it too has some drawbacks I think.
Sent from my GT-I9070

Related

[ANSWER] Safe Partitioning - How to confirm?

As we all know, most of our phones have at least a couple of bad blocks in the NAND memory. The biggest and most common problem because of this is that when you create a partition of 'x'MB, the actual partition will be 'x-something'MB. This is because partitioning does not account for bad blocks.
So if a ROM requires 150MB of /system partition (which you create - using HD2 Toolkit or cLK 1.5), you *might* end up with less than 150MB. ROM devs usually factor this in and give a room of at least 5 ~10 MB for installing additional stuff in /system as well as bad blocks. But you will have a problem if the 150 MB partition you create has enough bad blocks making it less than, in my example, 145 or 140 MB.
The most safest way I have seen to make sure you /system has enough space-
Extract you ROM's zip file, and check the size of the directory named system
Repartition your phone like you normally do
Boot to ClockWorkMod and format all partitions
Mount the /system partition in ClockWorkMod
Connect your phone to your computer, ensure you had ABD drivers installed
Head to QtADB and download the most appropriate version for you - there is one for Linux x86, Linux x64, Windows and Mac. Also download the required binary files for Linux, Windows or MacOS. Extract all QtADB zip as well as the binary zip to the same directory. Launch QtADB. On first launch, if it asks for the binaries, point it to the right directory
In QtADB, select the "Phone Info" icon. You will see something like this:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
As you can see from the image, my /system is 195.31 MB. I had partitioned my NAND for 200 MB system partition, but am losing 4.69MB to bad blocks
If I am installing a ROM, I need to make sure the system directory in its zip file does not exceed this size, or increase the partition size accordingly.
Also, when flashing a ROM, you can refresh QtADB to see the /system partitioning filling up. Make sure the actual space in the system partition is 10 or 15 MB larger than the ROM's system directory. The most common symptom of an inadequate system partition is bootlooping, and other weird/ uncommon behavior.
Hope this little guide helps at least some of us. Happy Flashing
ph03n!x said:
As we all know, most of our phones have at least a couple of bad blocks in the NAND memory. The biggest and most common problem because of this is that when you create a partition of 'x'MB, the actual partition will be 'x-something'MB. This is because partitioning does not account for bad blocks.
So if a ROM requires 150MB of /system partition (which you create - using HD2 Toolkit or cLK 1.5), you *might* end up with less than 150MB. ROM devs usually factor this in and give a room of at least 5 ~10 MB for installing additional stuff in /system as well as bad blocks. But you will have a problem if the 150 MB partition you create has enough bad blocks making it less than, in my example, 145 or 140 MB.
The most safest way I have seen to make sure you /system has enough space-
Extract you ROM's zip file, and check the size of the directory named system
Repartition your phone like you normally do
Boot to ClockWorkMod and format all partitions
Mount the /system partition in ClockWorkMod
Connect your phone to your computer, ensure you had ABD drivers installed
Head to QtADB and download the most appropriate version for you - there is one for Linux x86, Linux x64, Windows and Mac. Also download the required binary files for Linux, Windows or MacOS. Extract all QtADB zip as well as the binary zip to the same directory. Launch QtADB. On first launch, if it asks for the binaries, point it to the right directory
In QtADB, select the "Phone Info" icon. You will see something like this:
View attachment 1081288
As you can see from the image, my /system is 195.31 MB. I had partitioned my NAND for 200 MB system partition, but am losing 4.69MB to bad blocks
If I am installing a ROM, I need to make sure the system directory in its zip file does not exceed this size, or increase the partition size accordingly.
Also, when flashing a ROM, you can refresh QtADB to see the /system partitioning filling up. Make sure the actual space in the system partition is 10 or 15 MB larger than the ROM's system directory. The most common symptom of an inadequate system partition is bootlooping, and other weird/ uncommon behavior.
Hope this little guide helps at least some of us. Happy Flashing
Click to expand...
Click to collapse
Thanks for this, I've been looking for a way to check something like this out. I don't have the time now though, but I might try it later depending again on time constraints. I feel that for now I'm OK since I've only had the phone since Jan 2011 and I used SD Android for quite a while before switching to NAND, but it never hurts to know things like this. Thus far though the recommended partition size has always worked for me and I've always seen 2-3Mb space free in the 'System ROM' setting in Titanium backup.
In fact, that gets me wondering can you literally just do step 1, then flash a partition size larger than needed (e.g. for a 150Mb ROM flash a 200Mb partition), calculate how much space you should have free (i.e. 50Mb in this case), check in Titanium Backup how much space you actually have free and subtract the latter from the first, giving you the free space? If this would work, it would save even more time.
Of course, I may be COMPLETELY misunderstanding what the 'System ROM' thing in Titanium Backup is, tbh I'm not into the technical side of things very much.
@Nigeldg- Titanium Backup is something I used to check the sizes earlier. But then, it's not quite accurate. My 200MB /system partition shows as 209MB in Titanium
I have never had any issues in using a bigger partition than required. I initially had a 445 MB as default when I was trying out a bunch of ROMs...
Swyped from my HTC HD2 (ICS 4.0.4)
ph03n!x said:
@Nigeldg- Titanium Backup is something I used to check the sizes earlier. But then, it's not quite accurate. My 200MB /system partition shows as 209MB in Titanium
I have never had any issues in using a bigger partition than required. I initially had a 445 MB as default when I was trying out a bunch of ROMs...
Swyped from my HTC HD2 (ICS 4.0.4)
Click to expand...
Click to collapse
Actually I see you're right, my 165mb partition reads as 173mb. Still, perhaps it's consistently 8-9mb over? Just a guess, although I would obviously need someone with a different partition size to confirm this
Nigeldg said:
Actually I see you're right, my 165mb partition reads as 173mb. Still, perhaps it's consistently 8-9mb over? Just a guess, although I would obviously need someone with a different partition size to confirm this
Click to expand...
Click to collapse
For a raw sizing, open terminal emulator (or ADB shell) and type df
Again, this wont count the bad blocks you have...
when you wantto flash a new rom, first resize the system partition with more 10M than the new rom needed... it is a simple method to solve the problem...
Good find ph03n!x !!! I just use root explorer to determine my partition sizes. Lucky, ive only had bad blocks in my userdata partition. (Knocks on wood) Hopefully i wont have anymore
ph03n!x said:
@Nigeldg- Titanium Backup is something I used to check the sizes earlier. But then, it's not quite accurate. My 200MB /system partition shows as 209MB in Titanium
I have never had any issues in using a bigger partition than required. I initially had a 445 MB as default when I was trying out a bunch of ROMs...
Swyped from my HTC HD2 (ICS 4.0.4)
Click to expand...
Click to collapse
I know this thread is a bit old now and generally I don't bring up an old thread again, but in Tytungs CM9 there was a short discussion about this and I was given a solution by agbommarito:
agbommarito said:
Titanium Backup has an option under GUI Preferences to change its interpretation of memory. If it is set for binary units, a kilobyte = 1024 bytes and Titanium will display MiB. If it is set for decimal units, a kilobyte is 1000 bytes and Titanium will display MB (without the little "i').
165 MiB (where a MiB is 1024x1024) = 173 MB (where a MB is 1000x1000).
Click to expand...
Click to collapse
So if anyone wanted to check their partition size, they CAN just use Titanium to do it
@nigeldg, I tried that and am getting 200MB, which is indeed my partition size- but it is not accounting for the bad block I have in my /system!
_
Swyped from my HTC HD2 (ICS 4.0.4)
ph03n!x said:
@nigeldg, I tried that and am getting 200MB, which is indeed my partition size- but it is not accounting for the bad block I have in my /system!
_
Swyped from my HTC HD2 (ICS 4.0.4)
Click to expand...
Click to collapse
Alright I get it now. Perhaps flashing a larger partition size, then seeing how much free space you should have in /system versus seeing how much space you actually have in /system would do the trick (basically a combination of the first thing I suggested a while back and the new solution as well). Of course, this wouldn't tell you how many bad blocks you have but the amount of space which is taken up should be sufficient data. Again, I'm not sure whether or not this would work but in theory I think it should.
Well, my point is to check the partition size before flashing a ROM, making sure the actual size on /system is sufficient- by checking the size of the system directory in the ROM's zip
_
Swyped from my HTC HD2 (ICS 4.0.4)

Using 16GB card for streak 5 internal SD

Hmm... this is quite interesting which i taught i want to show you guys this... screenshots taken from my streak 5 of course
When you guys see the red arrow pointing to what... you guys will know what i mean :victory:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
-----------------------------------------------------------
UPDATE:
While i was playing around today, i managed to get it like in the image below. See where the red arrow pointing at? Neat isnt it?
-----------------------------------------------------------
p/s: Using 16GB Kingmax class 10 microSDHC for internal and external sd
Now you guys are curious how i managed to do that?
FIRST OF ALL:
You need to open the streak housing ... follow the link below and good luck.. be gentle and be careful .. just do it slow and steady and you will be ok ... no need to rush anything there ... :good:
http://www.ifixit.com/Teardown/Dell-Streak-Teardown/3512/1
------------------------------------------------------
NEXT - SELECT APPROPRIATE USER TYPE:-
LINUX USERS:
Just follow this link > http://forum.xda-developers.com/showpost.php?p=24799755&postcount=65
WINDOWS USERS:
first.. get this... http://www.alexpage.de/usb-image-tool/
make sure it is USB Image Tool 1.59 when you download...
next get gparted-live-0.13.1-2.iso
burn it to the CD...
- after you have extracted the usb image tool... open USB Image Tool.exe
- select the corresponding usb drive and click backup, save it something like streakinternal.img
- it will take some time to complete ( have instant noodle for the time being )
- once done... replace the sd card that you want to transfer the image to and click restore and select the earlier streakinternal.img
- again.. it will take some time to complete (you can have snack this time )
note: make sure the target sdcard is the same or bigger in size (obviously)...
- once completed...
- reboot your pc and insert the burned CD earlier... let it boot from it... just press enter to everything it ask until it fully loaded into linux environment
- gparted should already show your sdcard drive there... it should show /dev/sda1 and below it got two more partition /dev/sda5 (ext3) and /dev/sda6 (ext3)
- select /dev/sda1 and right click it and select move/resize
- there should be visual displaying the drive structure and on the right, there should be arrow, drag it to the most right, click ok
- now, select /dev/sda6 and right click it and select move/resize
- again, on it, there should be arrow on the right, drag it to the most right and click ok
- once all that done, click apply and it will start to do its work..
- let it completes it work and your sd card now should be able to be use as internal sd...
- your streak should be able to boot straight away.. no need to wipe cache or something like that...
- have fun having big internal sd
p/s: i wrote this based on my memory, i hope i dont messed it up
------------------------------------------------------
POSSIBLE FAQ:
-- 01 --
Q - Will the method used gone if i do factory reset?
A - Nope. You can safely do it and the structure will be maintained.
-- 02 --
Q - Can i use more than 16gb card?
A - Theoretically, yes.
-- 03 --
Q - Can we use this as sd storage as well?
A - Sorry. We cant because it is formated in ext3, so windows see it as unformatted medium.
-- 04 --
Q - Cant we create shortcut in external sd to access it?
A - Sorry. We cant because symlink does not work on any windows formatted medium since external sd usually formatted in fat32
-- 05 --
Q - Cant we mount this at all?
A - Somebody has tried it before but since the internal sd never meant to be accessed externally, the support is pretty much impossible.
-- 06 --
Q - How can we access it and where is it located?
A - To access the space, you can use root explorer and wifi file explorer (anything similar will do) and it is located at /data from /
Therefore, you must be rooted to access it.
-- 07 --
Q - So, what the hell am i supposed to do with those huge extra GBs?
A - Well, you can brag bout it to your friends, saying it got this huge internal sd space and can install hundreds of applications or games and still got space left for more.
------------------------------------------------------
MORE ADVANCED MODS.:
If you think having large innerSD is not enough, we could have larger /system dir and possible dual usb mount support by default (in the near future hopefully) for our streak 5.
Have a visit to the link below...
http://forum.xda-developers.com/showpost.php?p=31643924&postcount=98
-------------------------------------------------------
Our streak 5 might be old but it is still competitive regardless
.
Did u change internal storage?we can use that as sd storage or not?
Sent from my Dell Streak using Tapatalk 2
Which SD card is this? I mean make and class...
Sent from my Dell Streak using xda premium
details please..!!!
BEEN TRYING WITH 16GB CARD...REIMAGED THE CARD WITH EXT3 AND ALL BUT IT WOULD NOT ACCEPT 16GB CARD......PLEASE GIVE US MORE DETAIL ON HOW TOs....THANKS IN ADVANCED..
He just installed a 16gb card and formatted it properly.
You must use extended partitions and not primary ones, at least that's what the stock card is set up as
TheManii said:
He just installed a 16gb card and formatted it properly.
You must use extended partitions and not primary ones, at least that's what the stock card is set up as
Click to expand...
Click to collapse
Does the benefit come from the class of the sd card or the size? or is it the format (ext3vs4 or some such thing)?
ellisna said:
Does the benefit come from the class of the sd card or the size?
Click to expand...
Click to collapse
class for sd card means speed... so the higher the better..
Speed class determines it's actual read and write speed, FS is important as ext4 is the most efficient fs currently available.
It's supposed to be a good deal faster then yaffs2 and more efficient then ext3
TheManii said:
Speed class determines it's actual read and write speed, FS is important as ext4 is the most efficient fs currently available.
It's supposed to be a good deal faster then yaffs2 and more efficient then ext3
Click to expand...
Click to collapse
i go on and make it ext4 both for cache and data for the internal sd.. boots up normally and yes... you can see something faster...
its a shame that the CWM 6 not supported ext4 and therefore nandroid backup is impossible for now...
i also tried and make both internal and external sd not in the slot... and see if streak manages to boot up or not.. well... it stuck at dell logo.. lol
so internal sd is a must so that phone can boot due to the needs of use cache and data dir...
I can easily make a build that supports it, it's just that the rom must also support it.
The rom could likely be modified to mount /firstboot as /data, but there's not enough partitions to also have /cache on the nand.
TheManii said:
I can easily make a build that supports it, it's just that the rom must also support it.
The rom could likely be modified to mount /firstboot as /data, but there's not enough partitions to also have /cache on the nand.
Click to expand...
Click to collapse
i see...
well i am using longhorn 2.9.3...
CWM 6 cant read ext4 because how the script work? i really thought it could since it is newer and i know streakmod had issues with ext4...
but when i am thinking back.. it seems it have same baseworks...
It's turned off on the normal S5 build as ext4 requires additional modules, as it normally doesnt use ext4 I simply built it with them off.
I dont recall of CWM 1.8/2.5 (which streakmod is based off of) even supports ext4, the earliest one I can confirm it does is 4.0 as that was the 1st version built against the stock GB recovery. GB was the 1st rom that uses ext4 by default (on devices that launched with GB or newer)
Themanni.
Can we have a third partition on the inner sdcard??? To use as external storage. If so can you help/guide how to!
Sent from my ST25i using xda premium
I havnt actually tried it (but I plan to some day in the future): just manually make the partitions and add an extra one onto the end for /system.
At that point: unless you follow a standardized layout, you're going to need to manually build CWM as CWM needs to know ahead of time the layout and size of the partitions it's going to deal with. If it doesnt it could lead to corrupt filesystems on flashes/nandroids.
If I ever do build it, it'll either be for a 8 or 16 gb card with a defined set of partitions.
You'll also need to modify the rom to actually boot from innerSDx too.
TheManii said:
It's turned off on the normal S5 build as ext4 requires additional modules, as it normally doesnt use ext4 I simply built it with them off.
I dont recall of CWM 1.8/2.5 (which streakmod is based off of) even supports ext4, the earliest one I can confirm it does is 4.0 as that was the 1st version built against the stock GB recovery. GB was the 1st rom that uses ext4 by default (on devices that launched with GB or newer)
Click to expand...
Click to collapse
well... i would appreciate if you could make it support by default of ext4... no harm to it right?
lol.. i really thought streakmod comes from 4.0 but it seems i missed that... man ... streakmod really so obselete..
TheManii said:
I havnt actually tried it (but I plan to some day in the future): just manually make the partitions and add an extra one onto the end for /system.
At that point: unless you follow a standardized layout, you're going to need to manually build CWM as CWM needs to know ahead of time the layout and size of the partitions it's going to deal with. If it doesnt it could lead to corrupt filesystems on flashes/nandroids.
If I ever do build it, it'll either be for a 8 or 16 gb card with a defined set of partitions.
You'll also need to modify the rom to actually boot from innerSDx too.
Click to expand...
Click to collapse
although i really welcome additional 3rd partition.. dont it have issues with mounting? because how streak works and meant to be, it never have one such as sd-ext ... i mean... some have tried to make it appear on windows but failed miserably.. and thus gave up on it.. and since the fs is ext type, we do need to install driver for it such as Ext2Fsd to make it able to read and write on windows... also.. for media file, it may not detect it unless we explicitly want the third partition to be used only for storage .... but if we can make it able to detect media.. that would be even better...
currently that work wonder is by using wifi file browser for now... for storing file inside /data
sd-ext is/was rather redundant as the S5 has a very large (for it's time) /data.
If anything you'd be better off making a large partition to mount as /sdcard and chainmount the real sdcard as /sdcard/sdcard2 or just /sdcard2 on ICS.
I have no idea how easy/hard all this is, I havnt tried any of it.
It really depends on if the kernal can detect additional partitions beyond innerSD0p6
I've bugged n0p about adding MTP into the ICS kernal so you can simply have a very large /data + /data/media, but he's not interested.
(though like it sounds, it only works on ICS or newer, it was introduced in HC 3.2, but we dont have a rom for that)
TheManii said:
sd-ext is/was rather redundant as the S5 has a very large (for it's time) /data.
If anything you'd be better off making a large partition to mount as /sdcard and chainmount the real sdcard as /sdcard/sdcard2 or just /sdcard2 on ICS.
I have no idea how easy/hard all this is, I havnt tried any of it.
It really depends on if the kernal can detect additional partitions beyond innerSD0p6
I've bugged n0p about adding MTP into the ICS kernal so you can simply have a very large /data + /data/media, but he's not interested.
(though like it sounds, it only works on ICS or newer, it was introduced in HC 3.2, but we dont have a rom for that)
Click to expand...
Click to collapse
thats what i have been trying to do this past weeks.. making it /sdcard and chainmount the real sdcard as /sdcard/sdcard2 but to no avail... as it has no real solution to it...
mtp support is a huge leap since many says it has better file handling protocol but if its get added to ics that we have here.. wow.. that one is a huge plus for us.. :good:
have you edited your vold.fstab?
You need to edit that and change the mounts in your ramdisk at the minimum to do so

[GUIDE] External2Internal Ultimate

I thought about this idea more than a month ago when i came to know that the partitions could freely be altered, but i could not put into practice until i got my 32 gb card yesterday.
so basically, after following my guide you will have:
* supersized data partition (12 gigs): no more move to sd needed unless for huge games (i'm thinking fifa12 and asphalt7) and then again the stock move to sd feature will work as expected (it will move data to the actual external sd card)
* external sd card mounted as internal sd card: nothing to say here, just does what is expected
* real internal sd (ums partition) shrinked to minimum (half gig) because it needs to stay present: used to mount a swap file (optional)
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
What you will need:
* g.lewarne hydracore 4.3b kernel: you don't need it for anything special, but it's the most amazing kernel, and gavin is the most devoted developer ive seen on the n7000. cheers gavin and keep up the good work :good:
* swapper2: if you want to use the swap file (see at the end)
so be warned, i'm no real specialist here, so i'm not aware of the no dos, i just got my guide to work through trial and error and getting information from other threads.
so if you follow my guide you're almost good, if not you may cause an atomic bomb to fall over your city, not my problem :silly:
enough chit chat for now let's head directly for the guide:
1. reboot to recovery, and connect your phone to your pc
2. run a command prompt and type the following (wait a little bit until the adb server starts on the phone, you can verify it by typing "adb devices" if you get a serie of digits then you're good to go.
Code:
adb shell
parted /dev/block/mmcblock0
you'll get into the parted interactive shell, this is where serious work done
Code:
did i remind you to backup your system,
this is your last stop before the no back point
so you just might wanna "move" all your internal sd stuff to the external sd,
and backup your system to the external sd also
(you just need to restore the data partition afterwards the rest of the system is safe but who knows :p)
ps: you can do your backup on cwm without leaving adb shell on the pc just like you will do the format later thanks to cwm
remove the partitions
Code:
rm 10
rm 11
make the new changed size partitions
Code:
unit b
mkpart primary 1174405120 14680064511
mkpart primary 14680064512 15216934911
name 10 DATAFS
name 11 UMS
now in cwm go to mounts and storage and select "format /emmc" and "format /data"
in parted type "print" and you should see this output
Code:
Number Start End Size File system Name Flags
1 4194304B 25165823B 20971520B ext4 EFS
2 25165824B 26476543B 1310720B SBL1
3 27262976B 28573695B 1310720B SBL2
4 29360128B 37748735B 8388608B PARAM
5 37748736B 46137343B 8388608B KERNEL
6 46137344B 54525951B 8388608B RECOVERY
7 54525952B 264241151B 209715200B ext4 CACHE
8 264241152B 281018367B 16777216B MODEM
9 281018368B 1174405119B 893386752B ext4 FACTORYFS
10 1174405120B 14680064511B 13505659392B ext4 DATAFS
11 14680064512B 15216934911B 536870400B fat32 UMS
12 15216934912B 15753805823B 536870912B ext4 HIDDEN
now the hardest part is over, restore your data partition and you will be able to boot you system normally. and you go to your storage information you will find that your app storage is now 13gigs and the usb storage is just 500 megs yay
to switch the sd with the internal you will have to modify vold.fstab file(thanks to ciphray for his guide on how to do so)
you can use the modified file from ciphray thread here which i didn't beacuse his file was smaller
so i just pulled the file to my pc
Code:
adb pull /etc/vold.fstab vold.fstab
modified it with notepad++ or any dev text editor (don't use windows notepad it will mess the file)
Code:
# internal sdcard
{
storage_struct = cover, "/mnt/sdcard/external_sd","/mnt/sdcard/usbStorage"
ums_sys_path = /sys/class/android_usb/f_mass_storage/lun0/file
discard = enable
}
dev_mount sdcard /mnt/sdcard auto /devices/platform/s3c-sdhci.2/mmc_host/mmc1
# external sdcard
{
ums_sys_path = /sys/class/android_usb/f_mass_storage/lun1/file
android_secure_containers = enable
}
dev_mount sdcard1 /mnt/sdcard/external_sd 11 /devices/platform/dw_mmc/mmc_host/mmc0/mmc0 encryptable_nonremovable
and push it back to phone + change permissions
Code:
adb push vold.fstab /etc/vold.fstab
chmod 644 /etc/vold.fstab
restart your phone and voila
as a final step you can use the now pretty useless internal space (500megs remember) as a swap sapce
download swapper2 from the play store here https://play.google.com/store/apps/details?id=lv.n3o.swapper2
run it and go to settings
set swap place as /sdcard/external_sd/swapfile.swp
set swap size to the max
set the swappiness to 20 ( you can rise the value a little but don't put a high value or the system will do much swapping all the time -value of 100 means any memory not used actively will be swapped- )
wait until the process finishes then reboot your phone
you can verify that swap is working by typing "free" in the shell if the line beginning with swap is not all zeros then you're swap is working.
hope my guide will be usefull, and don't hesitate to ask me any question
Awesome, thanks! Will try it out when I get some time
If you want more app space you can erase the hidden partition and get more space.
Sent from my GT-N7000 using Tapatalk 2
Okay, I've performed the whole thing, and just a few remarks on my experience
If you want to modify the vold.fstab straight from recovery without having to reboot first, you can simply mount the system partition, and retrieve the file from /system/etc/vold.fstab instead of /etc/fstab
More importantly, following your instructions, I ended up in a situation where my apps previously moved to the sd card weren't recognized. I've solved this by modifying my vold.fstab as follows:
Code:
# internal sdcard
{
storage_struct = cover, "/mnt/sdcard/external_sd","/mnt/sdcard/usbStorage"
ums_sys_path = /sys/class/android_usb/f_mass_storage/lun1/file
android_secure_containers = enable
}
dev_mount sdcard /mnt/sdcard auto /devices/platform/s3c-sdhci.2/mmc_host/mmc1
# external sdcard
{
ums_sys_path = /sys/class/android_usb/f_mass_storage/lun0/file
discard = enable
}
dev_mount sdcard1 /mnt/sdcard/external_sd 11 /devices/platform/dw_mmc/mmc_host/mmc0/mmc0 encryptable_nonremovable
That way, all my apps were properly recognized without issues. I'll probably be moving them back to phone now though.
Will be trying this setup over the next few days and see how it performs, but one caveat I missed is that you may not be able to install the whole of some apps on the data partition, as some the data will always be stored in the sdcard/Android folder, which would make the 12GB on /data less useful than I initially thought, unless I'm missing something of course
Hi
Could you post a screenshot of the Storage page (under Settings)?
I'm interested to see what these look like after this mod.
Internal
USB Storage
SD Storage
Thanks!
zongamin said:
Hi
Could you post a screenshot of the Storage page (under Settings)?
I'm interested to see what these look like after this mod.
Internal
USB Storage
SD Storage
Thanks!
Click to expand...
Click to collapse
here you are, look at the OP
i didn't realize the screenshot like was corrupt
if you read the op i mentioned the resulting sizes after the mod
sd storage will be mentioned as 500 megs (actually taken from the internal emmc) that i use for swap space
Why isn't it possible to use the rest of the space for apps and reroute the ums to the ext sdcard so it reads it as the internal?
Sent from my GT-N7000 using Tapatalk 2
As far as I know, the HydraCore kernel doesn't allow swap, so it's unuseful to setup a swap file with swapper. Also, presently no Note kernel has swap enabled.
Carefully crafted on my Galaxy Note, for your eyes only
Hydracore 4.1 since has swap enabled in its kernel.
Sent from my GT-N7000 using Tapatalk 2
I'm sorry, I didn't know Gavin had listened to what I had asked oh so many times
Carefully crafted on my Galaxy Note, for your eyes only
travis82 said:
Why isn't it possible to use the rest of the space for apps and reroute the ums to the ext sdcard so it reads it as the internal?
Sent from my GT-N7000 using Tapatalk 2
Click to expand...
Click to collapse
i was fearing that the phone won't boot if the partition isn't available after a clean setup.
so i decided to leave the small size partition and make it useful for swap instead.
btw does anyone know how to use a bigger swap file with swapper2?
I guess, this method is only working for a "healthy" note, which never got a mmc cap bricks, right ?
And if a note got brick before, and recovered by hg42 pit revival method, I think the repartition command for the start-end of the DATA and UMS will be different.
Hmmpppfff... Do you have a way on how to read the partition setting of the note ? :fingers-crossed:
Send from the corner of this rounded earth
antique_sonic said:
I guess, this method is only working for a "healthy" note, which never got a mmc cap bricks, right ?
And if a note got brick before, and recovered by hg42 pit revival method, I think the repartition command for the start-end of the DATA and UMS will be different.
Hmmpppfff... Do you have a way on how to read the partition setting of the note ? :fingers-crossed:
Send from the corner of this rounded earth
Click to expand...
Click to collapse
just type print on the parted shell
and then you can recalculate new sizes for the data partitions, it should work like a charm
So... Im a USER, and there are part I am a bit confused about... BUT ill ask anyway!
It seems that if I wanted to resetup the partitions, I wouldnt need to mess with the pit files correct?
OR, because I want to totally KILL USB Storage, dedicate the entire internal memory to /data, and make /sdcard TRULY my sdcard, would I truly need to mess with the pit file?
Has anyone tried with killing off /ums completely?
Any help is appreciated. Also, I am using the i717 (AT&T GNote version), but my desire is the same so I figured Id post here...
EDIT: im not too worried about rom flashing, I normally slim down ROM's before I flash them, so Im not afraid of changes that have to be made (in txt files) in order to have them work properly on a UMS'less modded device. However, I do need to find out how to properly backup the pit file before I even THINK Of messing with it.
do i have to redo the whole procedure if i flashing nightly every time?
Anyone tried this on JB roms?
Hello?
Sent from my GT-N7000 using Tapatalk 2
jaguaralani said:
Anyone tried this on JB roms?
Click to expand...
Click to collapse
+1
I get 64 gb sandisk microsd card. I want to use this mod on jb stock LSC rom.
Can we use on jb roms?
GT-N7000 cihazımdan Tapatalk 2 ile gönderildi
Helpppppp
Envoyé depuis mon GT-N7000 avec Tapatalk
JB ready
I've tried it worked fine on Ultimate and Alliance ROM. Just edit vold.fstab in /etc after install new ROM. Replace 11 to auto and { } to { }. Now I need help if anyone have the original partition info, incase I wanted to restore.

Why system take 8GB space ?

I have note 2 LTE 32 GB model and i have flashed CM 10.2 but it say 24 GB is available for user? Why system take such huge space of 8Gb as i dont think CM 10.2 ROM use all of it. Where the rest of the space go ? My question is : Are these system partitions fixed in size no matter what ROM you flash? It will be alaways 8GB reserve for ROM whether stock or AOSP ?
Here is screenshot
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Sent from my GT-N7105 using Tapatalk 2
go to adb shell,type "df "command,and you will see the usage of each diretory.
proxlwt said:
go to adb shell,type "df "command,and you will see the usage of each diretory.
Click to expand...
Click to collapse
Thanks and I did that and this one is what i get..i see that sysyem is using 2.3 gb but what are these first four in /mnt taking 893 mb each
Sent from my GT-N7105 using Tapatalk 2
Rajaasim1980 said:
Thanks and I did that and this one is what i get..i see that sysyem is using 2.3 gb but what are these first four in /mnt taking 893 mb each
Sent from my GT-N7105 using Tapatalk 2
Click to expand...
Click to collapse
The first thing to note is that 32GB internal memory is in reality 29.4GB (32000000000 bytes translates into 29.4 real GB).
So to add up:
- 24.2GB of user data
- 2.3GB for /system
- 1.2GB for /cache
- 0.5GB for /tombstone /firmware and /efs
--------------
- 28.2GB
/mnt/obb asec secure and fuse are all virtual mount points to various directories and their size is arbitrary
/dev is again virtual mount point for all hardware devices in your phone used to access various properties of devices - size arbitrary
All of them are temporary file systems created on every system start.
I don't know where is the 1GB of space that should be there and it's not only your problem. This is present on all systems that I have seen.
Look at this for example:
View attachment 2597562
mat9v said:
The first thing to note is that 32GB internal memory is in reality 29.4GB (32000000000 bytes translates into 29.4 real GB).
So to add up:
- 24.2GB of user data
- 2.3GB for /system
- 1.2GB for /cache
- 0.5GB for /tombstone /firmware and /efs
--------------
- 28.2GB
/mnt/obb asec secure and fuse are all virtual mount points to various directories and their size is arbitrary
/dev is again virtual mount point for all hardware devices in your phone used to access various properties of devices - size arbitrary
All of them are temporary file systems created on every system start.
I don't know where is the 1GB of space that should be there and it's not only your problem. This is present on all systems that I have seen.
Look at this for example:
View attachment 2597562
Click to expand...
Click to collapse
Thanks for explaining it .I cannot see your attached screenshot because its too tiny. Its stupid for manufacture to advertise memory as 32 GB when its 28 GB in reality.
What i actually dont get is no matter you use custom CM or stock sammy rom (with bloatware) you will get same free space eventhough CM ROMs are less in size.
Do you see any unnecessary partition there which need to be deleted ? ..these partition within partition i.e ,0,Sd card 1, emulated, legacy etc are very confusing
Sent from my XT1032 using Tapatalk 2
Rajaasim1980 said:
Thanks for explaining it .I cannot see your attached screenshot because its too tiny. Its stupid for manufacture to advertise memory as 32 GB when its 28 GB in reality.
What i actually dont get is no matter you use custom CM or stock sammy rom (with bloatware) you will get same free space eventhough CM ROMs are less in size.
Do you see any unnecessary partition there which need to be deleted ? ..these partition within partition i.e ,0,Sd card 1, emulated, legacy etc are very confusing
Sent from my XT1032 using Tapatalk 2
Click to expand...
Click to collapse
Er... you did click on it? It opens in overlay to display full screen...
The advertisement...
It's like with hard disks in modern PC, manufacturers advertise the disk as having 1TB of space, but they are counting it as 1.000.000.000.000 of bytes while in reality we are using binary computers that do not count that way - they count 2^10 = 1024 so you have to divide this 1.000.000.000.000 bytes by 1024 to get kilobytes = 976562500 and again by 1024 to get megabytes = 953674 and again by 1024 to get gigabytes to arrive at 931GB of real disk size. From that you have to subtract partition overhead (the system needs place to store info about your files) but that is dependent on the number of files you plan to put on the partition.
If you are really advanced user and not planning to ever flash back to sammy rom, you could repartition your internal memory to say decrease /system size to say 750MB and earn almost 1.2GB of free space. But it's dangerous and will void your warranty 100%
There are no unnecessary partitions, /system /data and /cache are necessary to functioning of any rom, all others are virtual partitions created using mount points and FUSE file system - the are also needed to work and they don't take any space. I can't find the missing 1GB of space.
The command "mount" that you execute not only shows typical partitions but also some "shortcuts" used by system to access different places in the internal memory and is not normally visible to end user - they are there to make life easier for programmers and advanced users. Us common folks just gets confused - it's like dissecting how your car engine works - not for everyone
mat9v said:
Er... you did click on it? It opens in overlay to display full screen...
The advertisement...
It's like with hard disks in modern PC, manufacturers advertise the disk as having 1TB of space, but they are counting it as 1.000.000.000.000 of bytes while in reality we are using binary computers that do not count that way - they count 2^10 = 1024 so you have to divide this 1.000.000.000.000 bytes by 1024 to get kilobytes = 976562500 and again by 1024 to get megabytes = 953674 and again by 1024 to get gigabytes to arrive at 931GB of real disk size. From that you have to subtract partition overhead (the system needs place to store info about your files) but that is dependent on the number of files you plan to put on the partition.
If you are really advanced user and not planning to ever flash back to sammy rom, you could repartition your internal memory to say decrease /system size to say 750MB and earn almost 1.2GB of free space. But it's dangerous and will void your warranty 100%
There are no unnecessary partitions, /system /data and /cache are necessary to functioning of any rom, all others are virtual partitions created using mount points and FUSE file system - the are also needed to work and they don't take any space. I can't find the missing 1GB of space.
The command "mount" that you execute not only shows typical partitions but also some "shortcuts" used by system to access different places in the internal memory and is not normally visible to end user - they are there to make life easier for programmers and advanced users. Us common folks just gets confused - it's like dissecting how your car engine works - not for everyone
Click to expand...
Click to collapse
Thanks for detail reply which make sense. These partitions were actually much simple in previous version of androids.
So no matter what ROM i would flash there will be same amount of free space available because there is fixed size partition in internal memory reserved for ROM/system irrespective of size of ROM. Right?
Sent from my GT-N7105 using Tapatalk 2
Rajaasim1980 said:
Thanks for detail reply which make sense. These partitions were actually much simple in previous version of androids.
So no matter what ROM i would flash there will be same amount of free space available because there is fixed size partition in internal memory reserved for ROM/system irrespective of size of ROM. Right?
Sent from my GT-N7105 using Tapatalk 2
Click to expand...
Click to collapse
Right. The only advantage of CM is speed, in this case "Size does not matter"

[MOD] Move all your internal and external data to encrypted, external SD

Disclaimer:
THIS TUTORIAL IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL I
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS TUTORIAL, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
Motivation and idea
Starting with Android 3.x, the system theoretically supports encrypting the personal data on your device. But this has several caveats:
- it turns out that AOSP only supports encrypting /data, leaving other personal data (e.g. your pictures or storage from varios messengers) completely unencrypted on internal (emulated) or external SD storage.
- ever since, the partitioning of /data to a small, limited area leads to "no space left" issues (that's why many people go for app2sd etc.)
- in case your device suffers from physical damage, you usually loose all data you didn't backup previously.
- in case you want to sell or dispose your broken device you never know who will get access to your data anywhere in the future.
- securely wiping flash memory is complicated due to the fact that many controllers do not let you access their trim areas. Having built-in flash makes the situation even worse, especially because almost no manufacturer provides even a "manufacturer-declared-secure" wiping method - unlike some SSD drive vendors.
In this tutorial I will describe how I managed to move all personal data (probably excluding cached data, but this could be enhanced) to my external microSD card, overcoming these issues at the expense of a few drawbacks:
- (micro)SD cards are usually much slower than internal flash: boot time is about 2x slower and some apps feels a little slower, though not sluggish
- the mod requires root
- on most devices the mod also requires a modified boot image (due to change in initial RAM disk)
- it's pretty complicated to set it up (but following this guide can save you many efforts I already invested)
- mounting storage over MTP / USB is currently broken
Although this is more a proof-of-concept, I have been running this setup for a couple of days now as my daily driver without significant issues. I had some force-closes in Firefox, but I don't relate them to this mod and other browsers seem to work fine.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Enough said, let's get to work and move all personal data to your external SD card!
CURRENTLY, THIS GUIDE IS TARGETED AT ADVANCED USERS / DEVELOPERS / EXPERTS AND THUS ONLY COVERS THE ESSENTIAL BASICS, NOT THE DETAILS!
FOLLOWING THE PROCESS, YOU WILL LOOSE ALL YOUR PERSONAL DATA ON YOUR DEVICE! MAKE BACKUPS FIRST!!!
Compatibility
The tutorial is based on OmniROM 4.4 and TWRP. With not too much effort, it could be adopted to earlier Android Versions based on AOSP 4.0, probably even 3.0. (most likely, the location and internal layout of some configuration files will vary). Please note that I tried it only on one device, your milage may vary!
Step 1: Find out your partition layout
First off, you need to find out which devices are used for holding which data partitions. You can play around with "mount" or simply look in your fstab files which are located in /fstab.vendor in KK. While in some cases the devices are listed i.e. "by-name", the fstab files of custom recoveries often list the "real" device names. I.e. on my Xperia V they are as follows:
Code:
Internal Data partition: /dev/block/platform/msm_sdcc.1/by-name/Userdata
Internal, emulated SD card: /dev/block/mmcblk0p15
First partition of external SD card: /dev/block/mmcblk1p1
Step 2: Encrypt internal data
After backing up everything, run the usual Android encryption process so your data partition (in this case: /dev/block/platform/msm_sdcc.1/by-name/Userdata) will be encrypted by means of standard 128bit AES Android encryption.
Step 3: Extract the cryptofooter
Boot into TWRP recovery (don't unlock your /data if prompted!) and connect via ADB as root. Usually, the crypto footer is stored in the last 16384 bytes of your partition (but check your fstab to be sure). Now determine the size of your partition with:
Code:
Code:
fdisk -l /dev/block/platform/msm_sdcc.1/by-name/Userdata
In my case:
Code:
Disk Userdata: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders, total 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
...
In my case, the size is 2147483648 bytes. Subtracting 16384 bytes, you know the starting offset for the extraction. Now extract the footer using dd:
Code:
dd if=/dev/block/platform/msm_sdcc.1/by-name/Userdata of=/cryptofooter bs=1 seek=2147467264 count=16384
Please note, that due to a limitation in dd which supports only up to 2GB this may file - you will need a modified busybox dd command in this case - or just download the file to your UNIX machine and use the normal dd from there.
Step 4: Prepare the external SD card:
We de not want to partition the SDcard, thus we will not put any partition table on it. Nevertheless, we need to determine its exact size using fdisk:
Code:
fdisk -l /dev/block/mmcblk1p1
Disk mmcblk1: 31.9 GB, 31914983424 bytes
255 heads, 63 sectors/track, 3880 cylinders, total 62333952 sectors
Units = sectors of 1 * 512 = 512 bytes
...
Again, subtract the 16384 bytes from 31914983424 and use dd to write the cryptofooter on the end of SD:
Code:
dd if=/cryptofooter of=/dev/block/mmcblk1= bs=1 skip=31914967040 count=16384
Again, this might fail due to dd limitations.
For later testing, we copy over the existing (encrypted) data partition to the SD card:
Code:
dd if=/dev/block/platform/msm_sdcc.1/by-name/Userdata of=/dev/block/mmcblk1p1
Finally, we can wipe the internal data partition:
Code:
dd if=/dev/zero of=/dev/block/platform/msm_sdcc.1/by-name/Userdata
Step 5: Modifying fstab and init files:
Now we will need to modify the fstab files and init so they will reflect the new layout. On most devices, this requires compiling a new rootfs. This can be either done by uncompressing your boot.img, making the changes and recompressing it or recompiling it from sources. The modified boot.img has to be flashed back to the device, usually via fastboot.
In particular, we need to tell Android not to use the internal userdata partition at all, to mount the emulated sd card as usual and to use the external storage for /data using an encrypted ext4 filesystem. In my case, the modified fstab.qcom looks like this:
Code:
/dev/block/mmcblk1 /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc wait,check,encryptable=footer,length=-16384
/devices/platform/msm_sdcc.1/mmc_host/mmc0 auto ext4 defaults voldmanaged=sdcard0:15,nonremovable,noemulatedsd
#/devices/platform/msm_sdcc.3/mmc_host/mmc1 auto auto defaults voldmanaged=sdcard1:auto
/devices/platform/msm_hsusb_host auto auto defaults voldmanaged=usbdisk:auto
You will also need to modify the twrp.fstab file accordingly.
We also need to modify init (in my case through sony.init.rc) to avoid getting the external sd card being treated as sdcard during boot by uncommenting the relevant lines:
Code:
chmod 0701 /mnt/media_rw
mkdir /storage 0775 system system
mkdir /mnt/media_rw/sdcard0 0700 media_rw media_rw
# mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
mkdir /mnt/media_rw/usbdisk 0700 media_rw media_rw
mkdir /storage/sdcard0 0775 system system
# mkdir /storage/sdcard1 0775 system system
mkdir /storage/usbdisk 0775 system system
export EXTERNAL_STORAGE /storage/sdcard0
# export SECONDARY_STORAGE /storage/sdcard1
# for backwards compatibility
symlink /storage/sdcard0 /sdcard
symlink /storage/sdcard0 /mnt/sdcard
# symlink /storage/sdcard1 /ext_card
# symlink /storage/sdcard1 /mnt/ext_card
symlink /storage/usbdisk /usbdisk
symlink /storage/usbdisk /mnt/usbdisk
Step 6: First booting test
With all this set up, we can now boot again into our system. It should ask you for your encryption password (it's the same as you've set it in step 2) and you should notice that it runs a little slower - because SD cards are usually slower than internal flash. You will notice that the size of the internal space and external storage has not changed - we will fix this in the next step.
Step 7: Tweak the cryptofooter and reformat the SD card:
Now comes the fun part: Android determines the size of encrypted filesystems not by information from the filesystem, but by the size as it is stored in the cryptofooter. Therefore, we need to modify the information there. The cryptofooter is a complicated mess. Luckily, there is a great guide which describes its structure much better than the source code itself:
http://nelenkov.blogspot.de/2014/10/revisiting-android-disk-encryption.html
You will need to use a hex editor to edit the from bytes between Offset 0000:0018 and 0000:001B to match the size of your SD card. But please leave enough bytes at the end, at least for the cryptofooter!
Write back your modified cryptofooter as outlined in step 4 and boot into TWRP. Unlock your /data (which is now served from SD), connect via ADB and check the size of your encrypted device using fdisk:
Code:
fdisk -l /dev/block/dm-0
It should reflect the size as you modded it in your cryptofooter. Now, reformat the partition so fills the whole space:
Code:
make_ext4fs /dev/block/dm-0
Step 8: Adjust internal SD.
Now, you are ready to reboot into your system serving its freshly wiped, encrypted data from your external SD! Be amazed by the space you now have for your internal Userdata! Unfortunately, it will still serve "internal SD" from internal flash. First, create a directory on the sdcard to hold it using a root shell:
Code:
# mkdir -p /data/sdcard0
I tried various things to fix this already in the boot process, but somehow vold always got in the way or the device was mounted too early. Also, the media server indexes the internal flash instead of the stuff on the external SD. Therefore, I bind-mount the sdcard0 after every boot and rerun the media server by running the following commands in a root shell:
Code:
# busybox mount -bind /data/sdcard0 /mnt/media_rw/sdcard0
# am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///storage/sdcard0
Now, you can copy back all your data from the backup to the device and enjoy your new setup!
Final notes:
- Suggestions for correctly mounting the sdcard0 inside data at boot time without the bind-mounting is warmly welcome.
- Some (Stock) ROMs allow you to encrypt both SD "cards", but the implementations I have seen so far seem to be vendor-specific and closed source. Although I noticed that encrypting internal SD seems to work with AOSP out-of-the-box on some devices without external SD (e.g. Nexus S) I didn't find any Custom ROM for my Xperia V which worked with encrypted any of the SDs when putting the "encryptable=sdcard" flag in the fstab file: The storage seems to have been encrypted, but Android simply fails to mount it.
XDA:DevDB Information
All data 2 encrypted, removable SD, Tool/Utility for the Android General
Contributors
Defier525, Defier525
Version Information
Status: Alpha
Created 2015-01-08
Last Updated 2015-01-08
It's old though, I was experimenting on old devices; a KK (Nokia X2) and a LL (QMobile Z8). In summary, what this guide tells is:
Move /data partition (including internal sd card: /data/media) to external sd card
Extract crypto-footer from encrypted internal /data partition
Write crypto-footer to new /data partition on external sd card
I have tested this on QMobile with Stock Android 5. This device has a bricked eMMC and all my partitions reside on external sd card including /data. So, I tried encrypting using built-in "Encrypt Phone" Settings which fails with a simple reset of UI.
On my other phone with KK (CM-11), to overcome the shortage of internal memory, I Disabled Internal Memory (DIM) i.e. use device in "Physical Primary Only" mode instead of "Emulated primary, physical secondary". I tried same "Encrypt Phone" Settings which failed in same manner. So, I was wondering where this "encryptable=sdcard" thing works? I edited fstab in boot.img to add this flag but that makes no difference.
My second question, will this dumped crypto-footer hack work with both approaches? i.e. with DIM and with whole /data on external sd card?
Currently I'm using another working solution; an encrypted (EncFS) directory placed on external sd card. An initd script (replacing /system/bin/sdcard) mounts this directory using FUSE kernel module on the default sd card path i.e. /storag/sdcard0. Since "dm-crypt" (kernel module) is the default FDE used by AOSP, there must be a way out to use dm-crypt for SD card or any other (than /data) partition encryption like this.
EDIT:
One possible reason for in-encrypt-able /data partition on external SD card is the absence of footer space at the end of partition i.e. filesystem must be smaller than partition size by at least 16KB.
Reference:
Android Device-Specific Code:
If the length value is negative, then the size to format is taken by adding the length value to the true partition size. For instance, setting "length=-16384" means the last 16k of that partition will not be overwritten when that partition is reformatted. This supports features such as encryption of the userdata partition (where encryption metadata is stored at the end of the partition that should not be overwritten).
Click to expand...
Click to collapse
FDE - Encrypt an existing device
Orig filesystem overlaps crypto footer region. Cannot encrypt in place.
encryptable=footer
CM12 will not encrypt /data on hlte if it has previously been formatted by TWRP

Categories

Resources