Second (ext) partition won't mount after app transfer - android

I've partitioned my 32GB, class 10, SD card in the following way: 30GB FAT32, 2GB ext for the applications (to use with Link2SD Pro).
However, as soon as I reboot the system after transferring any app, second partition can't be mounted and I have no idea why is it happening.
I've tried ext2/3/4 with the exactly same results.
System mounts second partition without a problem until I put something on it, and then it won't do it again.
I've formatted the card using Partition Wizard, Recovery (TWRP 2.7.1.0), manually (adb shell) and nothing seems to make a difference.
The partition is still there (fdisk sees it) I just can't mount it.
If I run e2fsck on the ext partition (with -y) it just goes into infinite loop inode error
I did a surface test of the card but there are no errors present.
OS is FusionX (JB 4.1), phone Huawei Ascend G330.
Any help is appreciated!

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 use Android "Apply update from SD Card" to run custom script

I'm trying to recover some pictures from my HTC One M9. It freezes on reboot after just a few seconds. I can only access the bootloader screen (white background with colorful menu options) and the Android Recovery screen (black background with 7 options.
From that Recovery screen, I immediately see the error
E:mount /cache fail, format it and mount again
E:failed to mount /cache (Invalid Argument).. try emmc mount
I've tried Sprint phone support, the Sprint store, and HTC support.
My attempt to "Wipe Cache Partition" from that menu fails with the same error.
I've tried adb, but it doesn't recognize the device in the "List of devices attached"
I'm considering two options, both of which would require using that "update from SD card" option... either a script that copies the files to the sd card, or a script that performs the required mount. It looks like executing that update is pretty straight-forward, but I haven't found any information on how to code those functions.
The edify scripting language that's used in the updater is documented here
I don't think it will do you much good though, I'm pretty sure the update file contents have to be signed with a signature that was known to the OS when it was being compiled (either the system signature or one set as an OTA cert)

Android: mount different userdata partition at boot

On my Samsung Note 10.1, I would like to be able to mount a different userdata partition. My goal is to achieve this at boot by modifying the init.rc script, since this seems to be setting up all file systems and mounting the partitions userdata, system, and so on. For example, there is a line mkdir /data 0771 system system, which sounds to me as if it sets up the mount point for the userdata partition. The userdata partition corresponds to block device /dev/block/mmcblk0p12.
Now, what I want is instead of mounting mmcblk0p12, I want to mount an image of mmcblk0p12, which I have placed on a µSD-Card inserted in the device. The µSD-Card is accessible via block device /dev/block/vold/179:17. This means that I would first need to mount the µSD-Card and then the image on the µSD-Card.
But this is where I fail. I can't figure out how to mount the µSD-Card in the init.rc, not to mention how to mount the image afterwards. I've added the line mount -t ext4 /dev/block/vold/179\:17 /mnt/extSdCard multiple times, but all it gives me is a boot loop.
So, does anyone know how to do this?
EDIT1: apparently the partitions get mounted in fstab.sdmk4x12, so I added the line /dev/block/vold/179\:17 /mnt/extSdCard ext 4 noatime,nosuid,nodev,discard,noauto_da_alloc,journal_async_commit,erros=panic wait,check. This unfortunately did not work, but kernel log gave me Cannot mount filesystem on /dev/block/vold/179\:17 at /mnt/extSdCard.
EDIT2: stupid of me not to use /dev/block/mmcblk1p1, which is the partition of the µSD-Card. This way I was now able to mount the µSD-Card by modifying the fstab.sdmk4x12 file.
EDIT3: after I was able to mount the µSD-Card, the problem of how to mount the image remains. I've modified the line where it mounts the userdata partition. The line is the same as the one from EDIT1+2, but uses the image /storage/extSdCard/userdata.img to mount it to /data. But I guess it apparently fails to mount the image. The device boots up, but displays some error, stating the userdata partition is damaged. It also gives me the option to reset it, but of course this only affects the userdata partition, and as soon as I reboot, it is trying to mount my image again, fails and shows me this error again.
I have found a workaround. Instead of trying to mount the image, I just copied all files from /data onto the partition on the µSD-Card, and mounted the partition as /data in the fstab.sdmk4x12 (i.e., mounting /dev/block/mmcblk1p1 as /data). All apps etc. will now be stored on the partition on the µSD-Card.

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