[TWRP][TUT] How to mount an SD card to a folder in TWRP recovery - Android General

Hell-o m8s.
It's annoying that some TWRP recoveries (for specific phones) don't mount SD cards properly (actually always)(and for me it's showing both internal&external storage but with the same capacity/empty space and when I select my card it uses the internal storage instead, if you know how to fix it pls tell me).
Anyway here I found how to mount an SD card to a folder in TWRP:
- In recovery mode (TWRP) go to "Advanced --> File Manager" and find an empty folder (you can choose any empty folder you want even in your internal storage) get its name/directory (in my case I used "/sdcard1")
hit back and go to "Terminal" (which is "Advanced --> Terminal")
in Terminal type this command:
mount -rw /dev/block/mmcblk1p1 "/yourEmptyFolder'sDirectory"
example:
mount -rw /dev/block/mmcblk1p1 /sdcard1
if it doesn't work make sure you've entered the correct block of
your SD card (normally the block's name is "mmcblk1p1" but it could be different sometimes) or try mounting the system partition from "Mount"
The folder will be unmounted when you exit/restart TWRP so if you want to use your card in TWRP again type the command again.
(it's not as helpful as it looks, but there are some uses for it like:
copying files from a computer when MTP is not working for some reason or copying files from the internal storage directly to your SD card, and copying backups and ROMs, saving storage...etc.)
BTW you can't Backup your device directly to your card, you'll have to move it to your SD, and if you want to use the backup copy it to your internal storage (in the TWRP folder).
Hope it helped you.

Related

/sdcard storage

Sorry if this has been asked before but what is the deal with the /sdcard directory on the tab? I have no sdcard in but there is already a directory on the internal storage for it. Is this for programs that automatically store data on /sdcard (if you don't have a card in the tab)? Can this later be changed? For example ES File explorer opens to /sdcard by default, can that be changed as well?
Any further info on this would be great thanks!
ICS uses an internal /sdcard directory on primary storage, and yes, partly for compatibility. If you put a microSD card in, it will be (on a stock ROM) at /mnt/extsdcard (I believe), though some custom ROMs are now providing a simpler symlink.

How to open / modify "vold" and "sdcard" file, Android KitKat 4.4.4

How to open / modify "vold" and "sdcard" file, Android KitKat 4.4.4
I have a Zopo zp999 and zp920.
On both devices the external sdcard is sdcard0 and the internal card is sdcard1, so all of the apps are installed on the slow external sdcard and the external card is recognized as the internal card..
I looked after for a way to swap these cards and on most smartphones there is a vold.fstab where i could change this - but not on my zopo phones.
on an earlier FW of the zp999 the cards have been in the (for me) correct order (internal sdcard0, external sdcard1) and when i took the two files from /system/bin "vold" and "sdcard" of the old FW to the new one, the order of the sdcards was correct.
for the zp920 is workaround is not possible, now i am searching for a way to open and modify these two files.
can anyone help me with this - please?
i tried to change the fstab / fstab.nand / fstab.fat.nand from the boot.img from:
Code:
...
/devices/mtk-msdc.0/11230000.MSDC0 auto vfat defaults voldmanaged=sdcard0:[email protected],noemulatedsd
/devices/mtk-msdc.0/11240000.MSDC1 auto vfat defaults voldmanaged=sdcard1:auto
...
to
Code:
...
/devices/mtk-msdc.0/11230000.MSDC0 auto vfat defaults voldmanaged=sdcard1:[email protected],noemulatedsd
/devices/mtk-msdc.0/11240000.MSDC1 auto vfat defaults voldmanaged=sdcard0:auto
...
with the "Android Kitchen" and cygwin
but after repacking the boot.img and flashing it back to the phone, the phone is stock in a bootloop.
maybe the unpacking / packing is wrong with my boot.img and Android Kitchen / cygwin (there are no errors)
i tried with both, the original boot.img and a boot.img from a marsapa custom rom.
i have same problem like yours..hope someone can help..
i want the internal storage be the sdcard0..
Any progress on this? From what I figured out so far it seems that MSDC0 is the internal sd card. So from the fstab you would expect the internal sd card to always be mounted to SDCARD0. But once you insert the external sd card the internal sd card becomes SDCARD1 and the external sd card becomes SDCARD0. This cannot be the intended behaviour as it breaks file paths for apps

[Q] Mounting to Adoptable Storage

So, I installed CM13 Alpha4 and Enabled Adoptable storage for my card. I downloaded Minion Rush to understand what data it stores on the actual sdcard (sdcard1) vs on the internal storage (sdcard0). The app instead of being on /data is on the external sdcard. All the data the game downloads goes to /sdcard/Android/data which is still about 200MB(Internal Storage). So, apps like WhatsApp, Instagram, etc will create their usual folders on the tiny 4GB Internal storage (sdcard0). On lollipop, I used Foldermount to keep all these folders on the actual sdcard and mount them to internal.
So, I tried the same with Adoptable Storage in the picture. (First I tried foldermount and set up the external card as portable but it failed).
Symlinking wouldn't work as they're different devices. (Or can it?)
The adoptable storage is mounted to /mnt/expand/blablabla/
Using this command to symlink
Code:
ln -s /mnt/expand/99d984f9-04df-445f-992d-abda2b2bcc6a/Mounted /sdcard/Mount
It returns "Function not Implemented".
Then I tried
Code:
mount -o bind /mnt/expand/99d984f9-04df-445f-992d-abda2b2bcc6a/Mounted /sdcard/Mount
and it sorta worked. When in adb shell, cd-ind to /sdcard/Mount, using ls displays all the contents of the folder "Mounted" in the adopted sdcard. However, using a file explorer on the device says the folder is empty. Tried Solid Explorer and ES. Moreover, the folder "Mounted" in adoptable has just one mp3 file and it isn't displayed in the Music app either, after mounting. Creating a file or folder in /sdcard/Mount using ES or Solid, fails. Can anyone help me figure this out, and is this even possible? (Tried foldermount here too. Toggle doesn't go green)
Another thought was to have a sdcard with two partitions. Tried that but when converting to adoptable, It formats to one partition. Is it possible to repartition without losing data after it's formatted as adoptable? It is somewhat possible to read write the card in Linux - Decrypting Android M adopted storage
This is just an idea to make better use of Adoptable storage.
Cheers!
AgentFabulous
Use following to have mixed storage from your external sd card both as adopted and portable storage. This can be done via android terminal app or through adb from your pc.
$ sm list-disks adoptable
disk:179_64
$ sm partition disk:179_64 mixed 75
$
gives me 75% as portable storage.
However I advise a reboot after setting

TWRP won't read External SD Card or /mnt

I've been rooted for a while without any issues, until recently I'm not sure what happened but suddenly TWRP won't show the /mnt folder or be able to access anything on my SD Card, I've tried mounting and selecting the SD Card in TWRP settings but it displays 0MB and won't select it. All I see is my Internal Storage files, which means I can't flash anything easily. I don't know when it happened but it was working about a week ago. I formatted my SD Card as ext4 in TWRP itself and also tried NTFS on Windows.
NOTE: I can view the SD Card in Solid Explorer and on my computer, TWRP is the only one that can't mount/read any SD Card files or even recognize it.
Is there any way I can work around this without formatting the SD Card?

Manually mount Android 11

Tell me how the system determines whether the SD card is mounted or not?
I want to mount the SD card manually and without fuss. To do this, I first unmount wherever it is mounted.
umount /storage/0123-4567
umount /mnt/runtime/full/0123-4567
etc
And then everything mounts fine with system namespace.
The problem is that if you unmount the sd card through the phone settings. And then mount it through the terminal, then the system and file managers do not see it. Nevertheless, it is possible to enter it manually through file managers.
The same happens in case of mount errors. The system stops seeing the memory card even if it is actually mounted. How can I tell the phone that it is mounted?

Categories

Resources