[Q] directory bind to play game with OTG usb drive - Nexus 7 Q&A, Help & Troubleshooting

I am facing this issue with my Nexus 7 4.2.1 stock ROM rooted.
I am trying to move game data to a usb flash drive to save space, and then mount bind the directory using an OTG cable.
When I use StickMount I can see the usb drive at /sdcard/usbStorage/sda1 using ES File Explorer.
Then I use Terminal Emulator to mount bind the directory:
[email protected]:/ $ su
[email protected]:/ # mount -o bind /sdcard/usbStorage/sda1/test /sdcard/Android/data/test
These seems to work because if I navigate the directories using Terminal Emulator, I see how the test directory was linked and the data can be seen.
But if I use ES File Explorer to go to the same directory (/sdcard/Android/data/test), folder is empty, and if I try to run the game, it tries to download again because can't see the data in that directory.
So my question is if I can do the directory bind using other source like /data/media, /storage/sdcard0, or /mnt/sdcard instead of just /sdcard to make ES File Explorer and the game to see the data directory?
It is good to verify with Terminal Emulator that the directory bind worked but not good enough to make the game works saving internal storage space.
Thank you.

http://forum.xda-developers.com/showthread.php?p=35960052
Directory bind does not work on android 4.2.1!
The above thread has more details, hopefully the developer of directory bind app is looking for a solution!
Sent from my Nexus 7 using XDA Premium HD app

I don't need to use the app. I can do it just typing the unix/linux commands.

rabascal said:
I don't need to use the app. I can do it just typing the unix/linux commands.
Click to expand...
Click to collapse
The new file structure in android 4.2.1 is causing problems! The app i believe uses the bind command as well! So it is the bind command that doesn't work properly!

Have you tried using Sy links instead of binding the folder?
Use the following command to symlink
ln -s [source folder] [destination folder] where source and destination are path names

Thank you for the suggestion.
I tried several times on different directories but it didn't work.
I read somewhere that symlink does not work with FAT32. Is this my problem?
The USB flash drive that I am using where I copy the fifa 12 game directory is FAT32.
Do I need to have the usb storage formatted as ext2 or ext4? How can I do that? I am guessing I can't do it on Windows, right?

rabascal said:
Thank you for the suggestion.
I tried several times on different directories but it didn't work.
I read somewhere that symlink does not work with FAT32. Is this my problem?
The USB flash drive that I am using where I copy the fifa 12 game directory is FAT32.
Do I need to have the usb storage formatted as ext2 or ext4? How can I do that? I am guessing I can't do it on Windows, right?
Click to expand...
Click to collapse
Try formatting it to ext3..it will delete the data of course so take a backup.on windows use mini tool partition manager...its free and can format to any ext.

Related

[Q] Redirect mount point of External SD..

Can I change the mount point of the External SD card (microsd) from
/mnt/external_sd
to
/mnt/sdcard/MicroSD
I tried changing the entry in vold.fstab to no help. it wasn't mounted to /mnt/external_sd but it also wasn't mounted to the MicroSD folder i made on /mnt/sdcard
This would let any program that doesn't have the ability to handle the external SD card to be able to access it as it wouldn't know where it was. I could then do this to USB drives plugged in as well.
Nova5 said:
Can I change the mount point of the External SD card (microsd) from
/mnt/external_sd
to
/mnt/sdcard/MicroSD
I tried changing the entry in vold.fstab to no help. it wasn't mounted to /mnt/external_sd but it also wasn't mounted to the MicroSD folder i made on /mnt/sdcard
This would let any program that doesn't have the ability to handle the external SD card to be able to access it as it wouldn't know where it was. I could then do this to USB drives plugged in as well.
Click to expand...
Click to collapse
This might not exactly be the route you wanna take, but have you tried adding a symlink? Might do the trick, then again, I'm having a little issue with the same thing right now. Looks like this has been a popular subject lately
symlinks seem to be inoperable in HC.
Found this on another forum
Have you tried "bind" mounting?
Doesn't wok for me as I have a stock (unrooted) transformer...
cd /mnt/sdcard
mkdir MicroSD
mount -o bind /mnt/external_sd /mnt/sdcard/MicroSD
Click to expand...
Click to collapse
Works fairly well. Doesn't effect the storage count for the internal memory however. if we could actually mount it to a folder inside the scdard mount then it may show up as extra space, but i kinda doubt that bit.
Those system files are overwritten on each reboot so you have to "mount -o bind" on every reboot.
If you find a way to make this mount point permanent let me know, I am looking for a way as well.
If you're rooted, I think USB Mount All did this.
powercat_ said:
Those system files are overwritten on each reboot so you have to "mount -o bind" on every reboot.
If you find a way to make this mount point permanent let me know, I am looking for a way as well.
Click to expand...
Click to collapse
What system files? Its simply a mount point created and handled in memory. its never added to a file. I forget what the start up command file is in linux that is the sister of DOSs Autoexec.bat. It would need to be added to that as the last command. Now i have read this is a risky command to run as it can create a endless loop if something attempts to scan the directories it can run into a recursive loop. Now I believe this is because most instances of this command tend to be used to bring a directory onto the desktop thats a few steps above it. Considering that the way I am using it is to link a directory that is outside the scope of another, it shouldn't ever cause this and be a pretty safe way to do it. The BIND command creates a hard link between the two locations. the /mnt/sdcard/MicroSD is a directory I created. when I bind it to the /mnt/external_sd directory the files appear in both places at the same time as MicroSD is simply a... tunnel as it were into External SD. But the programs are convinced its MicroSD. So those that can't use the external sd slot now can through this "tunnel". The same trick can also be applied to the directory for the USB thumb/flash drives.
Just create a directory for it on /mnt/sdcard
fermunky said:
If you're rooted, I think USB Mount All did this.
Click to expand...
Click to collapse
why pay when you can enter a command and its done?
Yes, mount -o bind works, but if you reboot, the mount point is no longer there.
Sure, we can add an entry to fstab, but the file is overwritten by a reboot
the autostart file is init.rc, which is overwritten by a reboot as well, so that rules out using it to auto mount this bind.
let me know if you find other information as I would very much like this to work.
FYI I started a thread about this command a few days back but never got any pertinent information:
http://forum.xda-developers.com/showthread.php?t=1287522
(this was before 3.2 when you couldn't access the SD card from usb)
Nova5 said:
why pay when you can enter a command and its done?
Click to expand...
Click to collapse
Because it is only a few bucks, and it will do it for you without having to manually do it. I know it's quite a simple task, but I say best out of sight/out of mind.
its overwrites those huh? that bites..
fermunky said:
Because it is only a few bucks, and it will do it for you without having to manually do it. I know it's quite a simple task, but I say best out of sight/out of mind.
Click to expand...
Click to collapse
Just takes a bit to track where we can stick the commands to get an auto start. I may make a simple script file to leave on the home screens. tap and done.
Okay it seems the location where the init.rc is stored is volatile. I created a test file in there and rebooted the tablet, file is gone. So its less overwriting and simply copying out of its hidden location to a usable one. sdcard in there is just a mount point for the actual hardware address location of the sdcard. So if we want to get the autostart we would have to discover where HC pulls that data from on boot.
Bind will fail if the location that actually holds the data is not present/ready. usb_storage is more affected by this as a user doesn't normally leave a flash drive in the port. Script manager can auto-execute a script on boot. Works well enough.
hmm...
It appears if you remove the usb drive after making the bind, the bind is broken. So while its workable, its not perfect. Of course since the microsd card is rarley removed, this isn't much of an issue. If we could get the script to also run on insertion of the USB drive that would then make it work better.
SCript Manager allows one to create a direct shortcut to execute a specific script. So you can swap USB drives, tap the script icon and then access the script through the bound directory.
I use the following program created by RubberBigPepper from an alternative russian site about android apps and devices.
Any interesting effect I've noticed, any time the script runs it creates a new mount entry for the bind command, even if that bind already exists. OfficePro5 shows this by listing MicroSD for each bind entry. So I had 13 entries of MicroSD as it ran that many times, due to a setting I shouldn't have checked... Run on Net Change. But it pointed out this interesting effect.
I now see the need for this as one of my apps does not natively see the ext sd card.
OK I tried the apk above and it does not seem to work. I get a folder called ex_sdcard but it is empty and does not reflect the sd card contents.
Nova, you found another way yet you could share, or do I just need to manually create symlinks after every boot?
mountmicrosd.sh
Code:
# Note : Super user required. Your Tablet MUST be rooted!
# Removing the card will disrupt the bind. And Require running script again when plugged back in.
echo Breaks any existing Bind mount to avoid creating duplicate Bind entries. a "failed" response is acceptable as is no response.
umount /mnt/sdcard/MicroSD
echo execute Micro SD mount - card must be plugged in or Invalid Argument error will occur.
mount -o bind /mnt/external_sd /mnt/sdcard/MicroSD
Place the above in a text file with the extension .sh Download from the Market a program called Script Manager. Place the sh file in your SD card root. Run script manager, select that file and check two boxes. Run on Boot, Run as Root. Also create the directory of "MicroSD" Just as its typed. Linux is very caps sensitive. now every time you boot it will automatically run the script and bind the ExSD to the MicroSD directory.
This one will do the USB drive.
mountusb.sh
Code:
# Note : Super user required. Your Tablet MUST be rooted!
# Removing the drive will disrupt the bind. And Require running script again when plugged back in.
echo Breaks any existing Bind mount to avoid creating duplicate Bind entries. a "failed" response is acceptable as is no response.
umount /mnt/sdcard/USBDrive
echo execute USB Drive mount - drive must be plugged in or Invalid Argument error will occur.
mount -o bind /mnt/usb_storage /mnt/sdcard/USBDrive
Create a widget with ScriptManager to have a touchable icon on your screen to run this one. Note it must have the folder "USBDrive" created on the sdcard.
It is unimportant if you use the same filename.sh i did. That is just so I knew at a glance what it does. # is a comment and Echo prints the text following it to the screen. I found a way around the mutiple bind entries by simply unmounting it before making the mount bind. You might see a Failed error, this is just fine. it just means there was no mount for it to undo on its first run. this will be more helpful on the USB drive script than the MicroSD card one.
Very cool, Nova5!
Thanks for taking the time to research it further.
I tested your solution and it works fine!
I updated it with a fix to prevent the multiple entries. You'll need to update your files to reflect the changes I made. a reboot will be the simplest way to ensure it starts with a clean slate. Notice I removed the comment about Running it once only, due to the umount command preceeding the mount command. This removes the bind from memory and then when its created again you don't have the problem of 13 entries of MicroSD in OfficePro like I ran into.
Alright, I think its as good it is going to get. You could put them in the same files but for simplicity and being able to swap USB drives without affecting the ExSD card two files is best.
Wait... debug time. I goofed something.
Okay fixed up and working right. Remember what I mentioned about linux and capitals? oops. Echo is not echo.
Shucks, im not rooted.

How can I create a symlink or bind for USB in the sdcard directory?

I have a rooted a500 and was able to bind the external SD card to a folder in the sdcard directory using "mount -o /mnt/external_sd /mnt/sdcard/external-sd". I was able to do the same with a fat32 USB thumb drive but it breaks as soon as I unplug the USB.
Is there any way to create a link or bind the USB on a more permanent basis? Essentially, I want to be able to quickly get to files on the drive in estrongs file manager without having to change to default directory from sdcard.
Thanks in advance for any assistance.
Sent from my A500 using Tapatalk
Of course, as soon as I posted this, inspiration struck and I simply changed the mount point.
If anyone else wants to do this, you need to edit /etc/vold.fstab to point the the new mount locations. I just changed the mount point to the new folders I created in sdcard and rebooted. Also did this for the external SD card so that I don't have to rebind it each time I reboot.
Sent from my A500 using Tapatalk

[Q] Mounting ext4 on Nexus 7 Tilapia

Hi there!
I have myself a rooted Tilapia Nexus 7 with me, and I'm trying to watch videos off of an ext4 partition from my external hdd. To mount, I use Stickmount to mount the drive, ES File Explorer to browse the drive for the video I wanna watch, and MX Player to watch the video. It works when I watch videos from its FAT32 partition, but ES File Explorer reports that my ext4 partition is empty.
Since the automated way wouldn't work, I checked out the directory in the terminal emulator and found out it was empty. When that failed, I tried out mounting manually via terminal emulator. I used
Code:
mount
to figure out where the FAT32 partition was being mounted, then I tried manually mounting with:
Code:
# mount -t ext4 /dev/block/sda2 /data/media/0/usbStorage/sda2
This worked in the terminal, and
Code:
ls -a
listed the files in the ext4 partition, but ES File Explorer still wouldn't see the files. I then tried
Code:
# chmod -R 777 /data/media/0/usbStorage/sda2
# chown media_rw /data/media/0/usbStorage/sda2
You'll notice the 'chown' doesn't use '-R', and that's because the native 'chown' on android doesn't support it (surprisingly). I used 'chown' on the folder (sda2) and one folder inside it to see if the problem was ownership. Apparently it wasn't, cause they still didn't appear.
When this didn't work, I made an account here, and posted this question, so here I am.
So, any suggestions?
UPDATE 1:
I recently installed busybox to see if that'd fix it. I used the 'normal' install setting. Long story short, it didn't, and note I have a whole bunch of what I perceive to be useless symlinks, which I suspect over wrote the original binaries. Luckily, not all the binaries were overwritten as some don't work as they should; chown, for example, doesn't work with the android groups and users. I can't uninstall it cause apparently something goes wrong.
UPDATE 2:
StickMount still won't mount my ext4 partition correctly and ES File Explorer still won't detect my files, so I use a terminal, get superuser permissions with
Code:
su
, mount the partition with the above command, and use
Code:
cp
to copy the videos I wanna watch into the 'Movies' folder. It takes some time, and I worry about wearing out the internal storage's sectors, but I suppose it's less costly on the battery life.

[Q] Problem with creating symbolic link in Android

Hello,
I need some help with creating symbolic link for my Nexus 7. I used USB OTG Helper to mount my USB Flash Drive. The app then mount my USB Flash drive at /storage/UsbOtgDrives. I can also access the Flash drive at /usbdisk or /mnt/usbdisk. I want to create a symbolic link from either of these 3 folders:
/storage/UsbOtgDrives
/usbdisk
/mnt/usbdisk
to my sdcard folder at /sdcard/usbdisk. These are the command I used for android terminal and its error message
ln -s /mnt/usbdisk /sdcard/usbdisk =======> link Failed Function not implemented
su ln -s /mnt/usbdisk /sdcard/usbdisk =======> No error shows and nothing is created
I just want some way to create a symbolic link from a folder to my USB Flash drive (and the folder MUST be within the /sdcard directory). I am seriously mad at this point cuz I have a Linux system and I use similar command and it works without any problems. Is there a limitation on Android? I am thinking of tampering with USB OTG Helper code so that will change the mount point /sdcard/usbdisk
Please let me know if anybody has found a solution to this problem. I search all over Google and it seems nobody has been able to create a concrete solution. Thanks for your help.
This answer is way too late, but I incidentlry stumbled onto this question. In case anyone else has the same question and needs the same answer. Here it is:
Your SDcard is formatted as FAT32. FAT32 doesn't support symbolic links. If you would put your SDcard in the sdcard reader of your linux system you won't be able to make symlinks either.

[Q] Symlink on /sdcard

hello there!
so im trying to symlink a subfolder to a folder on the root of my sdcard, and quite obviously i dont have a physical sd as i have a nexus 4, so the partition i created the symlink on is /data/media/0.
The story (just the reason behind it, not necessary to read):
here is why i want this symlink:
i want to use the helium backup app from the clockworkmod team, which creates a 'carbon' (old name of the app) folder on /sdcard.
i want to sync the local backup folder to my drive, for which i use the foldersync app which syncs everything found in /sdcard/drive, so i want to have the carbon folder in /sdcard/drive and create a symlink in /sdcard to it.
the reason i dont use heliums implemented drive backup option is that i have no idea where it stores all the backed up data and cant keep track of its storage usage and cant organize it the way i want to.
unfortunately helium has no option to move its local backup folder, and the dev team didnt answer my email about the backup location on drive.
whatever, back to topic...
i have created the symlink with this command:
Code:
ln -s /data/media/0/drive/carbon /data/media/0/carbon
this is working, when i use the /data/media/0 path, but when i try to look into the content of /sdcard/carbon (which obviously the app uses too), i get an error: function not implemented.
if i use this command:
Code:
ln -s /sdcard/drive/carbon /sdcard/carbon
i get the same error (function not implemented), and the symlink does not get created.
is there a way to create a working symlink for /sdcard?
i could try symlinking /sdcard to /data/media/0 (i would have to delete the existing /sdcard link, which i have no idea how is linked) with adb, but i dont know if it could work. has anyone tried that before?
ps: i have googled it and also looked for a solution on xda, havent found a solution yet...
bump
nobody? :/
sent from my Nexus 4...
Not sure why symlink isn't working. You can try binding folders which works in many cases where symlink does not.
mount -o bind src_folder dest_folder
You might need to put this in init.d script so that the bind happens on every boot as it won't stick across reboots.
Most likely the problem you are facing is because of unified filesystem that's implemented. i.e. a single physical partition acts as two virtual partitions one containing /data and other /sdcard
Sent from my Nexus 4 using xda premium
You can't symlink on sdcard because the /sdcard is formatted either fat32 or fatx (can't remember which). Neither of which supports symlinks
Sent from my Nexus 4 using xda app-developers app
Alex240188 said:
You can't symlink on sdcard because the /sdcard is formatted either fat32 or fatx (can't remember which). Neither of which supports symlinks
Sent from my Nexus 4 using xda app-developers app
Click to expand...
Click to collapse
The sdcard on nexus isn't FAT as its not mounted as USB mass storage but over MTP.
Phones which support mounting as USB drives use FAT formatted sdcard partitions so that it can be read by Windows natively.
Sent from my Nexus 4 using xda premium
That's interesting because my previous phone. HTC one x /sdcard was 100% formatted fat because it was mtp in android. But you could still Mount as ums in recovery
OK, just had a quick look. guess you are right, /sdcard/ is formatted as EXT4 so symlinks should work fine.
edit
its mounted as ext4 in recovery.
in android its mounted as fuse which is why the symlink doesnt work
confirmed.
i just booted into recovery
Code:
adb shell
~ # ln -s /sdcard/carbon/ /sdcard/drive/carbon/
ln -s /sdcard/carbon/ /sdcard/drive/carbon/
~ # cd /sdcard/carbon
cd /sdcard/carbon
/sdcard/carbon # ls -l
lrwxrwxrwx 1 root root 21 Jul 1 21:35 carbon -> /sdcard/drive/carbon/
however upon rebooting the symlink is lost as it is no longer been mounted as ext4
Sent from my Nexus 4 using xda app-developers app
atulalvenkar said:
Not sure why symlink isn't working. You can try binding folders which works in many cases where symlink does not.
mount -o bind src_folder dest_folder
Click to expand...
Click to collapse
unfortunately, this doesnt work, i get this:
/system/bin/sh: bind: -o: unknown option
i also tried mount --bind src dest, but that doesnt work either.
so there is no way to create a symlink or any other way to link a folder to another?
zakoo2 said:
unfortunately, this doesnt work, i get this:
/system/bin/sh: bind: -o: unknown option
i also tried mount --bind src dest, but that doesnt work either.
so there is no way to create a symlink or any other way to link a folder to another?
Click to expand...
Click to collapse
I tested and it was working fine. Looks like you just typed bind -o instead of mount -o bind. It should be "mount -o bind src_folder dest_folder".
There is an app which does this for you. I haven't used it personally but you can try. Check here http://forum.xda-developers.com/showthread.php?t=1410262
Sent from my Nexus 4 using xda premium
atulalvenkar said:
I tested and it was working fine. Looks like you just typed bind -o instead of mount -o bind. It should be "mount -o bind src_folder dest_folder".
There is an app which does this for you. I haven't used it personally but you can try. Check here http://forum.xda-developers.com/showthread.php?t=1410262
Sent from my Nexus 4 using xda premium
Click to expand...
Click to collapse
I am looking for a solution as well as my links on my n10 no longer exist. Nothing works including factory flashing the device back to stock.

Categories

Resources