Yesterday I decided to fix the internal front speakers of my "HTC Desire Z" (aka. G2). While I was able to fix them, I broke the connector for the microSD slot (the left one). After trying to fix it for several hours, I gave up. It isn't in the scope of my hardwareskills :-(
Well, since I have like 600mb left on /data and my device is rooted, I tried to find a software solution i.e. "emulate" a SDcard device (because many applications require one to work properly, e.g. the camera app). I found here http://www.android-x86.org/documents/sdcardhowto a description how to create a vfat image and mount it as loopback.
While this is exactly what I want, I don't get it to work:
I don't know how to modifiy /proc/cmdline, or
how the entry in /etc/vold.fstab should look like.
dev_mount sdcard /mnt/sdcard auto /data/sdcard.img
didn't work for me. according to logcat, I have this version: I/Vold ( 2368): Vold 2.1 (the revenge) firing up
btw, just mounting the loopback device to /mnt/sdcard didn't work too. For example, the camera app still claims there isn't a SD card inserted.
edit: I also asked this on xda -> http://forum.xda-developers.com/showthread.php?t=1393395
There's no way for an Android application (constrained within the application sandbox) to create a loopback device.
Anything outside of this is not a developer question, and should be posted to another forum (e.g. https://superuser.com/).
I don't agree. Hanitaro Tide and PlasmaSoundHD both have created loop devices on my phone, all by themselves. On an x86 device it's even easier to fake an sdcard.img.p
Related
I've been trying to do this for 3 days now but i can't seem to get this to work.
So the gist of it is, I have an LG G6 running Android 8.0, with a 128Gb micro-SD card, I'm running out of internal space, and apparently LG and Samsung remove the adoptable storage feature from their android versions, I found a turn around to this which was to use ADB to partition the SD drive myself, and getting it to behave as internal memory, at first I had an issue with ADB even noticing my device, which I fixed by enabling USB tethering.
Past that everything seems to be going well, do the partition and reboot my phone,(speaking of which SD card is only detected after a reboot if I physically eject it and put it back in) all looks fine as per the screenshots
https://imgur.com/a/G7OJjFJ
(I was told memory misrepresentation was normal) until I get to the migrate data option which ALWAYS crashes the settings app, on top of that when I plug my phone into my computer I can only see the default internal storage of my device without any added memory.
I've reached a dead end and would appreciate anything at this point, even alternatives if you'd recommend I do something else (rooting or other methods i don't know about). Below are the sources I followed for this process, thanks in advance and if I missed any info let me know.
https://www.xda-developers.com/install-adb-windows-macos-linux/
https://www.androidpit.com/how-to-format-microsd-cards-as-internal-storage?fbclid=IwAR1pgqf6Ti2rSf_hbiyqLl0HufPewlPCHYmfBcfEzq_XRMhKxevwwq_mk28
https://www.modaco.com/news/android/heres-how-to-configure-adoptable-storage-on-your-s7-s7-edge-r1632/
Commands i entered by order as requested:
adb shell
sm list-disks
sm partition disk:179,0 private
And yes 179,0 IS the disk name on my phone as far as i can tell
I think that after the sm partition disk there is one thing that you didnt do. That is, sm set-force-adoptable false
After this jsut restart your phone and its gonna work most prob.
Android 6.0 Marshmallow’s introduces Adoptable Storage, a feature that allows use a SD Card as internal storage.
Is it possible to activate adoptable storage via ADB shell commands?
I managed succesfully perform this operation on my LG K8 LTE. I want to notice there are "500 xxx Unknown disk" errors problems, and give solution to avoid this. Solution is very simple.
Proper steps in ADB would be:
adb shell
sm list-disks
// HERE YOU GET YOUR DISK ID, SOMETHING LIKE "disk:179,64" - REMEMBER THOSE NUMBERS
sm set-force-adoptable true
// IN NEXT LINE, SIMPLY PUT THOSE NUMBERS AFTER "disk:" AND ALSO AFTER WORD "mixed" TYPE PERCENTAGE OF SPACE LEFT AS EXTERNAL, SO IN MY CASE:
sm partition disk:179,64 mixed 60
// IT TAKES TIME. BE PATIENT. WITH THIS LINE I TRANSFORMED WHOLE EXTERNAL SD INTO 40% OF INTERNAL AND 60% OF EXTERNAL
sm set-force-adoptable false
BANG! That's it! Now go to storage and usb, there click on internal part of SD and expand options, click on "use as internal" or something like that, last option, (I cannot see what was that because I already clicked it and everything works) apps are finally going on SD with OBB files! ;)
Have a good day!
I have done somewhat extensive research on this question online. I can tell you the steps, and they seem to work for everyone but me. Try them and let me know if they work for you.
Back Up your SD card, as it will be wiped.
If you don't already have it, download and install Java SE Development kit. The website is www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html. I used version 8u101 for Windows x64.
If you don't already have it, download Android SDK Manager. The website is developer.android.com/studio/index.html. Scroll almost to the bottom where it has "Get just the command line tools" and select android-sdk_r24.4.1-windows.zip for Windows. When it downloads, extract all to a location where you want to keep the folder.
Open the Android SDK folder and run the SDK Manager. (If it fails to run, see question 14504325 in stackoverflow). Follow the instructions on www.howtogeek.com/125769/how-to-install-and-use-abd-the-android-debug-bridge-utility/ to get it up-and-running.
When you have the command prompt open per the how-to-geek website instructions, enter "adb shell"
Then enter "sm list-disks". This will return the name of your microSD card. The instructions I was following showed a disk labeled 179:160, but my computer showed the disks as 179,32. This is where I'm stuck.
Finally, enter "sm partition disk:179:160 private", where the numbers are the name of your disk from step 6, if you want to adopt your whole SD card as internal storage. Otherwise, enter "sm partition disk:179:160 mixed 25" where the last number is the percent of the card's space used for external storage. I have not been able to get this to work.
See http://www.modaco.com/news/android/heres-how-to-configure-adoptable-storage-on-your-s7-s7-edge-r1632/ for the original instructions.
P.S. I tried this on a Samsung Galaxy On5, so that might explain why it hasn't worked.
This has now been disabled on (at least) some Samsung tablets.
I have a galaxy tablet that has been running with a huge sd card formatted as internal storage.
I purchased another more recently and on this adb format command did not work (it just immediately returned to the command prompt).
I have had to do a factory reset on the older machine and now find that it too will not allow the SD card to be formatted as internal memory - it behaves just as the newer one does.
My guess would be that Google have updated android to 'respect' the settings of the suppliers UI.
This has (of course) completely messed up my system, as the backup/restore was based on main memory of over 100GB, not the 16GB the device actually has.
We have several devices running Android in an industrial environment.
We think about completely setting up one device and then copy the whole /data directory to the other devices. The expected benefit is to configure things like wireless settings and install the required apps and updates only once on one device and somehow bring this onto the other devices.
Is this a good idea?
I am not sure if there is device specific information stored in data such as a device ID or something else that we would mess up with our idea.
Besides this what about 'uid's that are responsible to represent app permissions? Do you expect problems if our apps are not installed onto a device but simply come by a copied /data partition?
Is something specific established on a device after the first boot when /data is created and filled, that should not be replaced with something else?
Would it be better to copy only selected directories or even files? This is much more effort but ok if there is no other way...
I would appreciate any input about what can go wrong and what we should consider.
I have a widget that will tell the user the capacity of a connected USB device, as well as the amount of space used. I have gone through the android.hardware.usb API and I see nothing that can accomplish determining the size of a connected USB device and its usage.
Right now I am capturing Intent.ACTION_MEDIA_MOUNTED and searching in the Dir of the mount point for specific files etc... All of that is working fine, but for the life of me I cannot see how to leverage the API to determine the overall size, and usage, of a connected USB device.
Do any of you fine folks know, or have an article for me to read? Thanks all.
It sounds like your device is actually mounting the connected USB device's file system, which seems like it may be a vendor add-on rather than a stock android capability.
If that is indeed the case, whatever other options you might have you can use the df shell command, or more properly duplicate its functionality in java or a native subroutine.
You can view the source of android's df here:
https://github.com/android/platform_system_core/blob/master/toolbox/df.c
It looks to be a fairly standard implementation - read /proc/mounts to find the filesystems, call statfs() on each one. You'd probably want to filter by those of interest.
Is it possible to find out volume label of SD card inserted into Android device?
I understand that Android is designed to have just one "external storage" (as returned by Environment.getExternalStorageDirectory()), but there are quite a few devices in the wild that have internal flash as "external storage" and an SD card mounted under that or even wilder combinations (see this other question). It is possible to enumerate these additional devices by reading /proc/mounts, but we need something to identify them to the user. Is there any chance to get to their volume labels?
I checked that Linux vfat driver ignores the volume label dentry altogether and that blkid from util-linux reads the vfat itself. I also checked that, at least on device I have, the block device of the SD card has mode 660 and owner root.root, so I can't do that. So basically it boils down to whether there is any utility that could read it available.
I have found a solution.
The easiest solution is to build busybox and use it like this:
busybox blkid
Complicated solution is to find blkid for Android and find what you need in its source code (blkid_dev_devname function).
i don't know how it works exactly in android, but in linux i have kernel message about mounting sd-card, where volume name specified. You can try dmesg and cat /sys/devices/mmc... (or somethong like that)
Try to parse output of blkid command. It works for me, but I'm not sure if it is a firmware depended feature or not. I got permission denied with this command on AVD.
I don't know if this can help you: if you use the DDMS you can see the folders of the system. In my case, I found the sd card in: /mnt/media_rw.
You can get more information here and here
I hope it helps.