[Q] How does mounting work on android? - Android Q&A, Help & Troubleshooting

Seeing how I'm not getting any response to my question about f2fs, I thought I should educate myself on the general topic of storage on android.
From what I understood the external SD card is mounted by vold automatically when it's detected, based on the entries in /etc/vold.fstab. I skimmed through the vold sources and saw only support for the FAT file system (Fat.h, Fat.cpp), so I guess if I was interested in adding support of another file system I would have to modify vold, right?
Then I see here (link 1), that the external storage is case-insensitive and permissionless, so I will probably have to chmod 777 everything that goes on the card if it's not FAT32, right? Probably apps creating files on the card will store them with some sort of permissions that will prevent other apps from seein/reading them. I wasn't sure what would happen, so I thought I'd search on the net about how to handle ext4-formatted cards - first resource I found is here (link 2), though it's cm-specific it seems like it should work with any android. So I tried using the sdcard binary to bind my sdcard to /storage/extSdCard, this had however no effect, I just get a message:
Code:
get_selabel_handle: file_contexts is loaded from /file_contexts
nothing else happens. I guess that has something to do with SELinux, however I have it set to permissive, so I have no Idea where to go from here.
I'm kinda stuck and would be thankful for any help or links to reading material on this topic.
p.S: I'm not allowed to post links, because the system apparently wants to see me post crap 10 times till it allows me to post links, so I edited them out. The first link is documentation of external storage on android and the second is the first search result for "ext4 sdcard android".

Related

Swap External_SD with Internal SD (WIP, need help)

There is a sizable thread over i9003 forum about editing vold.fstab to swap internal with external sd. I guess they were more desperate as i9003 comes with very small internal storage. But even our "16GB" isn't enough for many of us.
I'm on 2.3.5, and I've tried editing the file using vim, and have failed miserably each and every time.
Unfortunately, the fstab file for i9003 differs quite a bit from the one for i9100. Here are what I've noticed:
i9003:
mount_deep
mbr_policy
i9100:
format_option
otg subsection
They also have different sysfs path and mount point.
Any knowledgeable person/people wanna jump in and make the magic happen?
does no one else see the value in this?
Sure I do
For instance I applied the idea from ownwhere (here) but in the most simple way just to test it.
I tested it with the gameloft dir.
So first I moved /sdcard/gameloft/ to /sdcard/external_sd/gameloft/
Then I created back an empty folder /sdcard/gameloft/
and then I mounted the external_sd/gameloft dir in it with :
mount --bind /sdcard/external_sd/gameloft/ /sdcard/gameloft/
I used Script Manager free version from market to run this script at boot time (added a baaad sleep 60 at the top of it to wait for the system to finish the storages checks).
And this works for me. It will help me to wait for a true external_sd / internal_storage swap mod...
I hope it will also help other people here in the same way as it did for me
sirnono said:
Sure I do
For instance I applied the idea from ownwhere (here) but in the most simple way just to test it.
I tested it with the gameloft dir.
So first I moved /sdcard/gameloft/ to /sdcard/external_sd/gameloft/
Then I created back an empty folder /sdcard/gameloft/
and then I mounted the external_sd/gameloft dir in it with :
mount --bind /sdcard/external_sd/gameloft/ /sdcard/gameloft/
I used Script Manager free version from market to run this script at boot time (added a baaad sleep 60 at the top of it to wait for the system to finish the storages checks).
And this works for me. It will help me to wait for a true external_sd / internal_storage swap mod...
I hope it will also help other people here in the same way as it did for me
Click to expand...
Click to collapse
But you'd have to unmount every time you want to use usb storage, no?
I think I've tried all realistic combination/possibility of editing the vold.fstab file given my very limited knowledge. My conclusion is, someone with knowledge needs to try this
ln -s /sdcard/external_sd/gameloft /sdcard/gameloft ?
samaral said:
ln -s /sdcard/external_sd/gameloft /sdcard/gameloft ?
Click to expand...
Click to collapse
Nope, doesn't work. Does symlink even work on FAT?
g2tl said:
But you'd have to unmount every time you want to use usb storage, no?
I think I've tried all realistic combination/possibility of editing the vold.fstab file given my very limited knowledge. My conclusion is, someone with knowledge needs to try this
Click to expand...
Click to collapse
Hello
Yes I need to do this if i want to use usb storage on desktop computer with the default system option.
But you can use apps like multi mount sd-card lite (free on market) to mount sd-card(s) on desktop computers and keep them mounted on the phone (read-only).
This way I didn't get any mounting problems but I didn't test very much so perhaps this can lead to mounting errors later on.
Maybe you have already tried this ?
I get massive slowdonws when copying large files with that widget.
Sent from my GT-I9100 using XDA App

[Q] Using hidden storage - Nook tablet

After rooting I can create folders, move files into, etc in the "hidden storage" using root explorer. Problem is I can't get apps to see anything there.
Example: Created Music folder and moved files into it. They will play by going there with root explorer and tapping on one, but music player will not see them on its own.
So far I have not found a music player that will allow me to designate that folder as the one containing the music.
To my knowledge, third party apps still do not see the storage area mounted there. Hopefully with the CM7 ROM, that can be rectified!
ok - thanks. I have put a couple of movies in that space as it is not much trouble to drill to them and tap the one I want to play - saves sd card space. For now will use it for movies and storage of little used material.
hi cdo5
check it here
you will get all "hidden storage" to use
edwardxi - Tried both methods (rename/copy) and manually adding with the same results - in root explorer /mnt/internal opens and has all the files I placed in /data/usrdata, but neither of two music players on the system see them. Someway I am missing how to tie them to the /mnt/internal folder. Additional direction please.
Take a look at the end of http://forum.xda-developers.com/showthread.php?t=1355969&page=10 -- the thread on accessing the whole filesystem.
cfoesch discovered that parted is a viable tool for resizing (well, deleting and recreating) partitions on the device.
I used a nook OS sideboot card with a modified vold.conf (commented out all the lines, essentially) that did not mount any of the internal partitions and had parted on board, then used the ADB interface to delete partitions 10 and 11 and resized them.
parition 10 is 1 gig and called media;
paritition 11 is 13 gig and called userdata
I recreated them, tried to put filesystems on them and reassigned the default names in parted, powered down, removed my card, and forced a hard reset (8 failed boots.) This completely reformats and reinstalls, but leaves the partition sizes alone.
Before I started, still booted from the rooted internal OS, I used dd to make copies of the first 8 partitions
/dev/block/mmcblk0pX of=/data/X.img
and copied those out to an sdcard.
http://nookdevs.com/Dump_NookTablet_Partitions explains who is who.
If the hard reset won't work, you can copy those 7 dd images to your boot card, boot, and use dd to put them back - in fact, I did that preemptively, but I suspect I didn't need to.
The command there would be dd if=X.img of=/dev/block/mmcblk0pX
A hard reset after restoring the first 8 does work. (It would probably work to do only the first 7.)
My NT now has 4 gig for BN stuff and close to 10 gig for my files manageable by Calibre, etc.
The last thing I did was, after rooting, to remove the directory
/data/media/B&N Downloads and symlink it to the directory
/media/B&N Downloads
Now, my books and magazines from B&N download to media and I can manage those in Calibre as well.
At first, I tried doing that last step by linking to a directory on the sdcard.
I had two issues with just using the sdcard, which (in addition to being annoyed by the partitioning scheme on general principles) made me very interested in resizing /media:
- the sdcard I'm using fails to mount at boot some of the time. So the library gacks some of the time.
- the /media partition on internal memory supports permissions assignment enough that magazines can be read when they're downloaded to it. The sdcard does not support permissions, or at least mine didn't (despite some attempts to force it to by changing values in vold.conf) and so magazines would download there, but could not be read if they were on the sdcard.
I've tried fiddling with those permissions in vold.fstab, without luck, before doing my resize.
dev_mount sdcard /mnt/sdcard auto auto /device/platform/usb/mass/storage/lun1 /devices/platform/mmci-omap-hs.0/mmc_host/mmc1
dev_mount media /mnt/media 10 002 /devices/platform/usb_mass_storage/lun0 /devices/platform/mmci-omap-hs.1/mmc_host/mmc0
Looking at the introductory stanzas in vold.fstab it looks to me as if the magic is in that auto auto versus 10 002 -- somehow, the NT is able to assign a permissions mask to a vfat partition, which I had thought was not possible. But when I've tried assigning those values to /sdcard it hasn't worked. I'm forgetting the failure mode now - that is, I can't remember if they just didn't work, or if the sdcard became unmountable.
cdo5 said:
edwardxi - Tried both methods (rename/copy) and manually adding with the same results - in root explorer /mnt/internal opens and has all the files I placed in /data/usrdata, but neither of two music players on the system see them. Someway I am missing how to tie them to the /mnt/internal folder. Additional direction please.
Click to expand...
Click to collapse
I forgot one thing
when you copy sth to /mnt/internal
you should set right permissions(I got 9 "√" all)
I use TTpod player
it can access to /mnt/internal and play music well
Many thanks! The TTpod player did the job - I was able to select the folder and get play lists. Great.
edwardxi said:
hi cdo5
check it here
you will get all "hidden storage" to use
Click to expand...
Click to collapse
I tried this method and got stuck in a reboot loop.
porthos75 said:
I tried this method and got stuck in a reboot loop.
Click to expand...
Click to collapse
Im sorry to here that
but make sure you set right permissions
pls note that VERY IMPORTANT: change the File Permission using Root Explorer same as the old file too
Click to expand...
Click to collapse

[Q] Journaling FS for Internal SD using CM7 (or 9)?

While doing some internal storage cleanup, I came across a bunch of junk files in the Opera cache. I'm guessing I had Opera running at some point when my phone died not so gracefully, corrupting whatever it was doing at the time. The immediate problem is that I can't delete these files. The file system utilities cannot find the files, but the file names are still in the FAT somewhere:
Code:
/mnt/sdcard/Android/data/com.opera.browser/cache/cache/g_0027 # ls
ls: ./[email protected]Â¥a»â©âª./â¤â¬: No such file or directory
ls: ./â¤cr[âÏ
.âb.: No such file or directory
ls: ./º4ô/.áuâ*: No such file or directory
ls: .±gy/â*B.âÎü: No such file or directory
ls: ./òú)â©â§+.â/ü: No such file or directory
ls: ./±Ï=%âid
.âµ/: No such file or directory
ls: ./iaòêâ*·âñ.â/w: No such file or directory
My first question (although less important) is can I delete these files using some unconventional method (not including formatting the space)?
My larger question, and the one hinted at by the subject, is this: is it possible to format the internal SD space as ext4? From what I understand after doing some Googling, the stock kernel (and perhaps Android in general) is designed around the idea that your non data space would be formatted as VFAT (it's built into the /init.rc inside the zImage according to one thread in the i9100 forums). Is this also the status of CM7/9? I did find an entry in the CM forums from last October where somebody just did it on a whim and ran into issues, to which others replied that apps2sd can use the space when set up for it...but no solution for actually using the space as regular storage.
I know enough about coding to really muck stuff up (I took a real basic C++ course way back in high school, know very little java, and a decent amount of scripting languages, but that's about it...I can stumble through reading code, but it'd be a mess trying to change it), so I'm not exactly inclined to dig into this that far, but I wouldn't mind assisting in some way if someone else was interested (I'll be happy to be a guinea pig, and don't mind trying to figure out some of the code stuff...I just wouldn't know what to do with it all if I did figure something out). I rarely connect to my phone via USB anymore, even more rarely do I mount the SD as mass storage to a PC, and yet more rarely still do I connect to a Windows PC via USB and mount as mass storage. Unless there's a good, solid argument for why the space uses VFAT besides compatibility with Windows, I'd love to be able to switch to a journaled file system.

[UPDATE]possibility to move ANY game data to sdcard2 ;)

hi there, thats it
is there any possibility to move the games-data to the sdcard2?
i couldn´t get gl2sd to work correctly. it moves my data, but my games dont recognize it and begins to download the data again (yes, i mounted the storage ^^).
ive got a 32gb sdcard, it would be awesome to get something to work in that direction.
----
Update:
YES I GOT IT! thx google and a guy named sergey_f1 ( credits goes to him, i only changed it for tablet s)
here it is: (example galaxy on fire2)
mount -o bin /mnt/sdcard2/net.fishlabs.GalaxyonFire2THD /mnt/sdcard/Android/data/net.fishlabs.GalaxyonFire2THD
in scriptmanager with SU + Boot on
please confirm if i made something wrong. im not a dev nor am i used to it-basics ^^
but for now it rocks
This should work. One thing to be wary of for new users reading this:
You're not actually really moving game data anywhere. You are simply making the folder /mnt/sdcard/Android/data/ be actually stored on another filesystem device. Anyone who has used Linux would understand the concept of remounting a folder elsewhere. The biggest difference with this (for your average user) is that if you remove the SD Card, you will not be able to use those games properly as their data storage location is now completely invalid, not just that the files are missing. This also means that if you are, for example, copying files from the /mnt/sdcard/Android/data folder onto your PC, you won't save any space on your internal storage, since that folder is mounted elsewhere.
As you said, that should work, its just a good idea to know technically whats going on before people start remounting FS's all over the place.

[Q] Migrating from /emmc/ to /data/media/ ?

The Nook Tablet has separate partitions which mount automatically as /data/ and /emmc/. IIRC, if you have no SD card installed, it will use /emmc/ as external storage and place all user data there. Newer devices such as the Galaxy Nexus do not have separate partitions, and instead use /data/media/ as external storage by default and place all user data there. I want to configure my Nook to work this way as well. I have already deleted the partition for /emmc/ and expanded the partition for /data/ to fill the empty space.
Does anyone know how to change the mount points so that /data/media/ is used for external storage? Do I just change the storage options in build.prop? Do I have to make new mount points in vold.rc? Do I need to add a symlink in init.d?
dylanwinn said:
The Nook Tablet has separate partitions which mount automatically as /data/ and /emmc/. IIRC, if you have no SD card installed, it will use /emmc/ as external storage and place all user data there. Newer devices such as the Galaxy Nexus do not have separate partitions, and instead use /data/media/ as external storage by default and place all user data there. I want to configure my Nook to work this way as well. I have already deleted the partition for /emmc/ and expanded the partition for /data/ to fill the empty space.
Does anyone know how to change the mount points so that /data/media/ is used for external storage? Do I just change the storage options in build.prop? Do I have to make new mount points in vold.rc? Do I need to add a symlink in init.d?
Click to expand...
Click to collapse
Bump, as I was interested in the same thing.
I know for sure that the solution is not that simple, as there is also an emulated SD card in the nexus devices (It was mentioned in an issue about duplicate files), so the configuration for this would be a bit more in depth.
Read the other topics about this issue and you'll see that there is no fully working solution for this yet.
AFAIK there isn't really much effort put into finding one either at this point.
I may have found a potential solution. According to this thread, there is a binary called /system/bin/sdcard that is called by a service to manage the virtual SD card on the Transformer Prime. It mounts /data/media to /mnt/sdcard using a fuse layer to simulate fat32.
I looked in the directory and the program is present in the system (at least in Succulent's CM10), so if anyone wants to try to get it to work, I would greatly appreciate it. I might try it when I get home if I have the time.
Here are a few more possibly helpful links (I will add more as I find more):
http://forum.xda-developers.com/showthread.php?t=2026783
https://android.googlesource.com/platform/docs/source.android.com/+/jb-mr1-dev/src/tech/storage/index.md

Categories

Resources