[Guide] Format in ext4 internal memory and keep data - Android General

Hi all,
Here another method to format to ext4 your internal sdcard (usb storage) of any Android device. This trick work also with external sdcard. Since Galaxy S3, many devices have already the internal sdcard in ext4, so check your sdcard file system type with Diskinfo from Play Store. This guide is great for Galaxy S1 or S2 for exemple.
Required :
- Your computer
- Android with recovery (cwm, Philz...)
- Live CD of Parted Magic 2013 : link
- USB cable
- Android 4.x
In brief :
- Copy all data of your internal sdcard to your computer.
- Format to ext4 your internal sdcard with Parted Magic AND NOT WINDOWS.
- Restore your data to your internal sdcard.
- Fix permissions* (very important).
- Check.
"Thanks chrhei, laotzy"
Why ext4 ?
- Ext4 is native file system for Android, while exfat is not.
- The system internal partitions (/efs /data /system /cache /preload) use ext4, natively.
- The famous music bug on Android 4.4 AOSP will be gone.
- CM has poor exfat support, while fat32 is not recommended for big files (over 2 GB) because it doesn't work well with them.
- Ext4 has better stability and performance, especially on Android devices, compared to exfat and fat.
"Thanks JustARchi"
Steps by steps :
- Download iso of Parted Magic 2013 freeware (Mac, Linux, Windows) : here.
- Burn the live cd on a real CD or make a live usb stick.
- On your computer, reboot on Parted Magic (live cd or usb stick) :
{
"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"
}
- On your Android device, reboot in recovery :
- Plug Android to computer with usb cable.
- In recovery, first select mount and storage. Then, select mount USB storage. Then, don't touch recovery upto the end of process. If you go back, then recovery unmount sdcard and break the process :
- On computer, with Parted Magic, open file manager and check if you can browse files of your internal sdcard :
- If browsing ok, then copy all data of internal sdcard to computer.
- Please note carefully the name of your internal storage in parted magic, like sde1 or sdb2…
- On computer, open Partition editor (Gparted).
- On partition editor, select your internal sdcard from its name.
- Be carefull to select your internal sdcard and not your hard drive of your computer !
- On partition editor, format your internal sdcard to ext4 from a right click on its partition. :
- Wait the end of process :
- When the format is over, reboot the recovery NOT Android, do it from the advanced options.
- In recovery, go to storage and select USB mount storage.
- On computer with Parted Magic, open file manager and go to your internal sdcard now ext4.
- Restore all data saved to your internal sdcard.
- Reboot android.
- With a terminal in Android, execute the command: su
- Before you start fixing permissions don't forget to type su in your phone's Terminal
- Then, check permissions and type :
ls -la /mnt/media_rw/
The return will be like :
drwxrwxr-x media_rw media_rw 2014-08-20 21:56 sdcard0
drwxrwxr-x media_rw media_rw 2014-08-21 18:32 sdcard1
- To fix permissions, you have to copy everything below, line by line, into the Terminal. Use Android with a web browser as firefox to navigate upto here and copy past to the terminal this lines :
cd /mnt/media_rw/
find sdcard0 -type d -exec chmod 0775 {} \;
find sdcard0 -type d -exec chown media_rw:media_rw {} \;
find sdcard0 -type f -exec chmod 0775 {} \;
find sdcard0 -type f -exec chown media_rw:media_rw {} \;
- Check permissions to see the differences :
ls -la /mnt/media_rw/
- If it is an external sdcard, do the same but replace sdcard0 by sdcard1
- Reboot Android normally (not into terminal).
- Voilà !
- Now, you need to check 2 things : the permissions and the ext4 file system of the sdcard formated :
Please, verify this :
Check permissions : To check if permissions is done, go to browsing files under Android, with an app to browsing files as es file explorer. Then, create a directory at the root of your sdcard ext4 (as /storage/sdcard0/), then delete it. If you will able to delete the folder, then permissions is fine. If not, then go back to follow again steps about fix permissions.
Check your ext4 sdcard: Use Diskinfo from Play Store to check the file system of your sdcard before and after formated : here. There will several partitions, please select the sdcard formated and check its file system.
Video of this guide, but please, read the guide before :
Part 1, backup and format under Parted Magic : here
Part 2, fix permissions with a terminal under Android : here
Why ext4 and another methods here : http://bit.ly/1oYzi3A
Windows users : After formated to ext4, to access to your internal sdcard, you must connect your device in USB in MTP and not USB mass storage (UMS). Because with UMS, no way to access to your internal sdcard from windows. You can set MTP in the parameters of Android :
Anyway, with UMS, to read the new ext4 volumes in Windows, use ext2Fsd.
* Fix Permissions : after formated the sdcard to ext4, there is a very annoying issue. No way to create or delete directory or file at root of this storage. So, there will be big troubles, like unable to backup, no way to install new apps which have to write on this storage, unable to update CM... Without fix permissions, the sdcard will be a kind of read protected storage at root directory.
Before formated, the internal sdcard on my Galaxy S2 was vfat. Here my Galaxy S2 running CM11, after format's process, the internal sdcard is now ext4 :

philippe734 said:
Hi all,
Here another method to format in ext4 your internal sdcard (internal memory) of any Android device.
Required :
- Your computer
- Android with cwm recovery (or other like Philz)
- Live CD of Parted Magic 2013 : link
- USB cable
In brief :
- Copy all data of your internal sdcard to your computer.
- Format in ext4 your internal sdcard with Parted Magic.
- Restore your data to your internal sdcard.
Steps by steps :
- Download iso of Parted Magic 2013 freeware (Mac, Linux, Windows) : link
- Burn the live cd on a real CD or make a live usb stick.
- On your computer, reboot on Parted Magic (live cd or usb stick)
- On your Android device, reboot in recovery.
- Plug Android to computer with usb cable.
- In recovery, go to mount storage and select something like mount USB storage.
- On computer, under Parted Magic, open file manager and check if you can browse files of the internal memory.
- If browse ok, then copy all data of internal sdcard to computer.
- Please note carefully the name of your internal memory in parted magic, like sde1 or sdb2…
- On computer, open Partition editor.
- On partition editor, select your internal memory from its name.
- Be carefully to select your internal sdcard and not your hard drive of your computer !
- On partition editor, format your internal sdcard to ext4 from a right click on its partition.
- Wait the end of process.
- When the format is over, reboot the recovery (not Android) from the advanced options.
- In recovery, go to storage and select USB mount storage.
- On computer, open file manager and go to the internal memory now in ext4.
- Restore all data saved to your internal memory
- Reboot android
- Voilà !
Why format in ext4 and another methods here : http://bit.ly/1oYzi3A
Click to expand...
Click to collapse
My question is - can't I use the option of formatting the Internal memory to ext4 from my Recovery? There is such an option there. My tlf is Galaxy S2, by Samsung + CM11

laotzy said:
My question is - can't I use the option of formatting the Internal memory to ext4 from my Recovery? There is such an option there. My tlf is Galaxy S2, by Samsung + CM11
Click to expand...
Click to collapse
Format in ext4 the internal sdcard from recovery don't work, even if option is available. Use parted magic can avoid unexpected issues [emoji106] I did it with success on my Galaxy S2 running CM11.

philippe734 said:
Hi all,
Here another method to format in ext4 your internal sdcard (internal memory) of any Android device.
Required :
- Your computer
- Android with cwm recovery (or other like Philz)
- Live CD of Parted Magic 2013 : link
- USB cable
In brief :
- Copy all data of your internal sdcard to your computer.
- Format in ext4 your internal sdcard with Parted Magic.
- Restore your data to your internal sdcard.
Steps by steps :
- Download iso of Parted Magic 2013 freeware (Mac, Linux, Windows) : link
- Burn the live cd on a real CD or make a live usb stick.
- On your computer, reboot on Parted Magic (live cd or usb stick)
- On your Android device, reboot in recovery.
- Plug Android to computer with usb cable.
- In recovery, go to mount storage and select something like mount USB storage.
- On computer, under Parted Magic, open file manager and check if you can browse files of the internal memory.
- If browse ok, then copy all data of internal sdcard to computer.
- Please note carefully the name of your internal memory in parted magic, like sde1 or sdb2…
- On computer, open Partition editor.
- On partition editor, select your internal memory from its name.
- Be carefully to select your internal sdcard and not your hard drive of your computer !
- On partition editor, format your internal sdcard to ext4 from a right click on its partition.
- Wait the end of process.
- When the format is over, reboot the recovery (not Android) from the advanced options.
- In recovery, go to storage and select USB mount storage.
- On computer, open file manager and go to the internal memory now in ext4.
- Restore all data saved to your internal memory
- Reboot android
- Voilà !
Why format in ext4 and another methods here : http://bit.ly/1oYzi3A
Click to expand...
Click to collapse
I have formatted Internal memory into ext4 and now my PC doesn't recognize it so I cannot copy all tha Data back to the internal memory. What I did wrong?
I think I know... I did use the option of the phone So I am going back to default and then I will try again using Magic CD

laotzy said:
What I did wrong?
Click to expand...
Click to collapse
Nothing : windows can not access to your internal sdcard in ext4. To access to your internal memory in ext4 from windows, you need to set MTP before connected in USB your device. Read the end of my guide. And to format in ext4, don't do it under windows but linux as live cd of parted magic.

EXT4 on SGS2
My ext4 experience with stock CM11, always latest nightly:
- Backup up your phone data (sdcard0 and sdcard1) first, make the data available on your computer
- Boot your favorite Linux (e.g. from Live CD)
- CWM into my SGS2, connect phone via USB to your Linux computer
- Mount your SD cards to USB
- sdcard0 and sdcard1 should be accessible on your Linux Box
- Convert both partitions to ext4 (do not use CWM!, doesn't work for me) and make them available to the Linux computer
- Copy your backed-up data back to your phone (restore) using your Linux computer
- Reboot your phone again into recovery
- ADB to your phone as root
- Check permissions
ls -la /mnt/media_rw/
drwxrwxr-x media_rw media_rw 2014-08-20 21:56 sdcard0
drwxrwxr-x media_rw media_rw 2014-08-21 18:32 sdcard1
- Fix permissions (user media_rw, uid=1023, group media_rw, gid=1023):
cd /mnt/media_rw/
find sdcard0 -type d -exec chmod 0775 {} \;
find sdcard0 -type d -exec chown media_rw:media_rw {} \;
find sdcard0 -type f -exec chmod 0775 {} \;
find sdcard0 -type f -exec chown media_rw:media_rw {} \;
find sdcard1 -type d -exec chmod 0775 {} \;
find sdcard1 -type d -exec chown media_rw:media_rw {} \;
find sdcard1 -type f -exec chmod 0775 {} \;
find sdcard1 -type f -exec chown media_rw:media_rw {} \;
- FINISHED
To access (r/w) both sdcards (0/1) from a Linux computer your >Linux user< needs to be a member of a created GROUP called "media_rw" with the GID "1023". For "normal" data transfers use the MTP mode of your phone, so you will not run into permission issues.
Regards,

chrhei said:
- ADB to your phone as root
[...]
- Fix permissions [...]
Click to expand...
Click to collapse
True. Because without this fix, no way to write or create new folder on the internal sdcard ext4.

philippe734 said:
Please, could you edit to specify that is not needed to Android + Windows users.
Click to expand...
Click to collapse
I would like to keep this because it will prevent permission issues for everybody caused by wrong GIDs.

Thankyou chrhei. Please can you also say more about what options to choose when formatting sdcard0 and sdcard1 to ext4. Or do you simply let mkfs.ext4 decide based on its defaults?

HippyTed said:
Thankyou chrhei. Please can you also say more about what options to choose when formatting sdcard0 and sdcard1 to ext4. Or do you simply let mkfs.ext4 decide based on its defaults?
Click to expand...
Click to collapse
Yes, no extra options, just created the ext4 file system. I guess you ask because of the journal, no problems so far.

Could you tell me if the telefone, after formatting both memories into ext4, consumes more battery? Or, there is no difference? And also, if you format to ext4 only your internal memory and the external one is left with FAT32 could there be a conflict between the two memories? When you update the CM firmware, do you have to format the memories again? I am speaking about Galaxy S2...

laotzy said:
Could you tell me if the telefone, after formatting both memories into ext4, consumes more battery? Or, there is no difference? And also, if you format to ext4 only your internal memory and the external one is left with FAT32 could there be a conflict between the two memories? When you update the CM firmware, do you have to format the memories again? I am speaking about Galaxy S2...
Click to expand...
Click to collapse
Doesn't matter if you only convert internal or external SD card. But ext4 is very reliable and the overall performance is slightly better. Battery consumption is the same.

philippe734 said:
- Format in ext4 your internal sdcard with Parted Magic AND NOT WINDOWS
Click to expand...
Click to collapse
I am curious, why can't you use a partition manager running under MS Windows, so long as you correctly specify the Ext4 format for the Linux partition? I know Parted Magic isn't an MS Windows program -- I don't mean you should use that with Windows, but aren't there are other partitioning utilities that do run with the MS operating system?
Or not??

Belamigo said:
I am curious, why can't you use a partition manager running under MS Windows, so long as you correctly specify the Ext4 format for the Linux partition? I know Parted Magic isn't an MS Windows program -- I don't mean you should use that with Windows, but aren't there are other partitioning utilities that do run with the MS operating system?
Or not??
Click to expand...
Click to collapse
If you don't know how to use Linux Ext4 is nothing for you. Don't use it.

Belamigo said:
I am curious, why can't you use a partition manager running under MS Windows
Click to expand...
Click to collapse
Because after formated, windows will not recognize the partition. Ext4 is not for window, that's the point is. You can do this format using virtualbox with linux, inside windows. But why do hard, when it's easy with live cd ?

OK, now I see the reason.
philippe734 said:
Because after formated, windows will not recognize the partition. ...
Click to expand...
Click to collapse
Ah, OK, I see your point. I read your thread again, and you're changing the entire card to Ext4, and not making a card with two partitions and two filesystems.
I was curious because I'm about to prepare an two-partition SD card to be hardlinked to /data, and I was following instructions for this, where the thread's author suggests a Windows-based partitioning/formatting utility.
So when I saw you saying not to do it, I was getting concerned that the other directions may be wrong.

philippe734, something went wrong with my ext4...:crying: I did everything in accordance with the Manual, Internal memory was formatted into ext4 and then I copied back all the files to the internal memory. While in PartedMagic the content of the Internal memory is seen, no problem. But when I reboot the device it works but it says, not the computer but the telefone, that there is no memory... The external card and its content, still in fat32 are seen in any file manager. I think I might have done something wrong but I can't figure out, what exectlyUsing CWM I connected the phone to the computer and formatted the system back to fat32, so the telefone works as before but I would like to understand what goes wrong when I try to format it to ext4... Any idea?

laotzy said:
philippe734, something went wrong with my ext4...:crying:..... formatted into ext4 and then I copied back all the files to the before but I would like to understand what goes wrong when I try to format it to ext4... Any idea?
Click to expand...
Click to collapse
Stop crying, read post #6 and get used to learn a little about Linux. Or fallback to VFAT.

chrhei said:
Stop crying, read post #6 and get used to learn a little about Linux. Or fallback to VFAT.
Click to expand...
Click to collapse
Dear chrchei, thank you for pointing me to where I could find detailed info about the S2. My problem is that I am not of Linux, so many things are not clear to me. I did read a lot about Linux recently, I did even manage to install Virtual Machine and thus I am able to play with Ubuntu but still, it's rather difficult for me to use all those terminal commands. I am an amateur, not a professional
P.S. OK, I am on the last Nightly on my Galaxy S2. After having been fighting with my Linux trying to format Internal memory into ext4 and receiving errors constantly, I tried to use the CWM's resources on board and, oh wonder(!!!), the memory was formatted into ext4 without any problem! Tomorrow will do the same with the external memory. (SD card)

chrhei said:
- Fix permissions (user media_rw, uid=1023, group media_rw, gid=1023):
cd /mnt/media_rw/
find sdcard0 -type d -exec chmod 0775 {} \;
...
find sdcard0 -type f -exec chown media_rw:media_rw {} \;
- FINISHED
Click to expand...
Click to collapse
Sorry, you are right. I didn't not understood. Please, could you tell me how to do the same modif using linux (as parted magic) ? Thanks in advance.

Related

[DEV][DATA2SD] More space (and more I/O) for your Desire (Updated/EXT4/Flashable ZIP)

HI all.
I know it has been already done but I didn't find any detailed tutorial for the hTc Desire so I wrote one for you
Howto for a HTC desire with clockworkmod recovery:
I did this with a stock HTC sense 2.2 froyo rooted rom with init.d support and my own kernel, forked from richardtrip sense kernel v5e. I don't know for other ROMs or Kernels. Your ROM must support init.d boot scripts.
What you need is:
* Fast µSD card (Class 4 or 6 recommended. Lots of issues reported with class 10 on the Desire)
* busybox (http://www.busybox.net/downloads/binaries/) on c:\
* Kernel with EXT4 support. The kernel in original ROM does not provide ext4 support!!
* Rom with init.d script support (StarBurst (Froyo) or Supernova (Gingerbread) have a native DATA2SD support)
* If you already have app2sd+ or a similar script, don't do the following hack (or at your own risks) !!
* If you still want to try it, backup your A2SD scripts and roll-back to a pre-A2SD state. Don't ask me why it's not working, I never used APPs2SD so I can't help.
* To help you with ADB, you can use the GUI
If you feel a bit lazy or you're scared to make any mistake and want to skip all the manual installation, then go straight to the bottom of this post and download the flashable script made by droidzone. Many thanks to him!! You can also flash Supernova (Stock HTC gingerbread release) and you'll be good to go within no time.
If you already have this running but you flashed another rom, have a look here. droidzone posted another script to just update the rom you just flashed to get DATA2SD work properly
[size=+1]1/Get yourself prepared[/size]
A/ backup everything (nandroid).
B/ Make sure everything is backed-up
C/ Copy the content of you SD to your computer and keep it handy for a roll-back.
D/ make a copy !!!! (I think know that you've been warned )
[size=+1]2/ Make 2 primary Mb aligned partitions on your SD[/size]
Primary partition 1 will be your usual storage, must be FAT32.
To optimize it, I really recommend to have a look here
Primary partition 2 will be your new storage (/data).
You can use gparted or fdisk (I do prefer fdisk and wrote a guide here ) to partition your SD; but it's up to you and Gparted is working great too.
Use the MB align option of gparted to align your partitions. This helps big time to get a better R/W speed.
With the latest busybox, you can do that on your phone in recovery mode.
You will need also e2fs progs. They're all attached at the bottom of this howto.
[size=+1]3/ Boot your phone in recovery and get it prepared[/size]
Connect to your phone with "adb shell"
You should get a ~# prompt now.
mount /system
mount /data
mount /sdcard
exit
if mount /sdcard fails, try mount /dev/block/mmcblk0p1 /sdcard
You should get this as a result of a "mount" command:
Code:
~ # mount
mount
rootfs on / type rootfs (rw)
tmpfs on /dev type tmpfs (rw,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
/dev/block/mtdblock4 on /cache type yaffs2 (rw,nodev,noatime,nodiratime)
/dev/block/mmcblk0p1 on /sdcard type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,s
hortname=mixed,errors=remount-ro)
/dev/block/mtdblock3 on /system type yaffs2 (rw,relatime)
/dev/block/mtdblock5 on /data type yaffs2 (rw,relatime)
Replace you old busybox exec with the new one. It's located in /system/xbin/
adb push c:\busybox-armv6l /system/xbin/busybox
Add the script to init.d folder:
adb push c:\01data.txt /system/etc/init.d/01data
Add the fstab to /system/etc/
adb push c:\fstab.txt /system/etc/fstab
Extract e2fsprogs-arm.zip to c:\
Push all e2fs progs you've extracted from the zip to /system/bin/ the same way:
adb push c:\e2fsprogs\system\bin\e2fsck /system/bin/
adb push c:\e2fsprogs\system\bin\mke2fs /system/bin/
(etc.... for all apps)
Push all e2fs libs you've extracted from the zip to /system/lib/ the same way:
adb push c:\e2fsprogs\system\lib\libext2_blkid.so /system/lib/
adb push c:\e2fsprogs\system\lib\libext2_com_err.so /system/lib/
(etc... for all libs)
adb shell
cd /system/bin
chmod 755 e2fsck
chown 0.2000 e2fsck
(Do the same for all pushed apps.)
cd /system/lib
chmod 644 libext2*
chmod 755 /system/xbin/busybox
chown 0.0 /system/xbin/busybox
chmod 755 /system/etc/init.d/01data
chown 0.0 /system/etc/init.d/01data
Finally type this:
:> /system/etc/mtab
[size=+1]4/ Instant of creation[/size]
cd /
For a non-journaled version:
/system/bin/mke2fs -T ext4 -b 4096 -E stride=64,stripe-width=64 -O ^has_journal,extent,^huge_file -m 0 -L userdata /dev/block/mmcblk0p2
For a journaled version (safety/AOSP ROMs):
/system/bin/mke2fs -T ext4 -b 4096 -E stride=64,stripe-width=64 -O extent,^huge_file -m 0 -L userdata /dev/block/mmcblk0p2
stride and stripe-width are RAID options but they are used here to align the filesystem to the max erase block size of an SD card. In conjunction with EXT4 extents feature (not present in ext3), it gives a bit of extra performance thanks to block allocation. It's used and recommended for SSDs, so it should help our poor little cheap (SSDs) SD cards
I use 64 because 64x4 (4kb block size)=256Kb. 256Kb is the max erase block size per the SD standards.
Your card may have a smaller erase block size but 256K is at least compatible with every card.
If you want to change the block allocation size, change the "64" parameter.
Just change it to - say - 32 (32x4=128kb) etc ...
Tune this to your actual erase block size if you know it.
If you want journaling (better data integrity) at the cost of performance and probably sd card wear, use the journaled option when you format the ext4 partition. Journal will also use some space on your EXT partition.
Read this article or my tutorial for more details on aligning partition and file system on linux.
I'd like to mention at this stage that fortunately, HTC has implemented a nice and clean unmount of /data at shutdown. Unless you remove your phone battery while it is running or android completely crashes and the cache hasn't been flushed to the sd card, you shouldn't suffer from data loss. In that case though, I've implemented a forced check of the data partition to try to recover any errors on the ext4 partition before booting the phone. You can expect to have a fair amount of safety without journal as long as you turn off your phone with standard HTC menu on sense ROMs
Anyway, if you want to try DATA2SD on a AOSP ROM, you *must* use a journal!
[size=+1]5/ verbatim[/size]
type this:
mkdir /sd
/system/xbin/busybox mount -t ext4 /dev/block/mmcblk0p2 /sd
cd /data
cp -a * /sd
cd /
sync
All you data should copied now.
check with a "ls -l /sd" that you have a least the directory structure.
"df" should report the space used on the new filesystem and should be close to your /data.
/system/xbin/busybox umount /sd
[size=+1]6/ Reboot[/size]
Reboot.
Move all you apps (if you have used the Froyo AP2SD) back to the phone, which is now the SD.
Reboot to get a clean and stable phone
Make sure that you don't install any app in the future to the SD. Some apps are installed automatically to SD, move them back to the phone if it is so.
[size=+1]7/ Comments[/size]
IMHO, a readahead of 128kb could be a bit excessive and can penalise read speed when reading small amounts of data. I've reduced it on my phone to 64kb and noticed a slight improvement when for instance the phone reads data to show apps, icons and size when you open the application list in the settings/applications/manage applications menu. Some kernels have a default value of 4K. This is really bad for performance and it must be changed to get good read performance.
To change it, type this while android is running:
echo 64 > /sys/block/mmcblk0/queue/read_ahead_kb
This setting will be lost on reboot. Just add this line to the script if you want to keep it on reboot.
ownhere did a fantastic job at hacking the libsqlite.so library. I patched the original sense lib and I strongly recommend to replace it with the one attached below.
To do so, just boot into recovery mode, mount /system and backup your /system/lib/libsqlite.so file to your sdcard. Then push the patched lib to /system/lib/ and do a chmod 644 on the pushed file.
Reboot and VOILA!
Updates of the flashable ZIP are available here
If you're coming from previous version (2 FAT32 partitions, ext2 file and loop mount) and want to move to this new one, have a look at this post. You don't have to do everything from start and loose your data. You should get there all the needed info to backup your data and restore it to the new EXT4 partition.
ownhere posted a very interesting option to play with in this post. Apparently nodelalloc mount option is giving better score than delalloc on flash memories. I recently tested it and I had better Quadrant and TAP scores so check-it out!
If you want to impress your friends with Quadrant score, just add "noauto_da_alloc" in the mount option of the script or do this manually with adb shell : busybox mount -o remount,noauto_da_alloc /data
The effect is pretty similar on the final score than nodelalloc (at least on my phone/sdcard )
To get back to normal: busybox mount -o remount,auto_da_alloc /data
(Got this setting from here).
It is simply making the system (thus Quadrant) working in cache (RAM) instead of the SD card.
I'm not sure that this settings improves that much real life usage, but at least you'll get what you're looking for: A super (fake) Quadrand I/O score
I may add this setting in future release of DATA2SD. I'm testing it ATM on my phone.
Many thanks to ownhere and melethron for all their thinkings at bringing issues, help and updates to get to this new version.
Many thanks to too droidzone for his great work on a flashable ZIP and integrating DATA2SD in his ROM to make your life easier you flash maniacs
I hope that I didn't forget something. It's working for me so it should work for you.
Read the thread before asking a question !
This sounds really great ... 2 things :
1. your links are broken
2. Can't we generate the file for /data on the first fat32 partition ... would be a lot easier to format the sdcard with only one partition ...
thank you very much for this great information ...
fogbav said:
This sounds really great ... 2 things :
1. your links are broken
2. Can't we generate the file for /data on the first fat32 partition ... would be a lot easier to format the sdcard with only one partition ...
thank you very much for this great information ...
Click to expand...
Click to collapse
No because you won't be able to use your SD as an external drive when connected to USB.
Just checked the links and they're OK
i vouch for sibere's script... i'm one of first "live testers" for his script and it works great and very, very stable
and from what have been tested by several testers , it can work in these roms :
without a2sd+ :
- rooted stock
- leedroid no-a2sd
with a2sd+ :
- auraxtsense
- defrost
- leedroid
- alex-v
Sibere, allow me to add notes from AndroHero on using the script with a2sd+ rom :
- remove the data2sd (or in auraxt, stuff2sd) from system/etc/init.d in the rom zipfile, or if you have install the rom, just remove from system/etc/init.d
- do the sibere script
Regards
BL
I have follow this easyest tutorial and i'm ok.
All credits to AndroHero for tutorial and to sibere for the hack! I'm only copy and paste from the previous thread!
This tutorial is for all app2sd sense rom so you can follow this tutorial not onfly for lee droid.
As attachment the file that tutorial need.
I have made a 2gb partition for data and is an awesome to see 1.80gb internal memory at first boot!!!!
WOOOOW
Now let's start with tutorial!
------TUTORIAL BEGIN-------
WHAT YOU NEED:
1)Root
2)Android SDK
3)15minutes of time
ALWAYS MAKE A NANDROID BACKUP AND SD BACKUP!!!
LET'S START NOW!
1) download leedroid 2.2f (apps2sd version)
2) unzip the .zip file, open the folder, open the system folder, and then inside that open the folder called etc, you will see a folder called init.d, open that and delete the file called 40a2sd, now just navigate back to the root of the rom and re-zip it.
3) now you need to partition your sd card, use gparted to make 2 fat partitions, a large primary partition and a secondary one about 1gb in size.
4) once you have done that copy the leedroid.zip to the sd card, boot into recovery, do all your wipes and flash the rom, one fashed boot it up and set it up as normal.
5) once set up, hold the power button and choose the option to reboot into recovery.
6) once in recovery connect your phone to your pc, open a command prompt and navigate to the tools folder inside the android SDK.
7) now in the command prompt type the following one at a time:
adb shell
mount /system
mount /data
mount /sdcard
exit
8) now leave the command prompt open and download the file at the bottom of the screen, (i have had to zip it, just open the .zip and the 01data file is inside) and copy it to the root of the c:\ drive on your pc.
9) in the command prompt type (one at a time and always wait for the # to appear again before entering a new command)
adb push c:\01data /system/etc/init.d
adb shell
chmod 755 /system/etc/init.d/01data
cd /
mount /dev/block/mmcblk0p2 /sd-ext
dd if=/dev/zero of=/sd-ext/ext2 bs=1048576
/system/xbin/busybox mke2fs -F -L userdata /sd-ext/ext2
mkdir /sd
/system/xbin/busybox mount -o loop /sd-ext/ext2 /sd
cd /data
cp -a * /sd
cd /
/system/xbin/busybox umount /sd
exit
adb reboot
10) your phone will now reboot with a much bigger /data/ partition.
------TUTORIAL END-------
I suggest to activate the boost!
type in adb shell window with android running:
busybox mount -o remount,noatime,nodiratime /mnt/asec/ext/ext2 /data
sibere said:
No because you won't be able to use your SD as an external drive when connected to USB.
Just checked the links and they're OK
Click to expand...
Click to collapse
Sounds real logical ...8) ... Ups ... shortcut in brain ...8)
bluelavender said:
i vouch for sibere's script... i'm one of first "live testers" for his script and it works great and very, very stable
and from what have been tested by several testers , it can work in these roms :
without a2sd+ :
- rooted stock
- leedroid no-a2sd
with a2sd+ :
- auraxtsense
- defrost
- leedroid
- alex-v
Sibere, allow me to add notes from AndroHero on using the script with a2sd+ rom :
- remove the data2sd (or in auraxt, stuff2sd) from system/etc/init.d in the rom zipfile, or if you have install the rom, just remove from system/etc/init.d
- do the sibere script
Regards
BL
Click to expand...
Click to collapse
Year sure, you're free to add notes mate
will this increase the battery usage?
kakit526 said:
will this increase the battery usage?
Click to expand...
Click to collapse
No effect at all on the battery usage. the usage is around the same .
BL
only one question:
is it better than using a2sd+?
what is the difference?
i had a lot of memory issues with a2sd+ (internal memory decrease very quickly compared to a2sd storage until i get the 'low memory' error message), does this solve my problem?
thanks
bye
Alessandro
Does this really increase IO speed? Can anyone who managed to set this up please post ur Quadrant benchmark.
alessandro_xda said:
only one question:
is it better than using a2sd+?
what is the difference?
i had a lot of memory issues with a2sd+ (internal memory decrease very quickly compared to a2sd storage until i get the 'low memory' error message), does this solve my problem?
thanks
bye
Alessandro
Click to expand...
Click to collapse
Yes, it will solve the problem
The reason why internal memory still decreases with a2sd+ is because not every part of the apps are moved to sd-card . Some of the data parts are still in the internal memory.
This script moves entire data folder to sd card, so nothing in internal memory get decreased
It can be any size you want. So far, the maximum tested size is 2 gb i think was tested by mattiadj & androhero.
BL
I tried once, i got 1956 score (CPU at 998Mhz)
Does this preserve the data on the card? Or do you have to copy everything back on?
Of course I'll have backups, but just asking
coutts99 said:
Does this preserve the data on the card? Or do you have to copy everything back on?
Of course I'll have backups, but just asking
Click to expand...
Click to collapse
it will survive the boot... of course, if you wipe factory data, everything will be gone...but it is safe and survive normal reboot or recovery reboot
BL
This is what is on clean flash of leedroid and after this hack!
I have made a 2gb partition....
Image talks alone....one word: THANKS!
Great job!
Now I expect seeing this bundled into all ROMs around here...
Any improvements are welcome but beside the space can you feel the I/O at some points or is it just a number?
Dude you are legen........ wait for it........... DeRY =D
hope to find a little time to test this awesome tutorial =]
what would happen if the SD card failed? does this render the phone unuseable until a new rom is flashed?

[Guide] Ext-SD ext4 (rw - short - 4.4)

I saw a few guides to make an ext4 formated MicroSD mount able, but most of them
look a bit complicated and playstore apps often didn't work for me. Specially under 4.4.
So what I did is this:
1) Format the MicroSD to ext4, using a linux system (ubuntu)
2) Mount the sdcard and change the permissions for sdcard and subfolders:
3) Running in Terminal: “sudo chown -R root:root /media/<user>/<sdcard_name>”
(Somehow sometimes i need to run this command twice)
After step 3) your perms should look like this:
Now my MicroSD works flawless on various devices in read and write mode.
To copy files on your card you must use a tablet/phone as a cardreader.
If anyone knows the necessary terminal commands for android to do this, please tell me.
For anyone who wants to optimize the MicroSD a bit (for me max +10%) you should look here.

send apps to sd card - avoid low storage advise warning

Hi!
This is a light version from the tutorial described below.
It create a full root WITH option to send your apps to sd card automatically!
How?
Because it create a funtional init.d folder in system/etc where you can put your own scripts to start on boot, giving you full control from your ROM/phone and if you have a ext4 partition in sd card ( 3 GB that's enough ), it will send your apps to sd card releasing storage.
LTE device have a default 2GB /data storage for apps and user definitions, phone call, etc. 3G device is worse!!!
So for a LTE device, 3GB from sd partition + 2GB from data partition = 5GB!
To show you why don´t need more, i have at this momente 61 app in /data/app ( in sd ext4 partition ) that fill 750MB - > 61 apps!!!
If you have a LTE device and your /data partiton is resized you can push a litle the size from external partition to 4GB ( that's enough ), im still trying to find a good size for external partition.
Why don´t need a bigger size?
Because there are file that still inside data partition, in /data/data and dalvik-cache, that still filling up data partition... you can´t take them all ...
3G devices need to be rooted with SuperSu zip first ( i don´t know way ) ... im a LTE user.
UPDATE-Kinguser-3.4.0-Modded_V2.zip
https://mega.nz/#!HoZniaSC
Key:
!tmmKUs-lnmAJo0Y4rcvxgZjYgsath0iTDBUYa7-T3YE
And this video shows how ROM works with a external ext4 partition in sd card what means that all apps go to sd card and let internal storage free:
https://youtu.be/7st6838_aAg
Use it only if you need it. Is your option.
I hope this helps you.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<<<<<<<The END of low storage>>>>>
I test it in L11 with B370 kit kat factory ROM. From 0.
!!!!Attencion!!!! 3G device users, read pinned post, you need to install SuperSU.zip first than this KingUser.zip to root OR WILL FAIL!!!!
In the step when you will install kinguser.zip change for this one, see the default tutorial here: https://www.facebook.com/groups/huawei.g6.development/permalink/578005512358705/
You need a primary external ext4 partition in sd card with the size you think you need for apps.
To create a primary ext4 partition in sd card with the size you want, you can use mini partition tool (for windows OS ).
http://www.partitionwizard.com/free-partition-manager.html
Need bootloader Unlocked:
https://www.facebook.com/groups/huawei.g6.development/permalink/504332286392695/
Need a custom recovery, i use TWRP for my L11, U models use more CWM, you can find it in G6SKnife.
Must have Windows OS to use G6SKnife:
https://www.facebook.com/groups/huawei.g6.development/permalink/577809609044962/
Than i modded this Kinguser flash zip that:
-Roots
-create a working init.d folder where you can store your scripts that will be executed on boot
-it will install busybox apk ( it need it to install some system tools )
- Rashr to change recoverys with the phone ( only need to have the images in sd card )
- It will automatically send all apps to your external ext4 partiton in sd card IF you have one!!!!
How to do it!!!!??????
READ IT CARFULL:
If you already have apps in phone do backup, use the phone default app for that.
Copy this zip to sd card:
UPDATE-Kinguser-3.4.0-Modded.zip
https://mega.nz/#!rhRknYDJ
Key:
!tnT9KAYOOcuSNm9eq7AcW_PHc2p-C4wjvssNI4IHAMU
Turn off and go to recovery ( TWRP or CWM ) by pressing at same time vol + and power.
Do a factory reset.
Go to install and search the UPDATE-Kinguser-3.4.0-Modded.zip and install it. The phone will reboot.
( A) After settings go to KingUser and open it to check if is ok than go back, open busybox, give root permissions, it will take some time seraching for old files than install it!!!!
( you will need this tools )
Reboot, and is done.
If you start from flash is the same process.
Now your apps go all to sd card.
This video show a flash of B370 and the root with this KingUser.zip:
https://youtu.be/CcFdbS20RrY
persona78 said:
#!/system/bin/sh
# apk to sd card
mount -t ext4 -o rw /dev/block/vold/179:66 /data/app
mount -t ext4 -o rw /dev/block/mmcblk1p2 /data/app
chown system system /data/app
# apk lib to sd card
mount -t ext4 -o rw /dev/block/vold/179:66 /data/app-lib
mount -t ext4 -o rw /dev/block/mmcblk1p2 /data/app-lib
chown system system /data/app-lib
chmod 773 /data/dalvik-cache
Click to expand...
Click to collapse
How is it possible to make the same source folder diferent and multiple target folder mount script?!! I think ther must be an error on this...
The first mount lines are pointing to /data/app and in the other lines pointing again to /data/app-lib?
its possible!
pestevao said:
How is it possible to make the same source folder diferent and multiple target folder mount script?!! I think ther must be an error on this...
The first mount lines are pointing to /data/app and in the other lines pointing again to /data/app-lib?
Click to expand...
Click to collapse
It's possible because works like a symlink. Imagine a room with several doors.
The mmcblk1p2 is the room, the /data/app , /data/app-lib are the doors.
Is working perfectly in my device. No lags.
http://postimg.org/image/8lc3of5pd/
http://postimg.org/image/jjnd6luap/
See this video, it have this script
pestevao said:
How is it possible to make the same source folder diferent and multiple target folder mount script?!! I think ther must be an error on this...
The first mount lines are pointing to /data/app and in the other lines pointing again to /data/app-lib?
Click to expand...
Click to collapse
This video shows how my ROM version works with a external ext4 partition in sd card what means that all apps go to sd card and let internal storage free:
https://youtu.be/7st6838_aAg
Hi!
I create a easy way, go here:
http://forum.xda-developers.com/ascend-g6/general/root-upadtekinguser-zip-modded-extras-t3349679
I've instaled the B370 and use Link2SD that have already bought. And it works perfectly and smooth!
With the original ROM / Android it displays a warning that mount must be done after a quick reboot but now everything is working on a normal reboot.
Used KingRoot 3.4.o modified to include /etc/init.d folder creation to Link2SD be able to write mount scripts and with the Huawei B370 cleans everything from Vodafone P that came hacked and pre-installed
Now is better than ever!
pestevao said:
I've instaled the B370 and use Link2SD that have already bought. And it works perfectly and smooth!
With the original ROM / Android it displays a warning that mount must be done after a quick reboot but now everything is working on a normal reboot.
Used KingRoot 3.4.o modified to include /etc/init.d folder creation to Link2SD be able to write mount scripts and with the Huawei B370 cleans everything from Vodafone P that came hacked and pre-installed
Now is better than ever!
Click to expand...
Click to collapse
With this option you don't need link2sd
http://forum.xda-developers.com/ascend-g6/general/root-upadtekinguser-zip-modded-extras-t3349679
Yeah you are maybe right. But when I make it with Link2SD I doesn't find yout tutorial (and even doesn't exists on xda forum) so right now is everything working there no reason to move away from Link2SD
This is how have my phone using a 64 GB SDCARD
pestevao said:
Yeah you are maybe right. But when I make it with Link2SD I doesn't find yout tutorial (and even doesn't exists on xda forum) so right now is everything working there no reason to move away from Link2SD
Click to expand...
Click to collapse
Hi!
I buy a 64 GB sd card, create 3 ext4 partitions and mounted like this:
So, now I have 24GB ext4 for data, 10GB ext4 storage and 27GB fat32 for external storage... For mt G6-L11. I had before resized data storage to 4GB.
By default is 2/3 , I can't remember.
Hi!
Main post is Update!
persona78 said:
Hi!
Main post is Update!
Click to expand...
Click to collapse
Great job congratulations!

How to decrypt SD storage(removable) | Phone to PC transfers | Easy | Automagically

I wanted an encrypted external sd on my phone that i could remove and transfer files to as needed.
This is the solution I conjured up after doing some testing and research
Thanks to @POQDavid who wrote How to decrypt and split adopted storage? which ive modified
Make sure your SD card is formatted as internal storage
Your device must be rooted.
Use a file browser like ES Explorer/Ghost/TotalCommander, browse to /data/misc/vold.
Copy the .key file to another folder and then move to your pc
DO NOT need to dump the hex like in other guides
Copy your key somewhere safe on PC
Code:
sudo mkdir /etc/keys/
cp <keyfilename>.key /etc/keys
On any Linux distro check where your drive is mounted, you can use
Code:
fdisk -l or lsblk
to find the large encrypted partition of the SD card, my SD card was mounted to /dev/sdd2.
Create the mount point:
Code:
sudo mkdir /mnt/1
Then run this command
Code:
sudo cryptsetup create usbcrypt1 /dev/sdd2 --key-size 128 --key-file /etc/keys/<keyfilename>.key
If your key is correct you can mount it by
Code:
sudo mount /dev/mapper/usbcrypt1 /mnt/1/
Test the mount
Code:
ls /mnt/1
Finally you can run
Code:
cd /mnt/1
to browse the decrypted storage.
Automation
Im tired now and so far I have automated this using terminal aliases
Just drop the alias into command and hit enter, the cryptmount to mount and cryptumount to unmount. (alias will be removed on reboot) edit and insert into ~./bashrc to make aliases stay
Code:
# alias mounting
[B]alias cryptmount="sudo su -c 'cryptsetup create usbcrypt1 /dev/sdd2 --key-size 128 --key-file /etc/keys/<keyfilename>.key' && sudo su -c 'mount /dev/mapper/usbcrypt1 /mnt/1'"[/B]
#alias unmounting and luksClose
[B]alias cryptumount="sudo su -c 'umount /mnt/1' && sudo su -c 'cryptsetup luksClose usbcrypt1'"[/B]
Remember to replace <keyfilename> with your keyfile name to make it work.
Next step make this automount in crypttab using dm-crypt method if thats possible... Any help appreciated.
cheers and good night
Table reserved for 2
Ok it works, but kind of a hassle. To copy files over you basically should copy them to a readable folder like user or any other one you can create directories in after mounting.
Copy your files to the encrypted drive, unmount .
then using a file manager with root access on your phone copy them from /mnt/expand/<UUID> to /mnt/sdcard and you should be good. It works for be but i wont be using this method anymore because its a pain to copy large amounts of files so many times. better to use an OTG usb for that
However this does have benefits if your phone is destroyed and only the adapted sd card exists and you need access to your files.
Enjoy.
[xzel] said:
Ok it works, but kind of a hassle. To copy files over you basically should copy them to a readable folder like user or any other one you can create directories in after mounting.
Copy your files to the encrypted drive, unmount .
then using a file manager with root access on your phone copy them from /mnt/expand/<UUID> to /mnt/sdcard and you should be good. It works for be but i wont be using this method anymore because its a pain to copy large amounts of files so many times. better to use an OTG usb for that
However this does have benefits if your phone is destroyed and only the adapted sd card exists and you need access to your files.
Enjoy.
Click to expand...
Click to collapse
Is it possible to browse adoptable storage from twrp using the aforementioned method?
I have busybox and cryptsetup in termux so i can use it from twrp terminal..?
Unreal_Hawkz said:
Is it possible to browse adoptable storage from twrp using the aforementioned method?
I have busybox and cryptsetup in termux so i can use it from twrp terminal..?
Click to expand...
Click to collapse
I believe you can mount it thru termux but I havent tried, I tried this on an Ubuntu system.

Mimic fstab entry by using a mount command that runs in an init.d script

Hey guys. I have an android tablet (running Android 8.1) that I flashed with a rooted system partition. The tablet has two main storage partitions: user and sdcard. sdcard is 20gb of storage that is immediately accessible via USB if plugged into the computer.
The problem I'm having is, after flashing with the new system partition, the 20gb storage is no longer mounted. I'm able to mount it using the following command:
Code:
$ mkdir /mnt/media_rw/sdcard
$ chmod 777 /mnt/media_rw/sdcard
$ mount -o rw /dev/block/blck27 /mnt/media_rw/sdcard
The problem is, after mounting it, I can't open media files, and I can't access it via USB either. I looked in the /vendor/fstab file to see how this partition is being mounted, which looks like this:
Code:
/dev/block/mmcblk0/mmcblk0p27 auto vfat defaults voldmanaged=sdcard1:auto,noemulatedsd
I'm not sure how to create a mount command that mimics the functionality of this. Any help would be greatly appreciated.

Categories

Resources