[Q] How Can I Convert Yaffs2 to Ext4? - Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A

hey guys.
First Sorry Me for my bad English.
When I had galaxy ace , there is a way for convert bfs to ext4.
and when I changed my file system to ext4 , the speed of phone become very fast.
My question from developers is: How can I convert file system to Ext4?
(my phone is Live)

Nobody has tried it with our phones, i wanted also to try it before and the only way according to me is to edit the edify script of a custom rom...exactly you need to edit these lines:
format("MTD", "system"); -> format("ext4", "MTD", "system");
format("MTD", "userdata"); -> format("ext4", "MTD", "userdata");
format("MTD", "cache"); -> format("ext4", "MTD", "cache");
I think it will not work coz CWM expects only 2 arguments and we have got 3 there, i don't understand it coz when i have been on x10 mini pro the recovery acted differently. You can try it, nothing bad can happen from it

I have test it But It Dont Work.
Any other Idea?

lol ^^
if it would have worked you would have formatted /system and thus won't boot into cam again... you would have bricked your phone (only flashing ftf may have helped then).
So be smart doing such experiments...
Few years ago I was researching for my old x10 mini pro if it is possible to convert to ext4 on certain filesystems. But I memorized now that yaffs2 is the best for our phones, our memory (hardware) etc.
Also you must rewrite all roms to suite your needs because in many scripts inside the rom there are many mount commands mounting a filesystem as yaffs2...
but if you like to try further:
start by only converting/formatting data.
in edify script you can mount/load your system partition and then use the bash-tools by running an external script that formats your data partition to ext4.
See FXPs "backup" script in their rom installer for an example

It's ridiculous...
We're with Kamarush tried a lot of things to convert file system to ext4, but it's impossible, 'cause the MTD partition table.
First off, an MTD is a "Memory Technology Device", so it's just "MTD". An "MTD device" is a pleonasm.
Unix, and Unix based OSes (like Linux/Android) traditionally only knew block devices and character devices. Character devices were things like keyboards or mice, that you could read current data from, but couldn't be seek-ed and didn't have a size. Block devices had a fixed size and could be seek-ed. They also happened to be organized in blocks of multiple bytes, usually 512.
Flash doesn't match the description of either block or character devices. They behave similar to block device, but have differences. For example, block devices don't distinguish between write and erase operations. Therefore, a special device type to match flash characteristics was created: MTD.
So MTD is neither a block nor a char device. There are translations to use them, as if they were. But those translations are nowhere near the original, just like translated Chinese poems.
And Ext2, ext3, XFS, JFS, FAT and other "conventional" file systems work with block devices. They are designed this way. Flashes are not block devices, they are very different beasts.
So we can't get EXT4 etc. on our MTD based system. Check all other devices too. All EXT4 based device has EMMC partition system. On SGS the system particion MTD too, only the data EMMC, so they can use EXT4 in only data.
Cheers!

expeacer said:
It's ridiculous...
We're with Kamarush tried a lot of things to convert file system to ext4, but it's impossible, 'cause the MTD partition table.
First off, an MTD is a "Memory Technology Device", so it's just "MTD". An "MTD device" is a pleonasm.
Unix, and Unix based OSes (like Linux/Android) traditionally only knew block devices and character devices. Character devices were things like keyboards or mice, that you could read current data from, but couldn't be seek-ed and didn't have a size. Block devices had a fixed size and could be seek-ed. They also happened to be organized in blocks of multiple bytes, usually 512.
Flash doesn't match the description of either block or character devices. They behave similar to block device, but have differences. For example, block devices don't distinguish between write and erase operations. Therefore, a special device type to match flash characteristics was created: MTD.
So MTD is neither a block nor a char device. There are translations to use them, as if they were. But those translations are nowhere near the original, just like translated Chinese poems.
And Ext2, ext3, XFS, JFS, FAT and other "conventional" file systems work with block devices. They are designed this way. Flashes are not block devices, they are very different beasts.
So we can't get EXT4 etc. on our MTD based system. Check all other devices too. All EXT4 based device has EMMC partition system. On SGS the system particion MTD too, only the data EMMC, so they can use EXT4 in only data.
Cheers!
Click to expand...
Click to collapse
i have two questions,
is ext4 faster than ntfs?
so is it possible to have swap with ext4 since from what little i understand from your explanation there is no block as such for the ext4 system?

In Unix-based OSes the EXT4 more faster than NTFS.
If you place out your swap to SDCard, which partitioned properly, yes you can make swap to EXT4.

expeacer said:
It's ridiculous...
We're with Kamarush tried a lot of things to convert file system to ext4, but it's impossible, 'cause the MTD partition table.
First off, an MTD is a "Memory Technology Device", so it's just "MTD". An "MTD device" is a pleonasm.
Unix, and Unix based OSes (like Linux/Android) traditionally only knew block devices and character devices. Character devices were things like keyboards or mice, that you could read current data from, but couldn't be seek-ed and didn't have a size. Block devices had a fixed size and could be seek-ed. They also happened to be organized in blocks of multiple bytes, usually 512.
Flash doesn't match the description of either block or character devices. They behave similar to block device, but have differences. For example, block devices don't distinguish between write and erase operations. Therefore, a special device type to match flash characteristics was created: MTD.
So MTD is neither a block nor a char device. There are translations to use them, as if they were. But those translations are nowhere near the original, just like translated Chinese poems.
And Ext2, ext3, XFS, JFS, FAT and other "conventional" file systems work with block devices. They are designed this way. Flashes are not block devices, they are very different beasts.
So we can't get EXT4 etc. on our MTD based system. Check all other devices too. All EXT4 based device has EMMC partition system. On SGS the system particion MTD too, only the data EMMC, so they can use EXT4 in only data.
Cheers!
Click to expand...
Click to collapse
> is this your source? http://www.linux-mtd.infradead.org/faq/general.html

Related

GPARTED: Tool to control your ext partitions

Many people want the tool to control their ext partitions. I heard some people are using 'GPARTED'.
Though I myself have never used it but we would like to have feedback from people who have used it.
I googled and found the following link and info:
gparted.sourceforge.net/
Gnome Partition Editor
GParted is a free partition editor for
graphically managing your disk partitions.
GParted is useful for tasks such as: creating
space for new operating systems,
restructuring disk space to separate user
and operating system data, and copying
partitions to enable upgrading to a larger
hard disk drive.
Your hard disk drive or USB flash drive can
be subdivided into one or more partitions.
GParted enables you to reorganize your
disk partitions while preserving the
contents of these partitions.
Features
Create partition tables (e.g., msdos, gpt)
Perform actions with partitions such as:
create or delete
resize or move
check
label
copy and paste
Manipulate file systems such as:
btrfs
ext2 / ext3 / ext4
fat16 / fat32
hfs / hfs+
linux-swap
ntfs
reiserfs / reiser4
ufs
xfs
For specific actions supported see detailed
features.
Enable and disable partition flags (e.g.,
boot, hidden)
Align partitions to mebibyte (MiB) or
cylinder boundaries
Attempt data rescue from lost partitions
Supports hardware RAID, motherboard
BIOS RAID, and Linux software RAID.
Supports all sector sizes (e.g., 512, 1024,
2048, 4096 byte sectors)
Requirements
GParted is developed on x86 based
computers using GNU/Linux. It can be
used on other operating systems, such as
Windows or Mac OS X, by booting from
media containing GParted Live.
Mission Statement
The goal of GParted is to provide an easy
way to graphically manage disk device
partitions, without unintended loss of data,
through the use of GNU libparted and
other free software file system tools.
Sent from my LG-P500 using Tapatalk

Partition question

OK, I have a Gtab with the 11/15 FB build.
I am curious about the partitions. Really, why ? I have worked in Unix for a bunch of years and am a fan of few, large partitions. So why am I choosing 2048 ? Or the max if 4096 ?
If it were a Sun box (which is what i cut my teeth on) I would make the main card (disk) a 12 GB root partition and 4 GB swap.
Do the same rules not apply ? It looks like there are a few different partitions (/system, /data, etc) but my eyes cannot read the terminal emulator all that well.
Andy
Different beasts
aknipp said:
OK, I have a Gtab with the 11/15 FB build.
I am curious about the partitions. Really, why ? I have worked in Unix for a bunch of years and am a fan of few, large partitions. So why am I choosing 2048 ? Or the max if 4096 ?
If it were a Sun box (which is what i cut my teeth on) I would make the main card (disk) a 12 GB root partition and 4 GB swap.
Do the same rules not apply ? It looks like there are a few different partitions (/system, /data, etc) but my eyes cannot read the terminal emulator all that well.
Andy
Click to expand...
Click to collapse
This may not be 100% correct (& if it's not I'm sure someone will correct me).
Really no comparison between a Sun box & a tablet. Sun would be bigger & better hardware.
The tablet only has a 512M nand chip (that holds most of the os), 512M of ram (to run the os, apps & no dedicated graphics memory), a processor that is designed for low power vs performace & and a emmc...basically a thumb drive( in place of an hdd). On top of that Andoid is really a hydrid os (a linux kernel with a java vm to run apps).
As far as partitions go, here is the structure for the nand chip on MOST of the gTabs:
Partition 2 = BCT = boot Config Table
Partition 3 = PT = Partition Table (this list)
Partition 4 = EBT = Bootloader
Partition 5 = MBT = ?
Partition 6 = BLO = Viewsonic Bird Logo
Partition 7 = MSC = ? inandop.log /possibly inter kernel comm tween part9/10
Partition 8 = OGO = logodata (gTablet logo I believe)
Partition 9 = SOS = recovery kernel
Partition 10 = LNX = kernel
Partition 11 = APP = system(rom)
Partition 12 = CAC = cache
If you look at gtablet.cfg file in any of the nvflash packages you will see these partition definitions, fs types & sizes used by nvflash to create them.
You also have 2 additional partitions on the the 16GB internal sd (emmc):
/data - user apps & settings - only accessible via root access
/sdcard = user & app storage
Don't know why exactly why /data is set @ 2 G . Apps in Android don't have the bloat of desktop/PC apps and are considerably smaller. I can tell you that with 83 apps installed I still have nearly 1G of space left on mine out of the 2G.
For the most part, Android doesn't truly multitask apps like on a desktop. From what I understand, Android has it's own mechanism for freeing memory when needed (swapping). When space is needed, non running apps are terminated but the app is responsible for storing persistent data so that it can be reactivated (assuming the app saves persistent data) when called.
Hope this helps.
Al
Cool, thanks, I boosted it up to 4 GB, does not sound like that will hurt (had to reinstall because it was full- could not tell why)
aknipp said:
I am curious about the partitions. Really, why ? I have worked in Unix for a bunch of years and am a fan of few, large partitions. So why am I choosing 2048 ? Or the max if 4096 ?
Click to expand...
Click to collapse
As to what the various partitions are, I can elaborate a bit more on Al's post above. Try these 2 posts:
SD card partitions
NAND Flash partitions
The Android OS has its distributions (ROMs) divided into those partitions described above for pragmatic reasons which are not hard to figure out--mainly to enable easy upgrades of running distributions; with security being a secondary concern.
There is no reason why you couldn't merge some partitions together. For example, GtabComb-b3.3 merges /cache into /data at system bootup time. If you were willing to lose the protected read-only status of /system, that too could be merged with /cache+/data on the SD card by modifying the init rc files. You could muck around with the system at an even lower level since you have access to the source code. It's really up to you how far you want to go. The kernel doesn't care about the no. of partitions or the filesystems on them, or even where they are.
As for your question about the 2GB size of /data, that's just how VS deemed it to be when they released the gTab and that's the size that's followed by most custom ROMs. You can have a smaller or larger size if you want. I, for example, run 2 different ROMs--VEGAn-Tab 7.1 and GtabComb-b3.3--the former on the internal SD card and the latter on a micro SD card just by loading a different boot partition using CWM. And since my micro SD is just 2GB in size, I've shrunk my /data to 256 MB.
aabbondanza said:
From what I understand, Android has it's own mechanism for freeing memory when needed (swapping).
Click to expand...
Click to collapse
None of the currently used kernels swap; and neither does Android. That's why they kill apps when there is no memory.
Explains things very well. Thank you both.

[Q] Backup of disk encryption master key

I've been extensively searching on this, but I just can't find any answer, although I really can't image I'm the first one to come up with this.
I have a Google Nexus 4 (rooted, of course) and I'm using the native phone encryption.
There is some information that can be found, revealing that google uses the native linux dmsetup tool for this.
Now, just in case anything goes wrong, I'd like to have a backup of the encryption master-key,
that I could use to restore the dm-crypt header.
On a normal linux system, this would be easy, only one call to dmsetup and I'm done.
However, I just can't find any info to do this on android.
The UI doesn't offer this option (as is to be expected) and I just don't know how to do it by using adb.
I've opened a root shell session and tried some commands (dmsetup, cryptsetup, some calls to "vdc cryptfs", etc...), but I just don't find a way to do it.
Has someone already found a way and can share how it's done, any ideas?
Thanks in advance
Does no one encrypt their android phones or is concerned about integrity of their data?
I think you overestimate Android: In most cases /data partition is not larger then a few GB's on smartphone devices.
Just insert Storage card with enough free space, and do a decrypted backup (for example from CWM recovery being root):
1) Make sure /system, /sdcard, and /data are all mounted inside recovery environment
2) /system/xbin/tar -C / -cf /sdcard/data.tar data
When integrity of your data is no longer given, you can factory reset the device, start again the encryption process (which will use a new key for encryption), and then restore your userdata back:
1) Make sure /system, /sdcard, and /data are all mounted inside recovery environment
2) /system/xbin/tar -C / -xf /sdcard/data.tar
No need to play around with keys and cryptsetups or being afraid you loose data because you have encryption enabled
---------- Post added at 04:12 PM ---------- Previous post was at 03:14 PM ----------
To answer your initial question:
Have a small lecture on h*t*t*p://source.android.com/tech/encryption/android_crypto_implementation.html
It is said, that the "The crypto footer contains details on the type of encryption, and an encrypted copy of the master key to decrypt the filesystem".
And that "[..]the filesystem doesn't extend into the last 16 Kbytes of the partition where the crypto footer is kept".
So basically by doing a backup of the last 16KB of the partition initially was mounted as /data before encryption you are THEORETICALLY save.
I am sorry not being able to give you exact commands, but i am sure someone can post you the right partition name (e.g. for HTC vision devices it would be /dev/block/mmcblk0p26), you can do backup/restore on blocklevel using dd, which is on my current ROM located at /system/bin/dd
You then need to find out the size of this partition, which in my case with /dev/block/mmcblk0p26 would be:
cat /sys/class/block/mmcblk0p26/size gives yout size of partition in blocks (in my case 2234367)
Now you have to reduce this by 16KB, whish i think should be (2234367*4096-16*1024)/4096=2234363, because i think on all Android devices Blocksize is 4096 (you can check the column Blksize on output of shell command "df" on Nexus).
Commands would be then something like this:
Backup: /system/bin/dd if=/dev/block/mmcblk0p26 count=4 bs=4096 skip=2234363 of=/sdcard/masterkey.dd
Restore: /system/bin/dd of=/dev/block/mmcblk0p26 count=4 bs=4096 skip=2234363 if=/sdcard/masterkey.dd
Because 16KB are 4x4096 Byte
With THEORETICALLY i meant that these are my thoughts based on the implementation description, which might be accurate enough about the master key, or not (often the master key is stored on a special sector, and they only mentioned a "region" for the crypto footer), and i never tested above Backup/Restore commands, yet.
Perhaps someone better knowledged can confirm my calculations, or someone who digged in the right passages of the Android source can tell us where exactly the master key is getting stored!
Thanks for the answer.
I'll give it a try and store a backup of that last few kb of the disk.
However, since I can't really test if a restore works,
I wouldn't put too much trust into that backup.
Thanks anyway
Has anyone been able to backup their key? Anyone confirmed the commands that rondald put?
This is ridiculous that the SD card is locked to the device. I need to transfer my SD Card to a new device and should not have to reformat my SD Card.
Encryption without key management = FAIL

[OUTDATED][GUIDE]3GB on DATA partition!! Repartitioning eMMC card

{
"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"
}
DISCLAIMER!
Operations on phone’s partition could be EXTREMALY dangerous.
As You surely expect - I take no resposibility if something will go... not as it supposed to. The responsibility for potential damages caused by using this guide is Yours, and Yours only!
New system partition scheme is “designed” for custom ROMs NOT based on original Samsung firmwares (because of it’s size and using /preload partition, which we intend to extremely resize), to name just a few reasons).​
The method of modification is created by @Tesla-MADAL93 from Galaxy Advance sub-forum, all credits should go to him!!! He spend many hours using trials and errors method to achieve final success.
Part ONE: Preparations / theory.
1.Procedure requires any Linux distro with usb connection configured (tested on Ubuntu 12.04 LTS).
2.Working ADB (android debug bridge) – you don’t need to install whole ADK, just adb file with correct path added.
[EDIT/CAUTION]You can use Windows with adb configured, as proven by @maxprzemo, but I wasn’t tested by author of this guide!
3.It is strongly recommended to make a backup of your apps and data before start (using titanium backup or simipar app) Restoring nandroid backup will destroy your new partitions, so don’t use it!!!
4.With this method “safe partiotions” of phone’s eMMC memory are being removed and recreated „safe” using „parted” command in adb shell mode. Some partitions are extremely decreased, one is totally deleted. And the most important – partition of your choice will be expanded. Example displayed below sets internal (DATA) partition as large as possible (almost).
5.You will need external micro SD card after remodelling partitions)
6.Memory swap (SD0 and SD1) required BEFORE first start of your chosen ROM!!!
7.You can restore original partition scheme using Heimdall or Odin (not tested by me, problems with Odin reported by the author of whole modification) with repartition selected.
8.Partition numbers and names are very important (crucial), so we need to create them correctly, setting beginning and the end of each one very carefully.
9.Last important thing! I use minimal gapps pack for every ROM. I didn’t tested if full gapss fit on new /system partition! You’ll have to check it by yourself!
Default partitions and sizes are displayed here:
​With this guide you will achieve something like this:
[Side Note: this is just an example – you can make internal card (UMS partition) bigger, leaving /DATA partition intact, just to install bigger games – you’ll have to calculate your own values]
Part TWO: Repartition
OK., let’s do it! You have to perform all steps EXACTLY in described order!
1.Turn phone on in recovery mode, connect it to computer using usb cable.
2.Open terminal / console (Ctrl+Alt+T)
2a. Enter command:
Code:
adb devices
You should see device connected (some numbers and letters)
3.Write (press enter after each command):
Code:
adb shell
su
parted /dev/block/mmcblk0
unit kb
print
You should see default partition scheme (just as one first screen above)
OK., say goodbye to your old partitions. Deleting other partitions could (and probably – will) have irreversible consequences!!
Now we will delete partitions, starting from the last one:
Code:
rm 8
rm 11
rm 9
rm 4
Now you will encounter some error – despite of the unmounting partitions before abovementioned procedure - /cache partition is now mounted. Do not unplug phone, just enter “mount and storage” submenu in recovery, and unmount cache partition)
So let’s continue:
Code:
rm 4
rm 5
rm 3
You just deleted all “safe” partitions, enter to check this:
Code:
print
OK., it’s time to (re)create!
(SYSTEM, partition 3)
Code:
mkpart primary 105906 525906
(CACHEFS, partition 4)
Code:
mkpart primary 3848809 3948809
(DATAFS, partition 5)
Code:
mkpart primary 525906 3848809
(UMS, partition 8)
Code:
mkpart primary 3948873 3948937
(HIDDEN, partition 9)
Code:
mkpart primary 3948809 3948873
Let’s rename them properly (probably you can do it in one mkpart command, but it doesn’t matter):
Code:
name 3 SYSTEM
name 4 CACHEFS
name 5 DATAFS
name 8 UMS
name 9 HIDDEN
Almost done, let’s check:
Code:
print
Nice? Of course it’s nice!!! )
One last thing – we have to make our magic /preload (HIDDEN) partition visible for phone [it won’t boot without it!!] Because recovery won’t format it properly, lets use parted command for a last time (wait after each command):
Code:
mkfs
y
9
ext2
Now you can unplug the phone and format (in recovery) partitions:
/system
/data
/cache
OK, as I said before – you’ll have to switch storages BEFORE using phone again.
For now – you will have to manage it by yourself, just to make it short:
-for 4.2.x ROMs you can use modified vold.fstab file
-for 4.3.x ROMs – you have to manually modify build.prop, or use available zip package that will do it for you (that method is supposed to work with 4.2.x ROMs, but I didn’t test it!)
-I never used any of 4.4.x ROMs, but as I heard, there is method for switching memories too.
WARNING!
I didn’t test the way back to original partition sizes! It was tested by tesla-Madal93 though…
Sometimes (when transfer ring from one android version ROM to other, or using some old version where /preload partition was set as SWAP) you will need manualny format HIDDEN partition, just as shown above:
in adb shell mode:
Code:
parted /dev/block/mmcblk0
Code:
mkfs
y
9
ext2
FINAL WORD: If you are not sure – DON’T DO IT!!!
Screenshots are broken... I assume this deletes the "USB storage"? If then, you and the OP are bosses :good:
I can see the pictures (but are linked from other forum, i'll switch them in future), but yes - it deletes usb storage (ok, not really - new usb storage has 64KB and doesn't have to be even formatted)
Good job !:good:
Personaly i wont do it ever because 1,2 GB is enough, and if i get over that surely i have something on phone that i need to delete because i am not using it
Great post.
I would love to see the same mkpart commands to recover the preload partition space and allocate it to the data partition.
I'll do the full repartitioning thing when the team canjica CM11 major bugs have been solved. I'm not too confident about the other cm11's memory swap sustainability over time
Sent from my GT-I8160 using Tapatalk
I suggest you making script for this, and one script to revert everything like it was before
Rox said:
I suggest you making script for this, and one script to revert everything like it was before
Click to expand...
Click to collapse
I don't know if I can make something as a simple script for recovery (maybe with busybox), but for Linux yes (to automate repartition process). In every case, I will tell/send it to @judas1977 that will provide to update this guide.
@judas1977: Nice work
My new system partition
Made under windows 7
Well done judas77 and Tesla-MADAL93 :laugh:
I'll try to make (semi)automate script for linux terminal in couple of days (unless @Tesla-MADAL93 make this) - then we can have/prepare separate scripts for various partition sizes:
- bigger /DATA
- bigger /UMS (like @maxprzemo did)
- etc...
My partition table (actual formatted sizes 602M /system, 28M /cache, 2150M /data, 761M /sdcard -- no need to swap storage)
3 105906kB 747635kB 641729kB ext4 SYSTEM
4 747636kB 777636kB 30001kB ext4 CACHEFS
5 777636kB 3118935kB 2341299kB ext4 DATAFS
8 3118935kB 3918936kB 800001kB fat32 UMS
9 3918936kB 3948937kB 30001kB ext2 HIDDEN
Original partitions:
Model: MMC SEM04G (sd/mmc)
Disk /dev/block/mmcblk0: 3959423kB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
10 524kB 1573kB 1049kB PIT
6 1573kB 3146kB 1573kB CSPSA FS
7 4194kB 14680kB 10486kB ext4 EFS
2 14680kB 31457kB 16777kB ext4 Modem FS
14 32506kB 34603kB 2097kB SBL
16 34603kB 36700kB 2097kB SBL_2
1 36700kB 53477kB 16777kB PARAM
12 53477kB 55575kB 2097kB IPL Modem
13 55575kB 72352kB 16777kB Modem
15 72352kB 89129kB 16777kB Kernel
17 89129kB 105906kB 16777kB Kernel2
3 105906kB 747635kB 641729kB ext4 SYSTEM
5 747635kB 2056258kB 1308623kB ext4 DATAFS
4 2056258kB 2377122kB 320864kB ext4 CACHEFS
9 2377122kB 2712666kB 335544kB ext4 HIDDEN
11 2712666kB 2765095kB 52429kB Fota
8 2765095kB 3948937kB 1183842kB fat32 UMS
Minimum sizes and warnings
/system 530M (approximate value, calculated for CM10.2 + my gApps) (10MB margin)
/cache 8M (assuming dalvik.vm.dexopt-data-only=1 && dalvik.vm.dexopt-cache-only=0) (2MB margin)
/data 350M (assuming about 100M of actual usable app space) (20MB margin) -- in practice less than 600 will be quite tight
/sdcard 1M (depends on apps again and FAT fragments easily by design, avoid less than 100M)
Now what should be nice having are ROM variants with internal storage disabled, so that we can remove partition 8 and both bypass the need for storage swapping but also avoid some apps not desiged for 2 "SDs" getting partially broken
I just repartitioned my phone, but acidentally I partitioned partition 2 instead of 3 :/
Now when I try to rename the partition 2 again in "Modem FS" with the name command, it only names the partition as "Modem". Can someone explain me please how to rename it to the original name again?
Thank you
S.AMU said:
I just repartitioned my phone, but acidentally I partitioned partition 2 instead of 3 :/
Now when I try to rename the partition 2 again in "Modem FS" with the name command, it only names the partition as "Modem". Can someone explain me please how to rename it to the original name again?
Thank you
Click to expand...
Click to collapse
Try "Modem FS" with quotes, or maybe Modem\ FS
Ryccardo said:
Try "Modem FS" with quotes, or maybe Modem\ FS
Click to expand...
Click to collapse
renaming worked with the quotes. Thanks
I restored my old nv_backup and now the device is booting... Let's see if it will work. I'm just confused, because in recovery the partition is called modemfs and when restoring nv backup it is called Modemfs....
botid said:
Great post.
I would love to see the same mkpart commands to recover the preload partition space and allocate it to the data partition.
Click to expand...
Click to collapse
Impossible (well, without LVM or something) because there's USB storage in the middle... but with 10 minutes and a calculator you can create your partition sizes relatively easily
If I'll make the following changes in partitions: UMS resize to 400MB, CACHEFS resize to 30MB, DATAFS resize to 2,313GB, Fota 0 MB and I'll leave SYSTEM and HIDDEN to default sizes can I restore CWM Recovery backup or flash stock rom with Odin?
The HIDDEN partition will have the same size, but the location on mmc is different, as you can see below.
3 105906kB 747635kB 641729 kB ext4 SYSTEM
5 747635kB 3173073kB 2425438kB ext4 DATAFS
4 3173073kB 3203793kB 30720 kB ext4 CACHEFS
9 3203793kB 3539337kB 335544kB ext2 HIDDEN
8 3539337kB 3948937kB 409600KB fat32 UMS
Sorry for my english.
powermetza said:
If I'll make the following changes in partitions: UMS resize to 400MB, CACHEFS resize to 30MB, DATAFS resize to 2,313GB, Fota 0 MB and I'll leave SYSTEM and HIDDEN to default sizes can I restore CWM Recovery backup or flash stock rom with Odin?
The HIDDEN partition will have the same size, but the location on mmc is different, as you can see below.
3 105906kB 747635kB 641729 kB ext4 SYSTEM
5 747635kB 3173073kB 2425438kB ext4 DATAFS
4 3173073kB 3203793kB 30720 kB ext4 CACHEFS
9 3203793kB 3539337kB 335544kB ext2 HIDDEN
8 3539337kB 3948937kB 409600KB fat32 UMS
Sorry for my english.
Click to expand...
Click to collapse
Nandroid: I wouldn't personally do it but it should work
Odin: definitely repartition with PIT and full image first
And be sure to input the partitions in numerical order!
You can make a script? For linux and winzozz?
Sent from my GT-I8160 using XDA Premium 4 mobile app
Don't make CACHEFS partition under a minimum 100 MB!!!
In this partition is stored system apps' dalvik cache on all CM and CM-based ROMs, if available space is insufficient to store dalvik cache of all system apps the ROM isn't stable and has lot of FCs depending on what caches are not stored. If you want to go under 100 MB (that I advice) first check actual used space on this partition with Partition Table (available on Play Store) on your ROM, remember that every ROM has its system-dalvik cache size depending from apps' classes.dex
Inviato dal mio GT-I9070
Tesla-MADAL93 said:
Don't make CACHEFS partition under a minimum 100 MB!!!
Click to expand...
Click to collapse
And why?
I've had zero problems in Android with 10 MB as long as you keep dalvik-cache away from it ( dalvik.vm.dexopt-data-only=1 and …cache-only=0)
Recovery probably uses it more though...
Ryccardo said:
And why?
I've had zero problems in Android with 10 MB as long as you keep dalvik-cache away from it ( dalvik.vm.dexopt-data-only=1 and …cache-only=0)
Recovery probably uses it more though...
Click to expand...
Click to collapse
In this way is okay, but not all people know this I think. Should be added to first post @judas1977
Inviato dal mio GT-I9070

[RECOVERY][DUALBOOT][MAGISK][3.3.1-79][Unified]Unofficial TWRP for OnePlus 7/7 Pro/5G

If you want to make something like this for your device, check out this guide here
Since I no longer have an OP 7 series device, this mod is now deprecated and won't be receiving any more updates. @invernomut0 has made a continuation of this mod using orangefox recovery. Check it out here!
Team Win Recovery Project 3.x, or twrp3 for short, is a custom recovery built with ease of use and customization in mind. Its a fully touch driven user interface no more volume rocker or power buttons to mash. The GUI is also fully XML driven and completely theme-able. You can change just about every aspect of the look and feel.
Code:
#include <std_disclaimer.h>
/*
*
* We are not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this ROM
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at us for messing up your device, we will laugh at you.
*
*/
Compatibility
This has only been tested by me on Oxygen OS Stable - Android Q.
Disclaimer
This is a DANGEROUS mod. Anything involving repartitioning is. If you fail to read and bad things happen, that's on you. Although I thoroughly tested this (managed to brick my phone once), there's always the possibility that something could go wrong with the worst case scenario resulting in a brick.
YOU'VE BEEN WARNED - Use at your own risk
What is this?
This is @mauronofrio's TWRP (see official thread here) that's been modified for true dual booting by splitting userdata into a/b slots (also does the same for metadata for encryption support). The installer script repartitions userdata for dualboot or stock based on your input.
Limitations
See the section in the github readme. MAKE SURE YOU READ THIS!
Features:
Same as mauronofrio's TWRP
Can choose between stock layout, a/b userdata, or a/b/c userdata where 'c' is a common data partition that'll show up in both roms - it's quite handy
Option to choose between ext4 and f2fs
Disables verity - fstabs are modified for dual boot and so this is a must unless you choose stock layout in which case it's optional
Option to disable forced encryption
Option to install magisk
Common Data
I recommend the a/b/c layout which includes this common data partition
If you choose a/b/c layout - you'll have a/b userdata, but you'll also get a 3rd userdata partition I call 'Common Data'
The name 'Common Data' gives away its purpose - to store files that you'll access on both slots/roms. So stuff like zips, pictures, music, TWRP backups, etc.
In TWRP, this shows up as another storage option for backup/restore and on your pc as well - your phone will have 'Common Storage' and 'Internal Storage'
In order to be accessible when booted, some parts of the system are modified so that the it'll be accessible WITHOUT root by the following mechanisms:
- The common data partition is mounted to /sdcard/CommonData
- .nomedia file is placed in CommonData so files in it won't be picked up twice if you decide to mount over internal storage as outlined below
- Furthermore, if your use case is like mine where my music files are in common data, you can make 'mounts.txt' file in /datacommon containing a list of every FOLDER to mount directly over top of sdcard. So for example:
/datacommon/Music -> /sdcard/Music
+ This of course mounts over anything there (overwrites it for as long as it's mounted) so make sure that you don't have the same folder in both datacommon and regular data
+ Note that there are 3 exceptions to this folder mounting rule:
1) All - if this is the FIRST line, ALL folders in datacommon will be mounted
2 )Android
3) lost+found
+ The reasoning should be obvious - lost+found isn't something you should need to mess with and Android is for regular data partition only - that's OS specific and should be on separate slots
+ Note that you should have 1 folder listed on every line, for example:
Code:
DCIM
Music
Pictures
ViPER4AndroidFX
Flashing Instructions
You MUST be booted into TWRP already when flashing this zip. You can grab a bootable twrp img from here
Since this modifies data - the zip CANNOT be on sdcard or data at all UNLESS you do not want to repartition/format
- If you flash from data, the zip will copy itself to /tmp and instruct you to flash it from there OR you can just install twrp/magisk/disver-fec
- You could do the above or copy it to a place like /dev or /tmp and flash it from there
- Alternatively, you can adb sideload it
Read through ALL the prompts - there's lots of options
Note that if you change partition layout, THIS WILL WIPE ALL DATA INCLUDING INTERNAL STORAGE
How to Flash Roms - If you're NOT stock layout
Nothing changes here except ONLY FLASH IN TWRP
- Roms always flash to the opposite slot. Keep that in mind and you'll be fine
- So don't take an OTA while booted - boot into twrp, switch slots, reboot into twrp, flash rom
Normal flash procedure:
1) Boot into twrp
2) reboot into twrp selecting slot you do NOT want rom installed to
3) Flash rom
4) Flash this zip
5) Reboot into twrp
6) Flash everything else
Help! I Can't Boot!
Usually this is because you switched roms without formatting data first. This should be flashing 101 but we all forget sometimes. Plus this slot stuff can get confusing
If it only happens with a/b/c and not any other layout, there's a good chance it's selinux related. Try setting selinux to permissive at kernel level with this mod(source here). If this doesn't fix it, it could be because selinux can't be set to enforcing even with the mod depending on the rom
How to Manually Repartition Back to Stock
In the event any step in the repartioning fails, the entire installer aborts. The good news is that this prevents a potential brick. The bad is that you need to manually revert back. See the README on github for the procedure. Note that if the install went fine and you want to switch back to stock later, just flash the installer again and choose stock layout
Download
Source Code
Credits
Mauronofrio
Teamwin
CosmicDan
TopJohnWu
Very ****ing badass. ?
Wow, this is cool. Always wondered if something like this would be possible on AB partitioned devices.
Looking forward to testing it out
Does the dual boot mean I can boot two roms?
jaggillararla said:
Does the dual boot mean I can boot two roms?
Click to expand...
Click to collapse
Ya. You can have a different rom on each slot
Will it impact on my original data partition if I flashed this TWRP.( I means whether my original data being splitted into 2-individual-parition + 1-common-partition and I need to reinstall my data after entering system ?)
Kris Chen said:
Will it impact on my original data partition if I flashed this TWRP.( I means whether my original data being splitted into 2-individual-parition + 1-common-partition and I need to reinstall my data after entering system ?)
Click to expand...
Click to collapse
The installer will tell you if it'll wipe internal storage or not.
Basically, if you choose to change the partition layout, data will all be wiped since it'll be repartitioned. If you choose to keep your partition layout at the beginning of the install, your data will be fine.
You could just use this zip as twrp, magisk, verity/fec modifer/installer to save you the extra steps and keep with stock layout
This is super cool. Will be testing soon. Just to confirm, this means I can have a custom rom on one slot and oxygen os on the other? Also f2fs should work fine with common data right?
f41lbl0g said:
This is super cool. Will be testing soon. Just to confirm, this means I can have a custom rom on one slot and oxygen os on the other? Also f2fs should work fine with common data right?
Click to expand...
Click to collapse
Yup. You can do whatever you want with either slot. This mod formats all data partitions as ext4 since that's what oneplus does. You can always reformat userdata to f2fs in twrp gui later if you want though. Same goes for common data although I don't think there's a gui option for that
How does this zip to allocate the each size of userdata ? Can be customized by ourself or automated by zip itself ?
Kris Chen said:
How does this zip to allocate the each size of userdata ? Can be customized by ourself or automated by zip itself ?
Click to expand...
Click to collapse
From what I see it can not be customized through the flasher (may be possible by editing values in the zip). In case you were wondering the size of the partitions, they are 96.7gb for the common storage and 62.4gb each for the individual storages.
Kris Chen said:
How does this zip to allocate the each size of userdata ? Can be customized by ourself or automated by zip itself ?
Click to expand...
Click to collapse
f41lbl0g said:
From what I see it can not be customized through the flasher (may be possible by editing values in the zip). In case you were wondering the size of the partitions, they are 96.7gb for the common storage and 62.4gb each for the individual storages.
Click to expand...
Click to collapse
It's automated by installer. If you have a 128gb device:
32gb for each userdata slot, commondata gets what's left
256gb device:
Everything's doubled from above
Thank you for this work I have screwed up all of my partitions on my Oneplus and could use a pointer on how to restore all of the correct partitions... :-0
I must have screwed up one of the commands on restoring my original partitions here is what I have now
C:\Users\The Family>adb shell
OnePlus7Pro:/ # sgdisk /dev/block/sda --print
Creating new GPT entries.
Disk /dev/block/sda: 61409280 sectors, 234.3 GiB
Logical sector size: 4096 bytes
Disk identifier (GUID): B0281E2A-8376-4F4B-98C6-BF5221AD8A20
Partition table holds up to 128 entries
First usable sector is 6, last usable sector is 61409274
Partitions will be aligned on 256-sector boundaries
Total free space is 61409269 sectors (234.3 GiB)
Number Start (sector) End (sector) Size Code Name
OnePlus7Pro:/ #
What commands do I need to fix this. I can still get into adb shell
edit: msmtool cannot restore from this because the partitions are not correct from the way it looks when I try it. when in recovery touch does not work.
eyespunker said:
Thank you for this work I have screwed up all of my partitions on my Oneplus and could use a pointer on how to restore all of the correct partitions... :-0
I must have screwed up one of the commands on restoring my original partitions here is what I have now
C:\Users\The Family>adb shell
OnePlus7Pro:/ # sgdisk /dev/block/sda --print
Creating new GPT entries.
Disk /dev/block/sda: 61409280 sectors, 234.3 GiB
Logical sector size: 4096 bytes
Disk identifier (GUID): B0281E2A-8376-4F4B-98C6-BF5221AD8A20
Partition table holds up to 128 entries
First usable sector is 6, last usable sector is 61409274
Partitions will be aligned on 256-sector boundaries
Total free space is 61409269 sectors (234.3 GiB)
Number Start (sector) End (sector) Size Code Name
OnePlus7Pro:/ #
What commands do I need to fix this. I can still get into adb shell
edit: msmtool cannot restore from this because the partitions are not correct from the way it looks when I try it. when in recovery touch does not work.
Click to expand...
Click to collapse
I have the steps outlined here: https://github.com/Zackptg5/TWRP-DualBoot-Guac-Unified/#how-to-manually-repartition-back-to-stock
But what did you do? It looks like you formatted all of /dev/block/sda which is essentially a brick. You are able to restore that with msmtool btw but there will still be some device specific data that is lost and you'll likely need to file warranty claim
Zackptg5 said:
I have the steps outlined here: https://github.com/Zackptg5/TWRP-DualBoot-Guac-Unified/#how-to-manually-repartition-back-to-stock
But what did you do? It looks like you formatted all of /dev/block/sda which is essentially a brick. You are able to restore that with msmtool btw but there will still be some device specific data that is lost and you'll likely need to file warranty claim
Click to expand...
Click to collapse
It was this step that I really messed up
Final step is to format the new userdata partition: mke2fs -t ext4 -b 4096 /dev/block/sda$userdata_num $userdata_size - where userdata_size can be calculated with this shell command: sgdisk /dev/block/sda --print | grep "^ *$userdata_num" | awk '{print $3-$2+1}'
with this step I used the result from sgdisk /dev/block/sda --print | grep "^ *$userdata_num" | awk '{print $3-$2+1}' I do not remember the value into the spot where userdata_size was
It looks like have been able to flash partitions manually in fastboot but the two partitions that are no longer recognized are the system_a and system_b the reason I say that is because vendor and boot flash fine on both a and b partitions. and when I send the commands to flash system a or b the reply is partition not found?! I am not sure if it would fix my problem but if I could get help to restore system partitions maybe I can get this thing to boot up.
eyespunker said:
It was this step that I really messed up
Final step is to format the new userdata partition: mke2fs -t ext4 -b 4096 /dev/block/sda$userdata_num $userdata_size - where userdata_size can be calculated with this shell command: sgdisk /dev/block/sda --print | grep "^ *$userdata_num" | awk '{print $3-$2+1}'
with this step I used the result from sgdisk /dev/block/sda --print | grep "^ *$userdata_num" | awk '{print $3-$2+1}' I do not remember the value into the spot where userdata_size was
It looks like have been able to flash partitions manually in fastboot but the two partitions that are no longer recognized are the system_a and system_b the reason I say that is because vendor and boot flash fine on both a and b partitions. I am not sure if it would fix my problem but if I could get help to restore system partitions maybe I can get this thing to boot up.
Click to expand...
Click to collapse
The formatting steps is how I initially bricked my phone when I was figuring this stuff out - I since fixed that issue and made sure it'd never happen again in the zip :/
Why were you manually restoring? Did the zip cut off with partition error?
You'll need to use msmtool in this case. Even if your partition block is completely toast, it's able to bring it all back. You can grab the latest one from here: https://androidfilehost.com/?w=files&flid=296306
And here's the guide for it: https://forum.xda-developers.com/oneplus-7-pro/how-to/msm-tool-guac-t3934691
Zackptg5 said:
The formatting steps is how I initially bricked my phone when I was figuring this stuff out - I since fixed that issue and made sure it'd never happen again in the zip :/
Why were you manually restoring? Did the zip cut off with partition error?
You'll need to use msmtool in this case. Even if your partition block is completely toast, it's able to bring it all back. You can grab the latest one from here: https://androidfilehost.com/?w=files&flid=296306
And here's the guide for it: https://forum.xda-developers.com/oneplus-7-pro/how-to/msm-tool-guac-t3934691
Click to expand...
Click to collapse
When I run the latest 10.4 global I get "device does not match image" and then under status I loose connection. I have also tried the 10.31 file with no luck either.
eyespunker said:
When I run the latest 10.4 global I get "device does not match image" and then under status I loose connection. I have also tried the 10.31 file with no luck either.
Click to expand...
Click to collapse
In msmtool? Do you have the right variant?
Latest global: https://androidfilehost.com/?fid=4349826312261732245
Latest europe: https://androidfilehost.com/?fid=4349826312261732244
Download mode is really tricky too. It times out after several seconds so you pretty much have to keep holding down the key combo until msmtool picks it up and then you can release them
Zackptg5 said:
In msmtool? Do you have the right variant?
Latest global: https://androidfilehost.com/?fid=4349826312261732245
Latest europe: https://androidfilehost.com/?fid=4349826312261732244
Download mode is really tricky too. It times out after several seconds so you pretty much have to keep holding down the key combo until msmtool picks it up and then you can release them
Click to expand...
Click to collapse
I have now tried the latest two and have come up with the same results on the update when the device param load the result of the last communication is device does not match image.
eyespunker said:
I have now tried the latest two and have come up with the same results on the update when the device param load the result of the last communication is device does not match image.
Click to expand...
Click to collapse
Sounds like you may need to file a warranty claim then :/

Categories

Resources