mount second sd card as a directory so car detects music over USB - Galaxy S I9000 Q&A, Help & Troubleshooting

Hi,
I use my telephone with a second sd card in the car through usb.
Appearently the car only finds and indexes the first sd card.
Is there a way to mount the sceond card as a directory on the first card?
Kind Regards
Guy F
I found a file vold.fstab in my /etc/system but there's no info regarding the second sd card?
Can I safely edit and how?
# Vold 2.0 Generic fstab
## - San Mehat ([email protected])
##
#######################
## Regular device mount
##
## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...>
## label - Label for the volume
## mount_point - Where the volume will be mounted
## part - Partition # (1 based), or 'auto' for first usable partition.
## <sysfs_path> - List of sysfs paths to source devices
######################
#FIXME: Swap again?
# internal sdcard
dev_mount emmc /storage/sdcard1 auto /devices/platform/s3c-sdhci.2/mmc_host/mmc2
# external sdcard
dev_mount sdcard /storage/sdcard0 1 /devices/platform/s3c-sdhci.0/mmc_host/mmc0

I have looked here
http://forum.xda-developers.com/showthread.php?t=1922272
http://forum.xda-developers.com/showthread.php?t=1724287
http://forum.xda-developers.com/showthread.php?t=1785245
but I can't seem to get it to work
Anybody?

Forssound said:
I have looked here
http://forum.xda-developers.com/showthread.php?t=1922272
http://forum.xda-developers.com/showthread.php?t=1724287
http://forum.xda-developers.com/showthread.php?t=1785245
but I can't seem to get it to work
Anybody?
Click to expand...
Click to collapse
It seems I found a solution here http://forum.xda-developers.com/showthread.php?t=1511619
In brief
install a app like SSHDroid
on your desktop connect with putty to your phone so hook up your phone with the usb cable
login is or was "root" and password is "admin"
ls /dev/block/vold will give you some figures 179.0 179.2 179.2 179.8 179.9
ls /dev/block/platform will give some folders s3c-sdchi.0 s3c-sdchi.2 s5pc110-onenand
One can chose between several ways how the folders appear on a windows explorer folder
like a USB stick or a mediaplayer
setprop persist.sys.usb.config mtp,adb results in the little walkman icon on your explorer
setprop persist.sys.usb.config mass_storage,adb results in the appearing of a usb stick
mount is also a commando when given alone which will show you everything that is mounted
In the putty window i did a feel free to experiment
setprop persist.sys.usb.config mass_storage,adb
echo /dev/block/vold/179:9 > /sys/devices/platform/s3c-usbgadget/gadget/lun1/file"
This would result in the appearing of a USB stick with name sdcard on your file explorer in windows.
To make this flash persistent
Look if your rom has support for userinit.d or bootcompletehook.sh somewhere in /data
cm 10.1 has support for userinit.d
in /system/etc/init.d I found 2 files 00banner and 90userinit
vi /system/etc/init.d/90userinit is this
#!/system/bin/sh
# call userinit.sh and/or userinit.d/* scripts if present in /data/local
if [ -e /data/local/userinit.sh ];
then
log -p i -t userinit "Executing /data/local/userinit.sh";
logwrapper /system/bin/sh /data/local/userinit.sh;
setprop cm.userinit.active 1;
fi;
if [ -d /data/local/userinit.d ];
then
logwrapper busybox run-parts /data/local/userinit.d;
setprop cm.userinit.active 1;
fi;
now the folder wasn't there so
mkdir /data/local/userinit.d
in this folder make a file.The name isn't important
cd /data/local/userinit.d
vi mountsdcard
setprop persist.sys.usb.config mass_storage,adb
echo /dev/block/vold/179:9 > /sys/devices/platform/s3c-usbgadget/gadget/lun1/file
make sure you give rights to this file and the folder one can do that with es file explorer or probable
chmod 751 mountsdcard
I think that's it
This will mount your second sdcard (if you have one ) on your windows like a usb stick. It will do this even if your phone isn't completely started up.
You will not have to do a "mount usb" on your phone. If you do this anyway your first card is also mounted.
This is a neat trick to make your CAR find your music on your phone. If your car has a usb port and the functionality to play music from usb sticks.
Kind Regards
Guy

I tried doing the same by bind-mounting the external_sd on a folder on the internal_sd:
Code:
mount -o bind /storage/sdcard1 /storage/sdcard0/external_sd/
In the terminal it worked like a charm, but i couldn't get it to work at boot. Have you any other ideas?

Wouldn't it be easier to just mount the ext SD to a folder on the internal SD? This seems like 100 times the work really needed.
I can't recall atm how mounting of SD cards works, but if I had this problem I'd probably just put the songs in a .img file and mount that with
mount -o loop -t auto /storage/sdcard1/music.img /storage/sdcard2/music/
Sent from my GT-I9000 using xda premium

Yeah thats kinda what i thought of. But my init script is not getting executed or at least there is no effect of it.

I assume you've tested it with terminal output, what doesn't work about it? :/
Sent from my GT-I9000 using xda premium

I don't know what you mean, to be honest. I know that init.d should write the logs somewhere but couldn't find out where they are written to.
Edit: when i try to execute the command above it works, but it doesn't work with init.d

wget21 said:
I tried doing the same by bind-mounting the external_sd on a folder on the internal_sd:
Code:
mount -o bind /storage/sdcard1 /storage/sdcard0/external_sd/
In the terminal it worked like a charm, but i couldn't get it to work at boot. Have you any other ideas?
Click to expand...
Click to collapse
Read my large post..... It works on reboot and flash... I have tested it in my car and on my PC..

wget21 said:
I don't know what you mean, to be honest. I know that init.d should write the logs somewhere but couldn't find out where they are written to.
Edit: when i try to execute the command above it works, but it doesn't work with init.d
Click to expand...
Click to collapse
Well, for what it's worth you can use CM File Manager to add a shortcut on your home screen if you're on a ROM with Trebuchet Launcher, do that with the executable file and you can at least launch it easily when needed...
With pretty much any other launcher custom shortcuts are supported as is, Trebuchet for some reason lacks it.
(I loathe init.d)
Sent from my GT-I9000 using xda premium

I have now made a script in rom toolbox which does the job, but i'm not very happy with this. I'd prefer doing this simple bind-mount with init.d
@Forssound: Your solution seems to me a bit complicated, just for this simple task.

Related

[Q] remount external_sd to another path

heya guys.
is it possible to unload/unmount the external sd (mounted in /mnt/sdcard/external_sd) via command like unmounting it via settings?
i knew that the card is mounted as mmcblk1(p1).
how about to mount it to another place via command?
is it even possible?
trying via terminal emulator says always that the device is still busy and cannot unmounted. even with -f
cheers ~
current state is as following:
/etc/init.d/S01init
Code:
#!/system/bin/sh
# remount
busybox mount -o rw,remount /
#create paths
mkdir /sd
mkdir /mnt/sdcard_ext
chmod 0775 /mnt/sdcard_ext
#duplicate, delete and linking original files
cp /init.rc /init.rc_original
cp /etc/voId.fstab /etc/voId.fstab_original
rm /init.rc
rm /etc/voId.fstab
ln -s /etc/init.d/scripts/init.rc /init.rc
ln -s /etc/init.d/scripts/voId.fstab /etc/voId.fstab
#set init.rc vars
#export EXTERNAL_STORAGE2 /mnt/sdcard_ext
#symlink /mnt/sdcard /sd/sdcard
#symlink /mnt/sdcard_ext /sd/sdcard_ext
#linking new mounting paths
ln -s /mnt/sdcard /sd/sdcard
ln -s /mnt/sdcard_ext /sd/sdcard_ext
busybox mount -o ro,remount /
### end
custom init.rc
Code:
on early-init
start ueventd
on init
sysclktz 0
loglevel 3
# setup the global environment
export PATH /sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
export LD_LIBRARY_PATH /vendor/lib:/system/lib
export ANDROID_BOOTLOGO 1
export ANDROID_ROOT /system
export ANDROID_ASSETS /system/app
export ANDROID_DATA /data
export EXTERNAL_STORAGE /mnt/sdcard
export EXTERNAL_STORAGE2 /mnt/sdcard_ext
export USBHOST_STORAGE /mnt/sdcard/usbStorage
export ASEC_MOUNTPOINT /mnt/asec
export LOOP_MOUNTPOINT /mnt/obb
export BOOTCLASSPATH /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar
# Backward compatibility
symlink /system/etc /etc
symlink /sys/kernel/debug /d
# Right now vendor lives on the same filesystem as system,
# but someday that may change.
symlink /system/vendor /vendor
# create mountpoints
mkdir /mnt 0775 root system
mkdir /mnt/sdcard 0000 system system
mkdir /mnt/sdcard_ext 0000 system system
# Create cgroup mount point for cpu accounting
mkdir /acct
mount cgroup none /acct cpuacct
mkdir /acct/uid
#add booting sound property
setprop audioflinger.bootsnd 1
# Backwards Compat - XXX: Going away in G*
symlink /mnt/sdcard /sd/sdcard
mkdir /system
mkdir /dbdata 0771 system system
mkdir /data 0771 system system
mkdir /cache 0770 system cache
mkdir /config 0500 root root
mkdir /efs 0771 system system
chown system system /efs
chmod 0771 /efs
.
.
.
custom voId.fstab
Code:
## Vold 2.0 Generic fstab
## - San Mehat ([email protected])
##
#######################
## Regular device mount
##
## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...>
## label - Label for the volume
## mount_point - Where the volume will be mounted
## part - Partition # (1 based), or 'auto' for first usable partition.
## <sysfs_path> - List of sysfs paths to source devices
######################
# sdcard mount for the P1
# internal sdcard
{
ums_path = /sys/devices/platform/usb_mass_storage/lun0/file
discard = disable
asec = disable
}
dev_mount sdcard /mnt/sdcard 1 /devices/platform/s3c-sdhci.0/mmc_host/mmc0
# externel sdcard
{
ums_path = /sys/devices/platform/usb_mass_storage/lun1/file
asec = enable
}
dev_mount sdcard1 /mnt/sdcard_ext auto /devices/platform/s3c-sdhci.2/mmc_host/mmc2
#end line ## keep this line
after rebooting:
- the custom voId.fstab is completely ignored...
- init.rc is changed to custom init.rc
- folders and linkings are correct
but it also links to /sdcard and /sdcard/external_sd
i dont want my external sd-card on /sdcard/external_sd and the internal on /sdcard
is there no way to fix that?
Look at this thread. May be it will be helpful for you.
swapping won't help.
problem is to fix the /proc/mounts - paths for the external card.
it wont let me modify it
1. I think you have to put name vold.fstab (little L, not big I)
2. At my phone /sdcard is just symlink to /mnt/sdcard . May be you just should remove this symlink?
I can be wrong because I don't know about changes in the Darky's Extreme Edition v10.1 ROM. but my words are true for stock rom for i9003
falex007 said:
1. I think you have to put name vold.fstab (little L, not big I)
Click to expand...
Click to collapse
that would explain whats going wrong by replacing the old with the new file.
falex007 said:
2. At my phone /sdcard is just symlink to /mnt/sdcard . May be you just should remove this symlink?
Click to expand...
Click to collapse
/sdcard isnt the problem.
its the external sd-card, which i want to mount on an other path (e.g. /mnt/sdcard_ext) and symlink it to /sd/sdcard_ext
symlinking isnt the problem. seperating both cards is all i want.
my desired goal is as following:
internal sd: /mnt/sdcard & symlink to /sd/sdcard
external sd: /mnt/sdcard_ext & symlink /sd/sdcard_ext
I understood what you want by reading /etc/init.d/S01init And I think that if you replace old vold.fstab with new one, the problem with mounting external card will be solved too
if i replace the vold.fstab manually and reboot the phone, external sd wont be recognized. it won't load any or mount it on the right place. both folders, original and desired, stay still empty. if I try to mount it manually, it says that the desired path is not recognized by /proc/mounts. changing the mounts file wont change the mount-paths
UPDATE:
ok, i'm now on this:
Code:
#!/system/bin/sh
FSTAB=/system/etc/vold.fstab
FSTAB_O=/system/etc/vold.fstab_original
# remount rw
busybox mount -o rw,remount /
busybox mount -o rw,remount /system
#create paths
mkdir /sd
mkdir /mnt/sdcard_ext
#duplicate, delete and replace original files
if [ ! -e $FSTAB_O ]; then
cp $FSTAB $FSTAB_O
reboot
fi
rm /init.rc
rm $FSTAB
cp /etc/init.d/scripts/init.rc /init.rc
cp /etc/init.d/scripts/vold.fstab $FSTAB
#set init.rc vars
#export EXTERNAL_STORAGE2 /mnt/sdcard_ext
#symlink /mnt/sdcard /sd/sdcard
#symlink /mnt/sdcard_ext /sd/sdcard_ext
#linking new mounting paths
ln -s /mnt/sdcard /sd/sdcard
ln -s /mnt/sdcard_ext /sd/sdcard_ext
# remount ro
busybox mount -o ro,remount /
busybox mount -o ro,remount /system
### end
this script ended in fully ignoring the new vold.fstab after reboot.
now the external sd is mounted at the old mount-point /sdcard/external_sd...
any suggestions?
btw: does anyone knows where the real /proc/mounts is?
it links to self/mounts... what does that mean?
UPDATE:
after replacing vold.fstab i cant install apps at all.
installing ends in forced hotboot.

CM7.1RC Switch SD Mountpoints

In order to fix this, Activate USB Debugging Under application Settings.
Windows Fix:
Open a CMD Command Shell Window (Start + Run, or Windows Key + R)
If using the adb included with super one click, replace adb below with adb-windows (and navigate to the folder where it is contained first)
PRESS ENTER AFTER EACH LINE
Code:
adb shell
then
Code:
mount -o remount,rw -t ext3 /dev/block/mmcblk0p25 /system (press enter)
This makes the system Writable
Now exit the shell with:
Code:
exit
Next - lets create a backup of our vold.fstab, incase we wish to switch to the CyanogenMod Method.
Code:
adb pull /system/etc/vold.fstab
After the file has been downloaded, copy it to another location, for safe keeping.
Now lets open the downloaded file in notepad++ and replace the contents with what are below:
Code:
#######################
## Regular device mount
##
## Format: dev_mount
## label - Label for the volume
## mount_point - Where the volume will be mounted
## part - Partition # (1 based), or 'auto' for first usable partition.
## - List of sysfs paths to source devices
######################
## dev_mount sdcard /mnt/sdcard auto /devices/platform/tegra-sdhci.2/mmc_host/mmc1
## dev_mount emmc /mnt/emmc 9 /devices/platform/tegra-sdhci.3/mmc_host/mmc2
# int sd as sdcard
dev_mount sdcard /mnt/sdcard 9 /devices/platform/tegra-sdhci.3/mmc_host/mmc2
# ext sd as emmc
dev_mount emmc /mnt/emmc auto /devices/platform/tegra-sdhci.2/mmc_host/mmc1
# usbdisk as usbdisk
dev_mount usbdisk /mnt/usbdisk auto /devices/platform/tegra-ehci
After editting, save the file, and close it. We will now send this back to the device.
Return to our command shell window, and run the following to remove the current file:
Code:
adb shell
cd /system/etc/
rm vold.fstab
exit
Followed by the command to push our editted file back to the device:
Code:
adb push vold.fstab /system/etc/vold.fstab
After these steps, reboot your phone.
As if by magic, you should now have the mount points switched round, and will be able to use the Camera and Galleries again without having to have an SD card in the phone
This is a persistent change to the file system. Although it has not caused problems on my handset, I cannot be held responsible for anything that may occur on your handset. These changes survive a reboot, and do not require you to run any script on boot. We created the backup above in case you wish to switch them back again (more storage space for videos, faster card etc)
And then add /etc/vold.fstab to custom_backup_list.txt so the change sticks when you update CM.
I have experienced problems when pushing system files with system running. Don't know for what reason. I would recommend pushing in clockworkmod
If you do this in clockworkmod you don't need the first 3 steps. Just mount /system and it's already rw.
I followed every step above and now I can't mount my SD card...
how can I fix this?
Try again. You probably did something wrong.

[Q] Updating Boot For SD based ICS

I am using "generic-sdcard-v1.3-ICS-large-Rev3" from leapinlar/verygreen and a knightly from @CM_Encore (TeamWin)
http://forum.xda-developers.com/showthread.php?t=1000957
Pulling the micro SD out of the nook, into the SD Adapter and into the PC isn't complicated, but I would rather handle this via a PC batch and adb.
By default partition 1 of the SDCard is not mounted on boot. (so far as I can tell)
My Linux days are a bit behind me, but I found /etc/vold.fstab pointing to dev_mount sdcard /mnt/sdcard 4 /devices/platform/mmci-omap-hs.0/mmc_host/mmc1.
So I assume I want to mount somthing like:
dev_mount boot /mnt/boot 1 /devices/platform/mmci-omap-hs.0/mmc_host/mmc1
Then I can ADB PUSH updated and ADB reboot recovery.
I don't see a path to dev_mount to reproduce this approach.
I am also not sure if I need to create a /mnt/boot path first.
jmiller76 said:
I am using "generic-sdcard-v1.3-ICS-large-Rev3" from leapinlar/verygreen and a knightly from @CM_Encore (TeamWin)
http://forum.xda-developers.com/showthread.php?t=1000957
Pulling the micro SD out of the nook, into the SD Adapter and into the PC isn't complicated, but I would rather handle this via a PC batch and adb.
By default partition 1 of the SDCard is not mounted on boot. (so far as I can tell)
My Linux days are a bit behind me, but I found /etc/vold.fstab pointing to dev_mount sdcard /mnt/sdcard 4 /devices/platform/mmci-omap-hs.0/mmc_host/mmc1.
So I assume I want to mount somthing like:
dev_mount boot /mnt/boot 1 /devices/platform/mmci-omap-hs.0/mmc_host/mmc1
Then I can ADB PUSH updated and ADB reboot recovery.
I don't see a path to dev_mount to reproduce this approach.
I am also not sure if I need to create a /mnt/boot path first.
Click to expand...
Click to collapse
Just create a directory on /sdcard called boot...
adb shell mkdir /sdcard/boot
adb shell mount /dev/block/mmcblk1p1 /sdcard/boot
adb push XXXXX /sdcard/boot
There are two easy ways to accomplish what you need if you don't want to mess with adb. But Dizzy's instructions work if you are comfortable with adb.
One is to us a third party program named NookColorUMS and it will mount the boot partition on the PC using your USB cable.
The second way is to install a script file that I created to make the boot partition mount directly on the Nook.
You can learn about both by reading my tips thread linked in my signature.
Is this right to set the mount folder on the sdcard (fat32)?
I can make the folder, but attempting:
255|[email protected]:/ # mount /dev/block/mmcblk1p1 /sdcard/boot
mount /dev/block/mmcblk1p1 /sdcard/boot
Usage: mount [-r] [-w] [-o options] [-t type] device directory​The direct "Usage" text isn't explaining the syntax problem.
Believe it or not the whole /dev/block/ wasn't there when I used Linux in school. everything was just under /dev/ an ls -al took a while. Impossible to find things.
NookColorUMS-CM9.apk seems to do the trick if I switch out of MTP to Mass Storage.
Is there a way to make this work for MTP?
Id also still like to understand why the mount commands aren't working.
Thanks,
Josh
jmiller76 said:
Is this right to set the mount folder on the sdcard (fat32)?
I can make the folder, but attempting:
255|[email protected]:/ # mount /dev/block/mmcblk1p1 /sdcard/boot
mount /dev/block/mmcblk1p1 /sdcard/boot
Usage: mount [-r] [-w] [-o options] [-t type] device directory​The direct "Usage" text isn't explaining the syntax problem.
Believe it or not the whole /dev/block/ wasn't there when I used Linux in school. everything was just under /dev/ an ls -al took a while. Impossible to find things.
NookColorUMS-CM9.apk seems to do the trick if I switch out of MTP to Mass Storage.
Is there a way to make this work for MTP?
Id also still like to understand why the mount commands aren't working.
Thanks,
Josh
Click to expand...
Click to collapse
No the app only works for UMS (mass storage).
The mount command was not working for you because in CM9, you must use the -t option. For boot it is vfat. So the command would be:
mount -t vfat /dev/block/mmcblk1p1 /sdcard/boot
Specifying the type makes sense, wish mount had told me that, or that a type was needed.
Do you know what the behavior would be to mount the SD via mass storage with that mount point?
I scanned your(Leapinlar) user tips again and saw that at some point this behavior was working out of the box with /data/sdboot linked to /sdboot. It said it would be discussed again, but I am not sure the current draft does that.[it is mentioned below, but not explained]
In MTP mode the /sdcard/boot is not visible. Is there a way to register this partition as visible via MTP?
Are there any gotchas I should keep an eye out for?
Or any issues adding this to /data/local/userinit.d?
Thanks.
jmiller76 said:
Specifying the type makes sense, wish mount had told me that, or that a type was needed.
Do you know what the behavior would be to mount the SD via mass storage with that mount point?
I scanned your(Leapinlar) user tips again and saw that at some point this behavior was working out of the box with /data/sdboot linked to /sdboot. It said it would be discussed again, but I am not sure the current draft does that.[it is mentioned below, but not explained]
In MTP mode the /sdcard/boot is not visible. Is there a way to register this partition as visible via MTP?
Are there any gotchas I should keep an eye out for?
Or any issues adding this to /data/local/userinit.d?
Thanks.
Click to expand...
Click to collapse
The sdboot folder only shows inside CM. The reason I set up that folder was so GooManager could use it, not to make it available to the PC. And it works well with no issues adding that script.
Mtp only shows sdcard and emmc folders and I don't know of a way to change that. It probably does not show the sdcard/boot because it is mounted there rather than an actual part of the sdcard.
Yes, I do know how to mount the boot partition with a userint script so that it mounts using UMS, but I now use the NookColorUMS app since it is easier.

[INIT.D][10-05-2012]Super APP2SD Script [MAJOR UPDATE][BETA]

UPDATES, WARNINGS, AND INSTALLATION STEPS ARE AVAILABLE IN THE 2ND POST
WHAT DOES THIS SCRIPT DO?
* It is the only method, that I am aware of to have apps trully run, and be installed directly to the external storage without completely switching the internal storage with the external storage.
This bings different benefits to different people:
1 - If you have a device that comes from factory with only a small amount of storage available, you can now install as many apps, and apps as big as the partition you setup to use with this script. For example, if you have a phone with only 512 MB of app storage, you can now install games that take over 1GB of app storage so long as your external partition has the space available.
2 - If you bought a 16GB device and wish you had bought a 32GB device, this is great for you as well (I'm one of these). With this script, your apps will not take up any space in your internal storage, which means that your 16GB (or whatever is left of it after factory partitioning, 11.66 GB in my case) is now available for pictures, videos, downloads, backups, or whatever else you might want to put there or have easy access to when you connect your device to your computer.
3 - If you have a lot of Android games, this is great for you too, specially if you're playing games that take a lot of space. Just get a large MicroSD (I have a 64GB partitioned to 32/32) and put as much space as you need in the second partition, and now you can have all your games intalled at the same time. No need to keep uninstalling games so that you can install other ones.
* Once and Done, across the board setup. That's right, launchers, keyboards and widgets will run from the external storage natively, something never done before in Android as far as I know.
This means that once you have the script up and running, you're good to go until the next time you reflash your /system partition. No need to choose what apps to move. No symlinks or anything. Your apps now belong in the external storage, plain and simple.
* No need to backup all your stuff before running the script (and eventually no need to back up your stuff when you want to disable it either).
That's right, the script does the hard work for you. All your stuff gets safely moved to the external storage, with all ownerships and permissions intact. It all happens so smoothly that some people have a hard time telling that the script is already at work. Nothing gets deleted from the internal storage until you're certain that everything is working as expected either. So even if something goes wrong, as long as you have ADB, all your stuff can go back to normal without a problem
(Even though you don't have to backup and restore in order to get the script going, it's always greatly recommended that you keep a backup of your apps).
* Simple intallation:
To get the script going all you have to do is download it, extract it, and run 3 commands in the terminal. It will then ask you a couple of questions, and then you'll be all set. The one downfall is that because the script requires user input (no, the required information cannot be picked from a list), the script cannot be run from a recovery zip. However, I'll emphasize once again that it only takes 3 commands to get the script going.
Also, the script comes with an options file that allows you to setup device specific variables, making the script malleable to work on just about any Android device. Just open the USER_OPTIONS file before runing the install script, and as long as you have the variables there set correctly, the script should be compatible with your device.
* You can still use the external partition for other stuff if you want to. Just remember that it's mounted to /mnt/sd-ext (or /storage/sd-ext in JB). So if you still have a ton of space left in the partition and need the space, you can still use it. Just ensure not to touch the folders Android, app and data.
* Now this is a bit more technically, but in theory, you could a third partition for this script instead of the second partition, and then still be able to use app2sd solutions, though personally I don't see what advantage there would be to doing this since apps would still be in the external storage no matter what.
WHAT DOES THIS SCRIPT NOT DO?
*** IT CANNOT BE CONVERTED INTO A RECOVERY ZIP DUE TO USER INPUT REQUIREMENT ***
*** YOU CANNOT PICK AND CHOOSE WHAT APPS TO MOVE, THAT'S PLAIN AND SIMPLE NOT THE PURPOSE OF THIS SCRIPT ***
SCREENSHOTS
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Above you can see my storage screen. If you add the amount of used space and the amount of available space, it's ~18 GB, well over the available 11.66GB in the internal storage. Also note that when the script is enabled, the bar displaying storage usage is unreliable. All other information is reliable, including, and most importantly, the amount of available free space.
Above you can see the output of some commands in the terminal. The most important part of the output for mount above are
Code:
/dev/block/mmcblk0p12 on /mnt/temp/data type ext4 (rw,relatime,barrier=1,journal_async_commit,data=ordered,noauto_da_alloc,discard)
/dev/block/mmcblk1p2 on /mnt/sd-ext/data type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/media/Android type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/app type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/data type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
As you can see, mmcblk1p2, the external storage, is mounted to /data/app, /data/data and /data/media/Android, which means that as far as Android is concerned, those folders are in the external storage. Also note that all these mounts took place before /sdcard itself was mounted, meaning that the script is ensuring that these mounts take place soon enough in the boot process to avoid problems related to mounting the app storage locations after Android has loaded the available apps.
Finally, the fact that mmcblk0p12 is mounted to /mnt/temp/data is important because of the next two commands
The output of du -sh shows the amount of storage used by a folder, and as such because the internal storage is mounted to /mnt/temp/data;
/mnt/temp/data/app = internal /data/app = 8KB
/mnt/temp/data/data = internal /data/data = 72KB
/mnt/temp/data/media/Android = internal /data/media/Android = 4KB
whereas
/data/app = 1GB
/data/data = 624.3 MB
/data/media/Android = 5.6 GB
For a grand total of 7.22 GB of used app storage in the external storage as opposed to 84 KB in the internal storage.
CREDITS
*smaw51 - Testing
*ArangeLTX - Testing and Debugging
*Laggan - Testing
*aadiflesher - Testing
*Others who tested the script but weren't in direct contact with me.
*People who said it wasn't possible to run widgets, launchers and keyboards from External Storage (They provided the challenge I needed to make this work)
If anybody needs help or if anything doesn't work, I'll help through irc (much quicker than posting here) on freenode - #and-host
UPDATES:
09-26-2012: Major Update, Overhauled most of previous code.
09-27-2012: Found badass typo in one of the files, fixed and uploaded correction.
09-27-2012: Added install Script.
10-02-2012: Corrected install script so that things now run properly. Don't forget to double check USER_OPTIONS and set ENABLED=true
10-02-2012: Added MMCBLKXPX variable to user options so now devices that mount SD-EXT to different block can use script easily.
10-03-2012: More fixes to the install script, also added check for storage location as well as user input. Started working on compatibility for devices where /sdcard/Android is in different partition from /data
10-03-2012: Updated this post with more organized information.
10-04-2012: Modified script so that debugging output works properly in JB
10-05-2012: Finished working on compatibility for devices with /sdcard and /data in different partitions (PENDING TESTING)
10-05-2012: Added automatic detection for such devices ^ (New variable is automatically created in USER_OPTIONS, called fukedupFS)
10-05-2012: Added extra security for $deletepostmove (Will not take effect until stage 3 is detected)
10-05-2012: Added switch on install script to do a clean install, (using sh ./install-a2sd -clean) which will erase all current options/vars and reset stage to 0.
WARNINGS:
1 - PROCEED WITH THE FOLLOWING STEPS AT YOUR OWN RISK. IF ANYTHING BREAKS I'LL GLADLY TRY TO HELP (IF I CAN), BUT YOU DO WHAT YOU DO AT YOUR OWN RESPONSIBILITY.
2 - THE INSTALLATION SCRIPT REQUIRES USER INPUT, WHICH MEANS THAT IT CANNOT BE MADE INTO A RECOVERY ZIP. DO NOT BOTHER TO ASK FOR ONE. IF YOU CAN'T LEARN HOW TO USE THE TERMINAL, THEN JUST STICK TO OTHER SUCKY APP2SD SOLUTIONS.
3 - THIS SCRIPT IMPLEMENTS INIT.D BY DEFAULT, IF YOU ALREADY HAVE INIT.D FUNCTIONALITY MAKE SURE TO CHANGE:
Code:
/system/bin/logwrapper busybox run-parts /system/etc/init.d
TO
Code:
# /system/bin/logwrapper busybox run-parts /system/etc/init.d
IN THE B]sysinit[/B] FILE.
4 - THIS SCRIPT IMPLEMENTS INIT.A, WHICH IS ESSENTIALLY LIKE INIT.D, BUT HAPPENS EXTREMELY EARLY AT BOOT TIME, IT IS SUGGESTED THAT REGULAR USERS DO NOT PUT ANY SCRIPTS IN INIT.A UNLESS THEY KNOW WHAT THEY'RE DOING, JUST USE INIT.D FOR OTHER SCRIPTS.
5 - UPDATE YOUR BUSYBOX TO THE LATEST VERSION (1.20.2 AT THE WRITING OF THIS). SOME EARLIER VERSIONS OF BUSYBOX ARE KNOWN TO NOT HAVE SOME OF THE REQUIRED SWITCHES FOR THE COMMANDS USED IN THE SCRIPT.
6 - AT THIS POINT THE SCRIPT REQUIRES THAT YOU HAVE A SECOND PARTITION IN YOUR MICROSD FORMATTED TO EXT4, ANYTHING ELSE WILL NOT WORK. THIS MAY CHANGE IN THE FUTURE, BUT AT THIS POINT IT'S A REQUIREMENT.
7 - FULLY READ THE INSTALLATION INSTRUCTIONS, MORE THAN ONCE IF POSSIBLE, BEFORE RUNNING THE SCRIPT. FAILING TO COMPREHEND WHAT'S GOING ON CAN POSSIBLY LEAVE YOUR DEVICE SEMI-BRICKED/CAUSE MAJOR HAVOC AND FORCE-CLOSES AND YOU'LL HAVE TO RESTORE A BACKUP. MORE THAN ANYTHING MAKE SURE TO BACKUP YOUR APPS.
INSTALLATION:
1 - Download the attached file on your device or PC.
2 - Extract the files and move it to an easy to access location in your device, such as /sdcard. Open USER_OPTIONS and ensure that all variables correctly apply to your device, LEAVE deletepostmove='false' until later. Set ENABLED='true' once you're reviewed everything.
3 - Open a terminal app (Rom Toolbox and such probably won't work because the script requires user input)
4 - Assuming that you moved all 6 files to /sdcard, execute the following commands in the terminal:
Code:
su
cd /sdcard
sh ./install-a2sd
You can also perform a clean install by using the command:
Code:
sh ./install-a2sd -clean
5 - The script will ask a couple of questions, answer them (ask someone for help if you're not sure).
6 - If all went well (The script will tell you that folders were created, files were copied and permissions were set) you'll be told that upon pressing enter your device will be rebooted. Press ENTER when ready or reboot manually if it fails to reboot on its own.
7 - STAGE 1 - NOTHING WILL HAVE NOTICIABLY CHANGED UPON THE FIRST REBOOT. This is normal. The first reboot will only garther many variables needed for the script to run properly, it will also give the opportunity to review the variables and ensure that everything is ok, so that you can disable the script in case the gathered variables are not correct, so that things don't get broken unecessarily. Please take a look at:
Code:
/sdcard/Tweaked.Scripts/A2SD/options/vars
If all looks good in there (even if you don't understand what the variables are for, ensure that the paths make sense, don't worry if you don't have /mnt/sd-ext and /mnt/temp, or /storage/sd-ext and /storage/temp as these will be created).
Reboot again after reviewing the variables.
8 - STAGE 2 - ONCE AGAIN, WHEN YOU REBOOT, NOTHING WILL APPEAR TO HAVE HAPPENED. In fact, this is not the case this time. If all variables were correct in STAGE 1, every app along with their data and files will have started to be copied over to the external storage as soon as the device finished booting. You should be able to see the process for this by opening the terminal and running the command:
Code:
logcat | busybox grep "01a2sd"
You can also run the following command in the terminal to ensure that there are extra mounts that did not exist prior:
Code:
mount
***THIS IS THE MOST IMPORTANT STEP IN THE PROCESS. MAKE SURE THAT YOU DO NOT REBOOT YOUR DEVICE UNTILL THE FOLLOWING FILE IS CREATED:
Code:
/sdcard/Tweaked.Scripts/A2SD/DEVICE_IS_READY
Failing to do so is the single worst mistake that you can do. Rebooting the device before the copying is done might cause all your apps to look like they're not installed, as well as major FCs, to the point where stuff is unusable and you have to restore a backup.
Just be patient during this step, specially if you already have a lot of apps installed, even more so if you have games that use a large amount of space.
9 - STAGE 3 - After rebooting from STAGE 2, the device will mount the external storage in every location where apps would reside in the internal storage. This is why it's extremely important that STAGE 2 is completed properly, because unless everything has been moved properly, files that were not copied will seem like they don't exist, possibly causing FCs and major havoc.
If everything went ok, it will actually look like nothing happened, but in fact, everything should be running from the external storage. You can confirm this by running the following command in the terminal:
Code:
mount
You should see three mounts that weren't there before that look like
Code:
/dev/block/mmcblk1p2 on /data/media/Android type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/app type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/data type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
At this point, it should be safe to open USER_OPTIONS in /sdcard/Tweaked.Scripts/A2SD/options and change deletepostmove='true'. Just remember that with this variable set on, all your apps will be wiped from external storage. This means that if you reboot without your MicroSD or if you lose the stuff in the MicroSD your alls will be gone. Becase of this, ensure that you have your apps backed up somewhere.
TweakerL said:
To install, download attached file (then rename it to 01a2sd) or copy code and save it to (01a2sd).
Copy the file to /system/etc/init.d (Can be done with any file manager that has root access)
Change permission to 755 (Can be done with most file managers with root access)
Change Options in script to your liking.
Enjoy the extra storage after reboot.
Code:
#! /system/bin/sh
########################################################################################################
########################################################################################################
## ##
## Super APP2SD by TweakerL ##
## Visit us at http://and-host.com ##
## Chat with us on freenot at #and-host ##
## ##
########################################################################################################
########################################################################################################
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
########################################################################################################
## Options #############################################################################################
## ##
## Feel free to change these: ##
## ##
## moveAndroid: Moves /sdcard/Android to external storage. ##
## moveApps: Not yet implemented ##
## moveData: Not yet implemented ##
## ##
## deletepostmove: If 'true ' Deletes files from internal storage after they have been moved. ##
## ##
## pruneoldlogs: If 'true' Deletes logs older than X hours set in prunehoursold. ##
## prunehoursold: If 'X' greater than 0 logs older than X hours will be deleted ##
## If 'X' equal 0 all logs will be deleted ##
## ##
## debugging: If 'true' files will be created in /sdcard for debugging purposes ##
## ##
moveAndroid='true' ##
##
deletepostmove='true' ##
##
pruneoldlogs='true' ##
prunehoursold='1' ##
##
debugging='false' ##
########################################################################################################
########################################################################################################
## Constants ###########################################################################################
## ##
## Don't touch these unless you're told to by someone who knows what they're doing: ##
## ##
append_android='/Android' ##
append_data='/data' ##
append_obb='/obb' ##
append_ext4='/ext4' ##
append_tweaked='/Tweaked.Scripts' ##
append_movethis='/movethis.txt' ##
append_temp='/temp' ##
append_media='/media' ##
append_A='A' ##
append_logs='/logs' ##
##
data='/data' ##
########################################################################################################
########################################################################################################
if [ -f /sbin/busybox -o -f /system/sbin/busybox -o -f /system/xbin/busybox -o -f /system/bin/busybox ]
then
has_busybox='true'
fi
if busybox blkid | busybox egrep -i "mmcblk1p2" > /dev/null
then
has_mmcblk1p2='true'
fi
if busybox blkid | busybox egrep -i "mmcblk1p2" | busybox awk '{print $4}' | busybox cut -f2 -d'"' > /dev/null
then
is_ext4='true'
fi
if [ $has_busybox == 'true' -a $has_mmcblk1p2 == 'true' -a $is_ext4 == 'true' ]
then
# DEBUGGING
# Get vars part 1
if [ $debugging == 'true' ]
then
set > /sdcard/vars.1
fi
# END DEBUGGING
# Start defining functions
makedir () {
if [ ! -d $1 ]
then
busybox mkdir -p $1
fi
busybox chmod $2 $1
busybox chown $3:$4 $1
}
# End defining functions
mnt_sd=$( busybox mount | busybox egrep -i '/sdcard' | busybox awk '{print $3}' )
mnt=$( busybox dirname $mnt_sd )
sd_uid=$( busybox ls -ln $mnt_sd | busybox egrep -i "Android" | busybox awk '{print $3}' )
sd_gid=$( busybox ls -ln $mnt_sd | busybox egrep -i "Android" | busybox awk '{print $4}' )
blk_ext4=$( busybox ls -lR /dev | busybox egrep -i "mmcblk1p2 ->" | busybox awk '{print $11}' )
blk_data=$( busybox mount | busybox egrep -m 1 '/data' | busybox awk '{print $1}' )
mnt_ext4=$mnt$append_ext4
ext_data=$mnt_ext4$data
ext_android=$ext_data$append_android
mnt_temp=$mnt_ext4$append_temp
temp_android=$mnt_temp$append_media$append_android
datetime=$( busybox date -Iseconds )
sd_android=$mnt_sd$append_android
sd_tweaked=$mnt_sd$append_tweaked
tweaked_logs=$sd_tweaked$append_logs
txt_movethis=$sd_tweaked$append_movethis
makedir $sd_tweaked 775 $sd_uid $sd_gid
data_media=$( busybox dirname $( busybox find /data -type d -follow -name 'Tweaked.Scripts' ) )
data_android=$data_media$append_android
data_uid=$( busybox ls -lnd $data | busybox awk '{print $3}' )
data_gid=$( busybox ls -lnd $data | busybox awk '{print $4}' )
android_uid=$( busybox ls -ln $data_media | busybox egrep -i "Android" | busybox awk '{print $3}' )
android_gid=$( busybox ls -ln $data_media | busybox egrep -i "Android" | busybox awk '{print $4}' )
# DEBUGGING
# Get vars part 2
if [ $debugging == 'true' ]
then
set > /sdcard/vars.2
busybox diff /sdcard/vars.1 /sdcard/vars.2 | busybox grep "+" | busybox egrep -v "@|_=" > /sdcard/vars.txt
fi
# END DEBUGGING
busybox chmod 775 $sd_tweaked
busybox chown $android_uid:$android_gid $sd_tweaked
makedir $tweaked_logs 775 $sd_uid $sd_gid
echo 'Logging Started' > $tweaked_logs/a2sd-$datetime.log
echo '' >> $tweaked_logs/a2sd-$datetime.log
busybox mount -o remount,rw /
makedir $mnt_ext4 775 $data_uid $data_gid
busybox mount $blk_ext4 $mnt_ext4
sleep 1
makedir $mnt_temp 775 $data_uid $data_gid
busybox mount $blk_data $mnt_temp
sleep 1
makedir $ext_data 775 $data_uid $data_gid
makedir $ext_android 775 $android_uid $android_gid
busybox mount -o bind $ext_android $data_android
sleep 3
busybox mount -o remount,ro /
if [ $moveAndroid == 'true' ]
then
busybox find $temp_android -type f -follow -print > $txt_movethis
fi
if [ $moveAndroid == 'true' ]
then
echo 'Copying files from internal storage to external storage\n' >> $tweaked_logs/a2sd-$datetime.log
while read line
do
source=$line
destappend=$append_A$( echo "$line" | busybox cut -f2-100 -d'A' )
dest=$ext_android/$destappend
destfolder=$( busybox dirname $dest )
if [ ! -f "$dest" ]
then
if [ ! -d "$destfolder" ]
then
busybox mkdir -p "$destfolder"
fi
busybox cp -pdf "$source" "$dest"
if [ -f "$dest" ]
then
echo -e $source'\ncopied to\n'$dest'\n' >> $tweaked_logs/a2sd-$datetime.log
else
echo -e 'Failed to copy: '$source'\n' >> $tweaked_logs/a2sd-$datetime.log
fi
else
echo -e 'Already exists: '$dest'\n' >> $tweaked_logs/a2sd-$datetime.log
fi
if [ $deletepostmove == 'true' ]
then
if [ -f "$dest" ]
then
busybox rm -f "$line"
if [ ! -f "$line" ]
then
echo -e 'deletepostmove = true - Deleted: '$source'\n' >> $tweaked_logs/a2sd-$datetime.log
echo -e '____________________________________________________________ ' >> $tweaked_logs/a2sd-$datetime.log
else
echo -e 'Failed to delete: '$source'\n' >> $tweaked_logs/a2sd-$datetime.log
echo -e '____________________________________________________________ ' >> $tweaked_logs/a2sd-$datetime.log
fi
fi
fi
done < $txt_movethis
busybox rm -f $txt_movethis
busybox chmod -R 775 $ext_android/*
busybox chown -R $android_uid:$android_gid $ext_android/*
fi
busybox umount $mnt_temp
if [ $pruneoldlogs == 'true' ]
then
(( prunehours = ($prunehoursold * 60) ))
find $tweaked_logs -mmin +$prunehours -exec rm {} \;
echo "All logs older than "$prunehoursold" hours old have been deleted"
fi
echo -e '\nEnd of Log' >> $tweaked_logs/a2sd-$datetime.log
fi
Click to expand...
Click to collapse
Where to find premission? Please advice.
Sent from my GT-N8000 using xda app-developers app
andylam16 said:
Where to find premission? Please advice.
Sent from my GT-N8000 using xda app-developers app
Click to expand...
Click to collapse
use a root file browser then press and hold on the file, select permissions. Change to: Owner (rwx), group and other (rx)
Sent from my GT-N8013 using Tapatalk 2
My device doesn't have intI. D folder in system/Etc
I have to create new folder?
Rename the file without . Txt?
Sent from my GT-N8000 using Tapatalk 2
lm that guy said:
use a root file browser then press and hold on the file, select permissions. Change to: Owner (rwx), group and other (rx)
Sent from my GT-N8013 using Tapatalk 2
Click to expand...
Click to collapse
Thanks bro, is r = read , w = write , x = ???
Please advice.
Sent from my GT-N8000 using xda app-developers app
andylam16 said:
Thanks bro, is r = read , w = write , x = ???
Please advice.
Sent from my GT-N8000 using xda app-developers app
Click to expand...
Click to collapse
Execute
Sent from my GT-N8013 using Tapatalk 2
lm that guy said:
Execute
Sent from my GT-N8013 using Tapatalk 2
Click to expand...
Click to collapse
Got it, thanks!:thumbup:
Sent from my GT-N8000 using xda app-developers app
kaipro said:
My device doesn't have intI. D folder in system/Etc
I have to create new folder?
Rename the file without . Txt?
Sent from my GT-N8000 using Tapatalk 2
Click to expand...
Click to collapse
+1
fauzin said:
+1
Click to expand...
Click to collapse
I suggest this thread: http://forum.xda-developers.com/showthread.php?t=1883125
Sent from my GT-N8013 using Tapatalk 2
kaipro said:
My device doesn't have intI. D folder in system/Etc
I have to create new folder?
Rename the file without . Txt?
Sent from my GT-N8000 using Tapatalk 2
Click to expand...
Click to collapse
Check link in my sig for my other thread where you can get the init.d enabler.
After did the procedure as mentioned nothing happened the apps still go to the scared not the external. Please advice anything I missed. Thanks
Sent from my GT-N8000 using xda app-developers app
---------- Post added at 10:54 AM ---------- Previous post was at 10:12 AM ----------
One more thing there is a file "99testinit" inside the init.d , do I need to anything about it?
Sent from my GT-N8000 using xda app-developers app
andylam16 said:
After did the procedure as mentioned nothing happened the apps still go to the scared not the external. Please advice anything I missed. Thanks
Sent from my GT-N8000 using xda app-developers app
---------- Post added at 10:54 AM ---------- Previous post was at 10:12 AM ----------
One more thing there is a file "99testinit" inside the init.d , do I need to anything about it?
Sent from my GT-N8000 using xda app-developers app
Click to expand...
Click to collapse
Exactly same as me.
Sent from my GT-N8000 using Tapatalk 2
If you guys read everything, this is still an early version. At the moment, only /sdcard/Android is getting moved, which is the location that stores extra files downloaded by apps, not the apps themselves. If the script is running, you can go on terminal and type:
Code:
df -h
and you should see mmcblk1p2 (which is the ext4 partition in the MicroSD) and how much space is being used, which is the amount of space that should be getting saved from the internal storage. Also, if you look under storage under settings, the amount of space available should have increased considerably, specially if you have a lot of games.
I'll be working on the other two parts throughout this week (moving APK and DATA) Then you will be able to notice a bigger difference, although it will always look like apps are installed in the internal storage, even when they're in the external storage.
The reason for this is because the script works by mounting the external storage to:
/data/app (not yet implemented)
/data/data (not yet implemented)
/data/media/Android (already implemented)
while at the same time copying the contents of those locations from internal to external then wiping them from internal. Essentially when it's all said and done, the OS pretty much thinks that nothing has changed, except that whenever anything gets written to those folders it takes space from the external storage instead of internal.
A good way to test it would be to download a free gameloft game like MIB3 or Six Guns. Take a look at storage before installing. After you install MIB3, your available storage should drop by roughly 500MB, but if you're using the script, even at preview stage, the available storage will only drop by about 30MB, even though storage settings will say that the game takes up ~500MB.
Also, you can mount your normal data partition and take a look at how much space is being used there, as opposed to the external partition like this:
(All the following commands in terminal)
make sure which partition is mounted to /data
# mount
mount data to temp location (assuming data is mmcblk0p12)
# mount /dev/block/mmcblk0p12 /mnt/ext4/temp
check amount of space used in internal storage:
# du -dh /mnt/ext4/temp/media/Android
check amount of space used in external storage
# du -dh /mnt/ext4/data/Android
In the future I'll add to the script a way to automatically calculate the amount of space saved
The script itself is not working. Init.d is working, did rename the file and changed permission. I use script manger and try to run the script but it's got error,
Sent from my GT-N8000 using xda app-developers app
htainlin said:
The script itself is not working. Init.d is working, did rename the file and changed permission. I use script manger and try to run the script but it's got error,
Sent from my GT-N8000 using xda app-developers app
Click to expand...
Click to collapse
I'm gonna be uploading a new version soon with more debugging so I can see why people might have issues.
EDIT - Done updating OP
Is there any recommendations for the partition other than ext4, like swap size and what not? I also assume a reboot is required in order to get it to run right? I am still getting insufficient storage available when updating apps in the play store. I was getting that error before, even though I have plenty of space, like more than 10 gb on the internal memory so I don't know if it is just a batch update issue on the play store with my note for whatever reason. But even individual updates stop with an insufficient storage error.
I have tried using both the attached file in the op as well as the copy and paste method. The file should have no extension once in place right?
It seems as though it is still not working right
I have init.d working, confirmed with the test file and your method, Busybox installed, partitions with 0 swap and 1024 size at ext4
I have not been able to locate a log created, where is it dumped to to see if it is even running the script?
EDIT: never-mind, I figured out why my stuff was't updating but still able to add new apps, in rom tool box, I set it to install to sd card after most of my apps were already put on the internal memory. Just switched it to auto and it fixed it up
smaw51 said:
Is there any recommendations for the partition other than ext4, like swap size and what not? I also assume a reboot is required in order to get it to run right? I am still getting insufficient storage available when updating apps in the play store. I was getting that error before, even though I have plenty of space, like more than 10 gb on the internal memory so I don't know if it is just a batch update issue on the play store with my note for whatever reason. But even individual updates stop with an insufficient storage error.
I have tried using both the attached file in the op as well as the copy and paste method. The file should have no extension once in place right?
It seems as though it is still not working right
I have init.d working, confirmed with the test file and your method, Busybox installed, partitions with 0 swap and 1024 size at ext4
I have not been able to locate a log created, where is it dumped to to see if it is even running the script?
EDIT: never-mind, I figured out why my stuff was't updating but still able to add new apps, in rom tool box, I set it to install to sd card after most of my apps were already put on the internal memory. Just switched it to auto and it fixed it up
Click to expand...
Click to collapse
Had a similar problem when i had the tf201, kept getting an error whenever playstore started installing an app after the initial download, and i had the same problem a couple of days ago with the note which i resolved by deleting all odex files in the data\apps folder, i used es file explorer, navigated to the app folder and did a search for 'odex', then deleted them, i can now install apps again
Dont know if this is the same issue as yours , and ive just now seen your edit, so i see youve resolved it, so no worries, hopefully our solutions will help out others
Edit: dont quote me but my particular issue i 'think' has something to do with titanium backup, so for those having 'inssuficient storage errorr' in the playstore AND you have titanium backup, this may help
It might be a restore from backup in general issue, after you mention you used titanium. I used my backup pro to restore apps and data from my tf 700 to the my note. Only halfsies worked but maybe that caused some issues.
This is going to be very nice one apk and data are enabled to move to sd
how do I know that I have ext4 in my SDcard? and if I dont have it , How do I make ext4 ?
Thanks

Linking from /mnt/sdcard to /mnt/sdcard-ext - automatization

Found the solution, it's in the fifth post
Hey, first of all I'm Linux and Android newbie, so sorry if my question reveals it a bit
As my Internal Storage a.k.a. /mnt/sdcard is getting full and I hate to be reminded of it by notification I can't get rid of, I decided to put some effort into moving the largest files to the SD card. I have a 64GB SD an there still are several free gigs So after some googling I found out a way to link it. It works like this:
Code:
mount -o bind /origdir /newdir
where both /origdir and /newdir must exist, in my case as an example:
Code:
mount -o bind /mnt/sdcard-ext/sd/DictionariesNGHS /mnt/sdcard/DictionariesNGHS
where /mnt/sdcard-ext/sd/DictionariesNGHS is the data containing folder and /mnt/sdcard/sd/DictionariesNGHS is an empty folder for linking. It works like a charm, tried with several applications including some off-line navigations. The downside is that such links are forgotten after a reboot.
I didn't find out how to automatize that. I tried putting the line from second code to the end of /system/etc/init.goldfish.sh (I run Eclipse ICS 1.2) and it didn't get linked after a reboot (but works OK after mounting manually in terminal) - I suspect it runs before sdcard-ext is mounted. Any thoughts on how to make it run after reboot? Or maybe of an app that does this for me?
EDIT:
Put my links into /data/data/init.sh
Tried several not working apps:
ScriptMe by gilsken says Script run mount: No such file or directory
Script Manager - SManager by devworm says
Code:
exec sh '/data/data/init.sh'
[email protected]_maserati:/ # exec sh '/data/data/init.sh'
mount: No such file or directory
while interestingly when I write it by myself in its built-in console it works...
App that works: Tasker by Crafty Apps
I can have scripts run on boot and it works, but I can add only one line at time (or at least it's the only option I found) which is still kinda inconvenient plus it runs all the time consuming system resources. I'd like some less robust solution, preferably executed after boot and exiting after mounts proceed. Any ideas?
EDIT 2:
My "workaround" in Tasker: Profiles -> New -> Event -> System -> Device Boot -> OK -> New Task -> OK -> + -> Script -> Run Shell -> Command: /data/data/init.sh -> OK
Surprisingly enough it doesn't even need root permission...
In init.sh I have several lines with different mounts, it all works well. I'm still looking for less robust solution than Tasker is, or maybe a way to kill it after the init.sh is processed?
hey
can you please post the content of youre
Code:
/data/data/init.sh
---------- Post added at 04:35 PM ---------- Previous post was at 03:50 PM ----------
youre problem is, at the runtime form the mount command, the mount is not in youre path.
can you add to you script the command
Code:
env
and post the output?
I tried it with a file containing only this line:
Code:
mount -o bind /mnt/sdcard-ext/sd/DictionariesNGHS /mnt/sdcard/DictionariesNGHS
OK, after running it by SManager it looks like giving errors, but the folder gets mounted.
Also it seems apps get access to /mnt/sdcard faster after reboot then to /data/data (I wonder why...?) so I moved the script there.
Here you have the output with env at the end of init.sh, run by SManager as root (mounted OK):
Code:
exec sh '/mnt/sdcard/init.sh'
[email protected]_maserati:/ # exec sh '/mnt/sdcard/init.sh'
mount: No such file or directory
_=/system/xbin/env
ANDROID_BOOTLOGO=1
ANDROID_PROPERTY_WORKSPACE=8,69632
LOOP_MOUNTPOINT=/mnt/obb
SM_API=15
RANDOM=26725
ANDROID_ASSETS=/system/app
USER=root
EXTERNAL_STORAGE=/mnt/sdcard
ANDROID_DATA=/data
PATH=/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
SM_LAUNCHER=MANUAL
TERM=vt100
PS1=$(precmd)[email protected]$HOSTNAME:${PWD:-?} #
SM_VERSION=2.5.3.1
SM_GUIFD=3
LD_LIBRARY_PATH=/vendor/lib:/system/lib
SECONDARY_STORAGE=/mnt/sdcard-ext
SM_ALIAS=init.sh
ASEC_MOUNTPOINT=/mnt/asec
SM_HOME=/mnt/sdcard
HOSTNAME=cdma_maserati
HOME=/
SM_VERSIONCODE=77
BOOTCLASSPATH=/system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework-ext.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/filterfw.jar:/system/framework/com.motorola.android.frameworks.jar:/system/framework/com.motorola.android.widget.jar:/system/framework/com.motorola.frameworks.core.addon.jar:/system/framework/kafdex.jar:/system/framework/com.motorola.orange.simauth.jar
ANDROID_ROOT=/system
SHELL=/system/bin/sh
MKSH=/system/bin/sh
ANDROID_SOCKET_zygote=9
So it works after all with the SManager as I intended, I just don't understand why it gives that error when everything actually is OK...
Any ideas on how to make it run automatically after every mount of sdcard-ext instead of on reboot? Because when I connect it to the computer as Mass Storage, the directory mounts disappear and I have to run the script manually...
LuH said:
I tried it with a file containing only this line:
Code:
mount -o bind /mnt/sdcard-ext/sd/DictionariesNGHS /mnt/sdcard/DictionariesNGHS
...
Any ideas on how to make it run automatically after every mount of sdcard-ext instead of on reboot? Because when I connect it to the computer as Mass Storage, the directory mounts disappear and I have to run the script manually...
Click to expand...
Click to collapse
for the first, replace the mount with this:
Code:
/system/bin/mount -o bind /mnt/sdcard-ext/sd/DictionariesNGHS /mnt/sdcard/DictionariesNGHS
Found out that the "mount: No such file or directory" error was due to typo in folder path
So to wrap it up:
You need to be rooted first.
Create your init.sh script file, works fine when put to /mnt/sdcard/
Example file (also attached so you have a sample in UNIX formatting - don't open with Notepad under Windows, better edit it in your phone):
Code:
# mount -o bind /sourcedir /fakedir - both sourcedir and fakedir MUST exist!
mount -o bind /mnt/sdcard-ext/sd/DictionariesNGHS /mnt/sdcard/DictionariesNGHS
mount -o bind /mnt/sdcard-ext/sd/Android/obb /mnt/sdcard/Android/obb
Note: you should use a UNIX formatting of the file, not Windows (I'm not sure if it's necessary though).
As hinted in the beginning note, sourcedir and fakedir must exist and after successful mount the fakedir folder will appear to have the contents of the sourcedir folder. Any fakedir's contents are ignored ("disappear") after mount and reappear only after it gets unmounted.
It gets automatically unmounted after unmounting of either fakedir's or sourcedir's media (typically when connecting phone to a computer as mass storage) and I haven't found any workaround for running the script after remounting of media... Any suggestions?
Install SManager (free version here).
In SManager navigate to your script file, tap it and select Script/Executable and tap Su and Boot icons (see attached screenshot).
Done, your folders get mounted on reboot

Categories

Resources