bind mount at boot - Android Q&A, Help & Troubleshooting

Hello,
I have this old, but working, LG L65 d280n phone. It's already rooted and it runs LineageOS 14 (Android 7.1.2). It's nearly perfect for my needs, it only has little internal storage.
I'd like to bind mount (# mount -o bind ...) at boot the WhatsApp directory on another dedicated directory on the SD-card, so that I save a good share of internal storage.
I've already tried FolderMount app but it didn't work for me. I've also already tried Link2SD, but it does not support LineageOS rooting model. I don't know other apps that can solve this problem.
So I think I could just add that simple mount command to some script running at boot, I know GNU/Linux pretty well, but I don't know almost anything about Android/Linux.
Is there a place/hook/script I can use to add this command at boot?
mount -o bind /storage/self/primary/WhatsApp /sdcard/whateveritsname/WhatsApp

Related

How do I bind folders Cyanogen permanently????

Unlike every other rom I've tried Cyanogen doesnt automatically mount the externalsd folder and its located in /mnt/emmc
Now I know I can run the bind command to get the folder to go to its original location, by running mount -o bind /mnt/emmc/ /mnt/sdcard/external_sd
but that just disappears after the phone is rebooted, I would like to know how to run the command automatically at startup maybe via a script (which I have no idea how to write)
Its a minor annoyance in samsung cyangoen but I'm hoping it can be easily fixed, any help appreciated.
Thanks

[Q] is there a way to link messages/contacts to sdcard?

edit: take note, I am not asking on how to backup.
Having 17 thousand messages, don't want to delete any, of them.
I want messages on my inbox but memory consumed is on sdcard.
On The End 4.0 rom
tried
su
mount -o bind /data/data/com.android.providers.telephony /sdcard/data/sms
I think it's not working.
Any help there experts?
If you want to have a backup then use some SMS backup apps. Else, Titanium FTW.
Btw, what you're trying to do is just mounting. You can mount only images or partition storage in linux. Not a DIRECTORY.
Android uses SQLite database to store anything. If you want to have just a backup and you're sure about location of directory. Just pull with ADB, next time when you flash a ROM, you can use `adb remount` and push those database in same location to restore.
Rushyang said:
If you want to have a backup then use some SMS backup apps. Else, Titanium FTW.
Btw, what you're trying to do is just mounting. You can mount only images or partition storage in linux. Not a DIRECTORY.
Android uses SQLite database to store anything. If you want to have just a backup and you're sure about location of directory. Just pull with ADB, next time when you flash a ROM, you can use `adb remount` and push those database in same location to restore.
Click to expand...
Click to collapse
Hello, thank you for replying.
I am very well aware on how to backup. What Im asking is to link, having them on my inbox but memory consumed is sdcard instead of internal memory.
On sgs2, I was able to directory bind (by mounting) on gameloft games by mounting from internal memory to external memory.. I just forgot which commands I used.
Oh well, In that case I understood totally different what you were seeking for. Pardon me.
What you're seeking is "Attaching the filesystems" between directories through mount bind. (But there is not -o in modifiers there for creating such).
First backup your /data/data/com.android.providers.telephony safe place, which you won't be touching until Mount Bind process is successfully achieved.
Please consider I'm not responsible if you loose your 17k sms. Install SMS backup etc. But If you carefully follow these steps, I'm pretty sure nothing is serious.
Now,
1) Make directory in your SDCard, say
/sdcard/data/drigz08.telephony.original.source
2) Use app like root explorer to mount or just fire `adb remount` command if you've set up adb in your PC.
3) Move contents of /data/data/com.android.providers.telephony to /sdcard/data/drigz08.telephony.original.source
So now, all of your telephony directories data are moved. Now here comes the best part...
4) Bind those directories...
mount --bind /sdcard/data/drigz08.telephony.original.source /data/data/com.android.providers.telephony
Click to expand...
Click to collapse
step 4 will bind those directories in a way that from any path same contents are accessible, but new data will be store in sdcard only.
5) In case you want to change the path of source, or unbind directory..
mount -o remount,ro /data/data/com.android.providers.telephony
Click to expand...
Click to collapse
Let me know how it goes.
PS: I tested all of above under standard linux environment. Working fine.
did not work
drigz08 said:
did not work
Click to expand...
Click to collapse
Mount bind on new directory doesn't work or still mounted on com.android.....

[Q] Mount folder on boot?

I have looked all over for this, and I am not sure what files need to be modified. Right now I have Tasker doing a mount but I would like to do it on boot.
I read that it has something to do with init.d and some other jazz, but what? its simple of what I want to do,. i have a "mount -o bind /storage/sdcard1 /storage/sdcard0/external_sd" I am running CM10 right now, and for some reason it mounts everything to /storage/sdcard0 and sdcard1 a
i also want to rig it so my Rdio , and Spotify are mounted also with another line.
any help would be appericated.
thank you

[Q] sd card with two partitions: 2nd not visible to File Explorer

My situation: Galaxy S3 with latest (26 Oct. 2012) update to 4.1.1 via Kies. Then rooted. Works smoothly. External Sd-card visible, no problem.
Then:
repartitioned SD-card with gparted in Fedora machine: mmcblk1p1 with old contents, mmcblk1p2 for new contents, both vfat. Filled mmcblk1p2 with contents from linux machine.
In the phone the first partition (the one with the old data) is recognised as before. The second partition is not seen.
By using the terminal emulator as super user I can mount the second partition by the command:
mount -rw -t vfat /dev/block/mmcblk1p2 <mountpoint>
<mountpoint> is a directory VISIBLE to File Explorer.
After mounting, however, the directory contents are NOT visible in File explorer (even after stopping and restarting File explorer) but can be listed perfectly in the terminal emulator. Giving the cp-command for copying of an individual (MP3) file from the <mountpoint> to the folder Music shows the copied file in that folder and the music can be played in the usual way through the GUI.
Question:
Does anybody have an idea how to make the mounted 2nd partition visible to the apps so that the files can be accessed though the GUI?
Thanks for thinking about this problem.
Bananiel-1944
Found the solution by some more thinking after all:
mount -rw -t vfat -o umask=0000 /dev/block/mmcblk1p2 <mountpoint>
The -o umask=0000 is essential, otherwise the permissions are rwx------; with the umask option they are rwxrwxrwx and thus can be reached.
For safety sake, mount when needed and umount promptly afterwards.
Bananiel-1944
Bananiel-1944 said:
My situation: Galaxy S3 with latest (26 Oct. 2012) update to 4.1.1 via Kies. Then rooted. Works smoothly. External Sd-card visible, no problem.
Then:
repartitioned SD-card with gparted in Fedora machine: mmcblk1p1 with old contents, mmcblk1p2 for new contents, both vfat. Filled mmcblk1p2 with contents from linux machine.
In the phone the first partition (the one with the old data) is recognised as before. The second partition is not seen.
By using the terminal emulator as super user I can mount the second partition by the command:
mount -rw -t vfat /dev/block/mmcblk1p2 <mountpoint>
<mountpoint> is a directory VISIBLE to File Explorer.
After mounting, however, the directory contents are NOT visible in File explorer (even after stopping and restarting File explorer) but can be listed perfectly in the terminal emulator. Giving the cp-command for copying of an individual (MP3) file from the <mountpoint> to the folder Music shows the copied file in that folder and the music can be played in the usual way through the GUI.
Question:
Does anybody have an idea how to make the mounted 2nd partition visible to the apps so that the files can be accessed though the GUI?
Thanks for thinking about this problem.
Bananiel-1944
Click to expand...
Click to collapse
Dear Bananiel,
your post was closest to the solution of my problem, maybe you could suggest something that will finally help me.
I've partitioned external SDcard with CWM to be used for Link2SD. Link2SD's script works fine and the EXT2 partition mounts well. The problem is with the FAT32 partition which can't be mounted by android (I get "SD card empty of file system damaged" in the notification area). When I go in CWM recovery mode I can mount that partition by choosing "mount USB storage" option and then I can see it on my PC. Partition is healthy and PC has no problems with it.
I've tried issuing commands you've suggested in your post through ADB SHELL, after that when I go to folder that I've designated as mount point I can see files from non-working partitio, but the message in notification area still persist. Also the change is not permanent, after reboot I have to do that again.
Thanks in advance for any help given.
Bananiel-1944 said:
Found the solution by some more thinking after all:
mount -rw -t vfat -o umask=0000 /dev/block/mmcblk1p2 <mountpoint>
The -o umask=0000 is essential, otherwise the permissions are rwx------; with the umask option they are rwxrwxrwx and thus can be reached.
For safety sake, mount when needed and umount promptly afterwards.
Bananiel-1944
Click to expand...
Click to collapse
dxage said:
Dear Bananiel,
your post was closest to the solution of my problem, maybe you could suggest something that will finally help me.
I've partitioned external SDcard with CWM to be used for Link2SD. Link2SD's script works fine and the EXT2 partition mounts well. The problem is with the FAT32 partition which can't be mounted by android (I get "SD card empty of file system damaged" in the notification area). When I go in CWM recovery mode I can mount that partition by choosing "mount USB storage" option and then I can see it on my PC. Partition is healthy and PC has no problems with it.
I've tried issuing commands you've suggested in your post through ADB SHELL, after that when I go to folder that I've designated as mount point I can see files from non-working partitio, but the message in notification area still persist. Also the change is not permanent, after reboot I have to do that again.
Thanks in advance for any help given.
Click to expand...
Click to collapse
In my situation (SD-card with two partitions, both vfat) the first partition automatically was mounted at start-up, the second needed to be mounted manually whenever I wanted to access it. This was also my intention as that second partition contains sensitive information.
Android has a file fstab.<system-id> in the root directory, in which some mounts are mentioned (but not all).
You could try to edit this file with the permanent mounts you are looking for. I'm not sure if that works, however, as I do not want a permanent mount.
Can you publish your results, please?
Bananiel
Finally!
I managed to get my external partitions visible with the help of this post.
Device: Samsung Galaxy Tab2 10.1
ROM: Candy5_p5110 Android 5.1.1
SDExternal: 2 Partitions; 1st VFAT, 2nd Ext3
Using Mount2Sd from Google Playstore.
I had the same mounting issues. SD external would only mount Partition 1 automatically and manually mounting Partition 2 would only be visible via Terminal.
The solution that finally fixed the invisible 2nd Partition was to reformat the 2nd Partition with Ext3 and allowing Mount2Sd to find it and mount to /sd-ext. Formatting to vfat or ext4 did not work. Only Ext3 did the trick.
I hope this helps others and big thanks to the OP for bringing this issue up.

[Q] Trying to recover from a data wiped SD card

Hi all.
I recently went about updating my tablet, and in the back of my mind I was under the impression that TWRP would backup the internal sdcard's files during the normal backup, so I thought nothing of wiping the internal sdcard. Whoops. It, of course, didn't, and now I find myself with a whole slew of stuff gone. Not much else was written to the internal sdcard (which is on an ext4 filesystem), so I suspect that a good bit of my stuff can still be sitting there in the data graveyard. Hopefully.
Since I'm on Linux and can't mount the sdcard directly (since for some odd reason Linux has issues with MTP), all I've been able to do was this:
I booted the tablet into recovery mode and opened up adb, and ran the following command through the adb shell:
Code:
~ # dd if=/dev/block/mmcblk0p8 of=/dev/block/mmcblk1p1
Where mmcblk0p8 is the internal sdcard with the lost data, and mmcblk1p1 is an external sdcard. I thought that by running that command, I could create a carbon copy of each and every little thing on the old sdcard, write it onto something my computer could read, and then go through the normal recovery process. In this case I planned to use a Linux tool called "extundelete."
Here's where I get stuck. The sdcard appeared to have cloned correctly, given that the entire thing is now filled up and reads as an ext4 filesystem on gparted (when it was previously fat32), but now I can't mount it. And if I can't mount it, I can't restore anything. Here's what I get when I try to mount it:
Code:
Error mounting /dev/sdb at /media/user/57f8f4bc-abf4-655f-bf67-946fc0f9f25b: Command-line `mount -t "ext4" -o "uhelper=udisks2,nodev,nosuid" "/dev/sdb" "/media/user/57f8f4bc-abf4-655f-bf67-946fc0f9f25b"' exited with non-zero exit status 32: mount: wrong fs type, bad option, bad superblock on /dev/sdb,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
So to sum it up, I accidentally wiped my tablet's internal sdcard using TWRP 2.3.3.0, and now I want to recover what was lost during the wipe. Not that it matters, my tablet is a Transformer Infinity in case anyone asks. Though I don't think that's really relevant here.
If anyone knows how to help me, or knows of a better way I should go about getting my data back, that would be, for a lack of better words, super awesome.
Thanks!
BJSerpas said:
Error mounting /dev/sdb
Click to expand...
Click to collapse
Seems you tried to mount /dev/sdb, not /dev/sdb1.
Also, did you make the SDcard partition the same size as the source partition? And what did dmesg say?
Also, http://forum.xda-developers.com/showthread.php?t=1994705 might be of some help..
kuisma said:
Seems you tried to mount /dev/sdb, not /dev/sdb1.
Also, did you make the SDcard partition the same size as the source partition? And what did dmesg say?
Click to expand...
Click to collapse
When I plugged it in, Linux automatically mounted it to sdb and not sdb1. And the external SD card was the same size as the internal one, 32gb. Currently not home so I can't run dmesg at the moment.
And thank you bodh, that looks very useful and is more or less what I was trying to do. I'll have to get on a windows PC it seems, but no issue there. In the meantime, is there a way to write protect the internal SD from the android terminal emulator until I get home? I don't want my old files accidentally overwritten. Or I could just not use the tablet if that's the better option here.
Thanks guys!
I'm not sure you could write protect the internal sd. I've tried changing permissions on it and get errors. You're best bet is probably to go without the tablet use for now.
BJSerpas said:
When I plugged it in, Linux automatically mounted it to sdb and not sdb1. And the external SD card was the same size as the internal one, 32gb. Currently not home so I can't run dmesg at the moment.
Click to expand...
Click to collapse
I'm talking about the number of blocks exactly, not "32gb" or so. And mount /dev/sdb1 manually, don't rely on Gnome failing to mount /dev/sdb.

Categories

Resources