android shell mkdir out of memory - android

I use adb shell to access an Android 4.4.2 tablet through a USB connection.
When trying to create a folder in the internal storage (/storage/sdcard0) I get the error 'Out of memory'.
The device has 20+ GB of free space and also has a second sd card mounted as /storage/sdcard1 where the folder can be created just fine.
Both volumes are using msdos.
I tried fsck_msdos to /dev/block/vold/179:9 (the physical path) but found no errors.
Any ideas before factory resetting the thing?

What suggested by Saehun was the correct answer but because I can't give the credits to him I close my own question. Thanks again Saehun!

Related

Partitioning an SD card through ADB (Android Debugging Bridge)

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.

How to turn a portable SD card into internal storage via ADB command?

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.

Need help about android mounting Sdcard

Im working on "mount ntfs sdcard"
That is problem:
- If i mount sdcard to another folder than /mtn/sdcard then my sdcard working find
- If i mount it to /mnt/sdcard then android not except it : " The SDcard is not currently mounted"
In adb shell i type mount command and see that my SDcard is mounted to /mnt/sdcard
But infact SDcard folder cannot accessable.
I think android doesnt except mount ntfs sdcard on /mnt/sdcard because it programed to mount vfat sdcard on /mnt/sdcard.
Now the question: where i can find mounting code or mounting procedure of android when we insert SDcard? i want to modify it to accept ntfs sdcard.
P/S: im on GB 2.3.6
This is a very specific question, I doubt you will get an answer here. You might want to try to locate it yourself from the source code which could be found here:
https://sites.google.com/a/android.com/opensource/download
I did some googling and found this:
http://cateee.net/lkddb/web-lkddb/NTFS_FS.html, you might need to modify it.
On Android, the mounting of the sdcard is managed by the vold daemon.
If you want a stable system, you likely need to either get vold to manage your custom mount, remove vold from the system and do it's entire job yourself, or somehow get it and your custom solution to stay out of each other's way.
Lots of custom ROMs have used vold in different ways - to partition an sdcard and add a unix-style filesystem for storing apps, to put an entire alternate android installation on an sdcard or tablet internal storage area, etc. You might get some ideas by looking at those, reading their development discussion history, etc.

Mount Second Partition on Android Device with vold

I want to have access to an ext4 partition, without using Data2SD yet, on the SD card of my HTC Vision running the Virtuous Unity 1.3.0 ROM. I modded my /system/etc/vold.fstab file from this:
dev_mount sdcard /mnt/sdcard auto /devices/platform/goldfish_mmc.0
/devices/platform/msm_sdcc.4/mmc_host/mmc2
To this:
#dev_mount sdcard /mnt/sdcard auto /devices/platform/goldfish_mmc.0
/devices/platform/msm_sdcc.4/mmc_host/mmc2
dev_mount sdcard /mnt/sdcard 1 /devices/platform/goldfish_mmc.0 /devices/platform/msm_sdcc.4/mmc_host/mmc2
dev_mount e4vol /mnt/sdcard2 2 /devices/platform/goldfish_mmc.0
/devices/platform/msm_sdcc.4/mmc_host/mmc2
So I can get my second partition, with label e4vol, mount and usable on my Android device. Two issues, and I think one obviously has to do with the other.
I have tried remounting the root read-write and creating the mount point /mnt/sdcard2, but it is gone on reboot. Seems like Android might have in the past created such mounts with mount.conf. Now it does not exist on Gingerbread ROMS. Thoughts?
Is this all I would have to do to get my second partition mounted in Android, or do I also need to create /sdcard2 like /sdcard? I presume both are created as symlinks by vold as specified in this conf file, but I have not had time to check yet.
I would ask forums, but this seems like a developer question and this is the most recent release of the OS. It seems to change a lot from version to version of the OS. Thanks in advance for your patience and help.
UPDATE: So, moved the test mount to sdcard, and it did not work, even with a persistent mount point. So, not sure where I am going wrong.
Maybe you'll have to have a look into /init.rc.
There are some "mkdir /mnt/..."-statements. You only have to add your "mkdir /mnt/sdcard2" and "ln -s /mnt/sdcard2 /sdcard2" to this file.
But be careful when editing this file!!!
I looked at the vold source up to including Icecream-Sandwich: it’s final mount() system call is hardcoded to the “vfat” file system type. – Even if you get it to try the mount, it would fail.
I myself actually want to mount my ext4 SD card to /sdcard, because I regularly suffer from SD card FAT file system corruptions (and I’m not the only one having those with Android).
The alternative is: modify the init/boot process to just mount the partition where you want, bypassing vold.

(re)mounting the SD card on android emulator

On the emulator, I can unmount the SD card from the Settings.
I can then mount it on my OS, then unmount it normally.
I haven't been able to figure out how to re-mount it then on the emulator (without rebooting it).
hints:
the adb command remount is unrelated: it's about /system
the emulator command is unrelated: it's only about starting the emulator
mounting the SD card in two places of course messing everything up (I tried)
more:
mount outputs the following:
/dev/block//vold/179:0 /sdcard vfat rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
trying to mount again from the shell after unmounting it, using the same options as above, gives a segfault
no idea why the double slash in block//vold, I guess it's just a typo
The developers guide suggests that this isn't possible:
SD Card Emulation
You can create a disk image and then
load it to the emulator at startup, to
simulate the presence of a user's SD
card in the device. To do this, you
can use the android tool to create a
new SD card image with a new AVD, or
you can use the mksdcard utility
included in the SDK.
The sections below describe how to
create an SD card disk image, how to
copy files to it, and how to load it
in the emulator at startup.
Note that you can only load disk image
at emulator startup. Similarly, you
can not remove a simulated SD card
from a running emulator. However, you
can browse, send files to, and
copy/remove files from a simulated SD
card either with adb or the emulator.
The emulator supports emulated SDHC
cards, so you can create an SD card
image of any size up to 128 gigabytes.
While Android will unmount the SD card, the emulator process keeps the backing file open.
$ ls -go /proc/`pidof emulator`/fd | grep sdcard.img
lrwx------ 1 64 2010-05-13 01:50 10 -> /home/x/.android/avd/WithSD.avd/sdcard.img
Someone more familiar with QEMU may be able to provide further insight but, if I were you, I would just try to use NFS to solve this problem.
I tried going to Settings and unmounting the SD card and this worked fine. Give it a try; remounting it is quite simple.
Doesn't seem like this can be done via adb/cli though.

Categories

Resources