FORUMS
Remove All Ads from XDA

[Guide] Format in ext4 internal memory and keep data

405 posts
Thanks Meter: 198
 
By philippe734, Senior Member on 19th August 2014, 09:43 PM
Post Reply Email Thread
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) :



- 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 :
The Following 14 Users Say Thank You to philippe734 For This Useful Post: [ View ] Gift philippe734 Ad-Free
 
 
21st August 2014, 09:59 AM |#2  
Senior Member
Thanks Meter: 59
 
More
Quote:
Originally Posted by philippe734

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

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
21st August 2014, 10:27 AM |#3  
philippe734's Avatar
OP Senior Member
Flag Paris (FR)
Thanks Meter: 198
 
More
Quote:
Originally Posted by laotzy

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

Format in ext4 the internal sdcard from recovery don't work, even if option is available. Use parted magic can avoid unexpected issues I did it with success on my Galaxy S2 running CM11.
21st August 2014, 10:30 AM |#4  
Senior Member
Thanks Meter: 59
 
More
Quote:
Originally Posted by philippe734

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

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
21st August 2014, 11:54 AM |#5  
philippe734's Avatar
OP Senior Member
Flag Paris (FR)
Thanks Meter: 198
 
More
Quote:
Originally Posted by laotzy

What I did wrong?

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.
The Following User Says Thank You to philippe734 For This Useful Post: [ View ] Gift philippe734 Ad-Free
21st August 2014, 03:38 PM |#6  
chrhei's Avatar
Senior Member
Flag Bochum
Thanks Meter: 106
 
More
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,
The Following 2 Users Say Thank You to chrhei For This Useful Post: [ View ] Gift chrhei Ad-Free
21st August 2014, 04:25 PM |#7  
philippe734's Avatar
OP Senior Member
Flag Paris (FR)
Thanks Meter: 198
 
More
Quote:
Originally Posted by chrhei

- ADB to your phone as root
[...]
- Fix permissions [...]

True. Because without this fix, no way to write or create new folder on the internal sdcard ext4.
21st August 2014, 05:12 PM |#8  
chrhei's Avatar
Senior Member
Flag Bochum
Thanks Meter: 106
 
More
Quote:
Originally Posted by philippe734

Please, could you edit to specify that is not needed to Android + Windows users.

I would like to keep this because it will prevent permission issues for everybody caused by wrong GIDs.
The Following User Says Thank You to chrhei For This Useful Post: [ View ] Gift chrhei Ad-Free
21st August 2014, 09:34 PM |#9  
Senior Member
Nottingham
Thanks Meter: 46
 
More
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?
21st August 2014, 10:10 PM |#10  
chrhei's Avatar
Senior Member
Flag Bochum
Thanks Meter: 106
 
More
Quote:
Originally Posted by HippyTed

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?

Yes, no extra options, just created the ext4 file system. I guess you ask because of the journal, no problems so far.
25th August 2014, 10:39 AM |#11  
Senior Member
Thanks Meter: 59
 
More
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...
Post Reply Subscribe to Thread

Tags
format ext4 internal memory

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

Advanced Search
Display Modes