Oct
8
2012

[HowTo] Nexus 7: Store Game Data on a Flash Drive

*** WARNING (OBLIGATORY) ***

This site is not responsible for any data lost, or damage to your device – It is your choice to proceed!

(That said no damage should be possible, but there is a risk of data loss if steps are not carried out properly)


The Nexus 7 is a fantastic tablet, but it’s not perfect. In order to keep the cost low, something had to give. In the case of the N7 you don’t get built in mobile data, and you don’t get expandable storage. This can be a problem as the N7 is a fantastic gaming device, and as Android games progress the amount of data they need is increasing.  There is a lot of work on going to fit an internal SD card reader to the device, but if/when this is done it will probably be beyond most to do on the kitchen table. There is however a software solution, well kind of. Working in conjunction with the excellent StickMount app from ChainfireXDA, it is possible to move data from your internal SD to a USB stick. For media this is incredibly easy, just copy the data to your USB stick and whenever you mount it, it’s there.  We can also move any Titanium backups we have, and all those massive game data files. For Titanium, it’s just a case of selecting a directory on your USB stick once you have it mounted from the preferences. Game data is a little more complex. Games don’t allow you to pick where they store data, some will use their own folder on the SD card, but mostly they are stored in either /sdcard/Android/data or /sdcard/Android/obb. What we need to do is create a link to the game folder from the stored data on the USB stick. If SD cards were not formatted to FAT this would be an easy task. All is not lost however, Linux has a little tool in it’s bag that can do the job.

WHAT YOU NEED
First and foremost you must be rooted.
You must be running a kernel that supports OTG (all N7 ROM’s I have tried have OTG)
You must install STICKMOUNT (free from the Play Store)
A USB stick to store your data (obviously)
Terminal Emulator (should be included in any rooted ROM, if not you can grab it from HERE)
I would also recommend installing SCRIPT MANAGER (link to ad-supported version) and the widget, not needed to get your links working, but it will make things a whole lot easier to use.


THE METHOD
To start with I recommend that you try this out a couple of times with test folders to make sure it works for you.
With all the above mentioned apps installed, plug in your USB stick and wait for Stick Mount to mount your drive. You will now notice that off your main /sdcard folder you now have a new folder called ‘usbStorage’, within this folder you will see your partition mounts from your USB drive (they show as sdaX for me).
Using any decent file manager copy your data folder to the sdaX folder you wish to use (if your USB drive is a single partition it will show as sda1).
Now go back and delete the original folder, and then create a new empty folder of the same name in the old location.

Open Terminal Emulator.
Type ‘su’ <enter>
Type ‘mount –o bind /sdcard/usbStorage/sda1/test /sdcard/test’ <enter>
(The above assumes your ‘test’ folder is located on the root of your SD card, and that you are linking it to the folder ‘test’ in the sda1 directory.)

You should now be able to see and use the files located in ‘/sdcard/usbStorage/sda1/test’ from your ‘/sdcard/test’ folder with your file manager.
If it does not work for you, check you’re spelling, everything must be exact for this to work.

Once you have checked that it is all working we need to un-mount the link. Open Terminal Emulator again and type ‘umount /sdcard/test’.
Now you have the basic principles, you can copy over any large data folders to your USB stick and only mount them when you need them, just remember that game folders are not often located in the root folder so your mount command must be adjusted to take in the full path. It’s just not very practical to keep having to use TE whenever you want a game of Asphalt 7 (just wait till you see the folder names). This is where Script Manager comes in. This will allow us to create a script and put a mount and un-mount widget on the home screen.

The first time you run Script Manager you will need to allow it root privileges. Once the app has loaded to the folder screen, select your device menu and press ‘new’. Now select ‘New directory’ and enter a script folder name followed by ‘Ok’. Press menu again, and select ‘New script’. Give your script a name you will understand, something like ‘Mount test’ (we are still working with the test folder we created). Press ‘Ok’ and select SM editor from the dialogue that comes up. Position your cursor on the second line and type ‘mount –o bind /sdcard/usbStorage/sda1/test /sdcard/test’ <enter>. Press menu and save your script and then back to go to your scripts list. Press on your script, and from the menu that shows select ‘Su’ and ‘Fav’, and then ‘Save’ and ‘Exit’. Repeat this procedure for your un-mount script. If you have installed the additional widget app for Script Manager, you can now pop a little widget on to mount, and one to un-mount.

Again, I suggest testing these with our test folder before going on to live data.

A couple of things to finish up. This is by no means perfect, it relies on you to keep track of your mounts, but I would suggest only using one at a time as if you forget to un-mount it can be a tad unpredictable to say the least. Be careful what you move, if you transfer your Nandroid backups and your device stops working you won’t be able to get at them from recovery. Don’t move anything that you use day-in, day-out as it will quickly become a PITA. There are however real benefits to be had, whilst Real Racing 2 uses about 1.5GB on its own, other games are now even in excess of 3GB!

It’s also worth thinking that, in theory, you could use this method to have the same game data across multiple devices.

Leave a comment