FORUMS

[Q] Use sdcard0 as sd-ext? Is it possible & expedient?

3 posts
Thanks Meter: 2
 
By harl windwolf, Junior Member on 11th January 2015, 12:10 AM
Post Reply Subscribe to Thread Email Thread
Hey, hoping someone on here may possibly know a definite answer to this. (goto last paragraph for my actual questions)

Since I got the Xperia L little over a year ago as a secondary phone, I started flashing and manipulating my (then) two devices, and I also use a lot more apps now than I did two years ago as my "need" to be mobile and stay available and connected has lately increased. Overall, I'm not too satisfied of the whole Android and apps concepts but, so far, I've appreciated the Xperia L as a versatile and unobtrusive device.

When its "internal storage" (or /data, basically) recently got a little cramped, I moved a few apps to SD via Android's native method, and when some apps wouldn't like to be moved or even stopped working after they got moved, I created an sd-ext partition in the external SD card and moved a few apps there, via symlinks first then via Mounts2SD - certain apps still seem to prefer to remain on the internal storage for some reason and some apps seem to act up (or lose settings etc), especially when /data/data is saved to sd-ext, or they wouldn't even run correctly, stop responding or crash (user apps only).

The "internal SD" is 4 GB in size and I barely need it for anything, other than saving ROM files, Gapps and aromafm when flashing without the external SD card present, which is 32 GB (and I have two of these) so I don't really see the point of saving work files and media on just another partition. I see how there may be a point in terms of speed, e.g. for taking pictures, since writing to the external SD card seems significantly slower (at most around 11 MB/s for larger files), and when saving apps to sd-ext, the internal storage provides enough space for a couple of photos anyway.

Now, my questions are if it's possible to use the internal SD partition as a mount point for sd-ext by whatever means, maybe swap certain /dev/blocks somehow, though I don't know which ones that would be and how I'd have to do that so Android doesn't give me the bird..?
And, considering the Linux way of "partitions" and mounts, is it even expedient practice to force apps "outside" the root/data structure..?
Is there a completely reliable (compatible and transparent) way to do this, so no apps ever complain about it, and then save/load their stuff (on either the internal or external SD), or would it generally be the better choice to remain with unchanged partitions..?
I take it there's no feasible way to actually re-partition the internal memory, so the whole /data thing would increase from 1.57 GB now to, say, 3.5 GB or more, leaving 1-2 GB for sdcard0 (enough for my purposes)..? (without an external input of sorts, however they initially put the partitions on the clean 8 GB memory)
The Following User Says Thank You to harl windwolf For This Useful Post: [ View ]
 
 
11th January 2015, 03:14 AM |#2  
Member
Flag Brussels
Thanks Meter: 38
 
Donate to Me
More
Quote:
Originally Posted by harl windwolf

...
I take it there's no feasible way to actually re-partition the internal memory, so the whole /data thing would increase from 1.57 GB now to, say, 3.5 GB or more, leaving 1-2 GB for sdcard0 (enough for my purposes)..? (without an external input of sorts, however they initially put the partitions on the clean 8 GB memory)

Yes there is ... look at this post I made earlier.
If you need more specific directions, I can post the exact commands I used on my Xperia L.
The Following 2 Users Say Thank You to Kahana82 For This Useful Post: [ View ]
11th January 2015, 06:42 PM |#3  
harl windwolf's Avatar
OP Junior Member
Thanks Meter: 2
 
More
Prompt
Thank you very much!
That was easier than I expected and so far seems to have worked without an issue.

I was about to fall back to Android 4.4.4 with a clean installation of CM11 (fxp) anyway, so I basically just had to run those commands over ADB in addition, and now my Xperia L's /data partition is about 4.3 GB, with 1.22 GB left for sdcard0.

Cheers!
The Following User Says Thank You to harl windwolf For This Useful Post: [ View ]
12th January 2015, 02:35 AM |#4  
Member
Flag Brussels
Thanks Meter: 38
 
Donate to Me
More
You're very welcome glad it helped you out
The Following User Says Thank You to Kahana82 For This Useful Post: [ View ]
12th January 2015, 06:28 PM |#5  
thunderising's Avatar
Senior Member
Flag Manipal
Thanks Meter: 1,953
 
More
Quote:
Originally Posted by harl windwolf

Thank you very much!
That was easier than I expected and so far seems to have worked without an issue.

I was about to fall back to Android 4.4.4 with a clean installation of CM11 (fxp) anyway, so I basically just had to run those commands over ADB in addition, and now my Xperia L's /data partition is about 4.3 GB, with 1.22 GB left for sdcard0.

Cheers!

This works with the latest CM12 beta too?
12th January 2015, 07:18 PM |#6  
rostifaner's Avatar
Senior Member
Flag Kyiv
Thanks Meter: 146
 
More
@Kahana82 @harl windwolf
maybe you created the guide on xperia l?
12th January 2015, 08:15 PM |#7  
harl windwolf's Avatar
OP Junior Member
Thanks Meter: 2
 
More
Quote:
Originally Posted by thunderising

This works with the latest CM12 beta too?

From what I know, it *should* work with any version of Android, as long as you can access the phone's console via ADB as well as the recovery menu (to mount/unmount sdcard1 if necessary and then format sdcard0). The 2nd post in that other thread kind of confirms that.
Of course, if you want your apps and settings back, you still need to back them up first.

Especially though, if you'd plan on flashing a new ROM anyway, you don't even need to boot the OS along the way of (re)partitioning the internal memory (nor do you need to remove the external SD card if you know which one it is in the mount list).
Just boot into recovery, connect via ADB, mount the external SD card (sdcard1) so you can run fs-utils, then run the respective commands (from the other thread) one after another, format sdcard0 in recovery, and that's it - then just flash the new OS etc.
13th January 2015, 02:36 AM |#8  
Member
Flag Brussels
Thanks Meter: 38
 
Donate to Me
More
Quote:
Originally Posted by thunderising

This works with the latest CM12 beta too?

Yes, I'm using it like that since beta 2.


Quote:
Originally Posted by harl windwolf

From what I know, it *should* work with any version of Android, as long as you can access the phone's console via ADB as well as the recovery menu (to mount/unmount sdcard1 if necessary and then format sdcard0). The 2nd post in that other thread kind of confirms that.
Of course, if you want your apps and settings back, you still need to back them up first.

Especially though, if you'd plan on flashing a new ROM anyway, you don't even need to boot the OS along the way of (re)partitioning the internal memory (nor do you need to remove the external SD card if you know which one it is in the mount list).
Just boot into recovery, connect via ADB, mount the external SD card (sdcard1) so you can run fs-utils, then run the respective commands (from the other thread) one after another, format sdcard0 in recovery, and that's it - then just flash the new OS etc.

I came to the same conclusions, the phone still has its partitions, same file-systems and partition names...I don't see what could break the fact that it should be completely transparent on usage.


Quote:
Originally Posted by rostifaner

@Kahana82 @harl windwolf
maybe you created the guide on xperia l?

Here you go, these are the steps I followed on my Xperia L:

Open a command window: CMD, then get into shell:
adb shell

Once in shell, type:
umount /storage
parted /dev/block/mmcblk0
print


This prints out the partition information of your phone's memory chip
You will see the partition numbers in the first column, partition names in the last one,
in between you have the start/end memory index and the partition size
------start---end---size
...
31---1795---3506---1711---userdata
32---3506---7818---4312---sdcard
In the above output, consider the values indicated in italic as not to be changed !

Now calculate (open a spreadsheed if you like) the new value for the end of the userdata partition,
and use the same value for the start of the sdcard partition
On your sheet it should look something like this if you added 2048 to the userdata size
------start---end---size
31---1795---5554---3759---userdata
32---5554---7818---2264---sdcard
Remove userdata and sdcard partitions:
rm 31
rm 32


Create the new userdata and sdcard partitions:
mkpartfs logical ext2 1795 5554
name 31 userdata

mkpartfs logical fat32 5554 7818
name 32 sdcard


Exit parted to go to the adb shell again:
quit


userdata partition (31) needs to have ext4 file system
The following will do the ext2->ext4 conversion:
cd /storage/sdcard1/fs-utils
tune2fs -j /dev/block/mmcblk0p31
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p31
e2fsck -fpDC0 /dev/block/mmcblk0p31


Now you can go to recovery and format the sdcard partition (default)
Then you can restore the backup you made before all this or do a clean install
The Following 7 Users Say Thank You to Kahana82 For This Useful Post: [ View ]
15th January 2015, 02:40 PM |#9  
Member
Flag Brussels
Thanks Meter: 38
 
Donate to Me
More
Location
I see a lot of people complaining about storage to install apps in the Lollipop threads, and are left in the dark most of the time.
Maybe it would be a good idea to rename this thread, so these people can find this information more easily...
@MikeChannon (Mod): Also put a reference to it somewhere in one of the stickies ?
Last edited by Kahana82; 15th January 2015 at 03:04 PM.
15th January 2015, 03:20 PM |#10  
MikeChannon's Avatar
Forum Administrator
Thanks Meter: 4,798
 
10
More
Quote:
Originally Posted by Kahana82

I see a lot of people complaining about storage to install apps in the Lollipop threads, and are left in the dark most of the time.
Maybe it would be a good idea to rename this thread, so these people can find this information more easily...
@MikeChannon (Mod): Also put a reference to it somewhere in one of the stickies ?

Well I'm the Forum Admin. To rename or sticky threads it's best to contact one of the Forum Mods. For this forum they are:
Mike
The Following User Says Thank You to MikeChannon For This Useful Post: [ View ]
15th January 2015, 06:24 PM |#11  
Member
Flag Brussels
Thanks Meter: 38
 
Donate to Me
More
Thanks Mike, sorry for the trouble.
I completely missed the "moderators" button on top of the forum (with all their names popping up when clicking on it) my bad.
Thus I reported my own post, which is probably the best way to get their attention anyway.

Read More
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools
Display Modes