Is there a way to make apps use /sdcard/ApplicationData rather than /sdcard ? - Nexus One Q&A, Help & Troubleshooting

Is there a way to make all applications store their data in a folder other than /sdcard (root folder on the sd card) ?
I'm planning on rooting and thought that this time round I can keep my sdcard nice and organized by creating an "ApplicationData" folder in the root of the sdcard and somehow configuring android to use that.
On a similar note, can I move the DCIM (camera photos) to a different location too?
Will the below change-mount-point idea work?
Maybe as root we can
1) un-define /sdcard (in /etc/fstab) //or wherever its defined
2) define /sdcard as /dev/<hdb0>/ApplicationData //change hdb0 to the appropriate device/partition
thanks.

Yeah, I see your point... but quite frankly, I believe it's upto the app developers [my knowledge of the Android world is still from the stone-age!!]... if the app specifies that it's data will be stored in /sdcard/AppName, there's not much you can do, unless you can modify the app...

I was thinking that maybe as root we can
1) un-define /sdcard (in /etc/fstab) //or wherever its defined
2) define /sdcard as /dev/<hdb0>/ApplicationData
edit: added to post#1

britoso said:
I was thinking that maybe as root we can
1) un-define /sdcard (in /etc/fstab) //or wherever its defined
2) define /sdcard as /dev/<hdb0>/ApplicationData
edit: added to post#1
Click to expand...
Click to collapse
I did think of this too...
/sdcard --> /sd/AppData
rest of sd card --> /sd
but I think it would mean some other changes as well... for example... the mount usb functionality would have to be modified to mount/unmount a different volume...

So heres the contents of my fstab file:
Code:
C:\>adb shell cat /system/etc/fstab
/dev/block/mtdblock3 /system yaffs2 rw
/dev/block/mtdblock4 /cache yaffs2 rw
/dev/block/mtdblock5 /data yaffs2 rw
/dev/block/mmcblk0p1 /sdcard vfat rw
/dev/block/mmcblk0p2 /system/sd auto rw
/system/modules/modules.sqf /system/modules squashfs ro,loop
/system/xbin/xbin.sqf /system/xbin squashfs ro,loop
I'll try changing line 4 (/sdcard), I'm guessing /system/sd is for when I apps2sd is enabled.
Question: How do I escape from INSERT/EDIT mode in VI? Tried pressing trackball+1, trackball+1+2...didnt work

Hey britoso!
Keep us updated with your accomplishments. I, personally, am very interested in being able to achieve this.
Good luck!

update: that didnt work.
Note: the way to get the ESCAPE character is CONTROL + [ (hold the trackball then press [ ). The control key is configurable and defaults to the Jogball/TrackBall
here are the contents of my fstab file, the camera app is still writing to the root of the sdcard (/sdcard/DCIM)
Code:
C:\>adb shell cat /system/etc/fstab
/dev/block/mtdblock3 /system yaffs2 rw
/dev/block/mtdblock4 /cache yaffs2 rw
/dev/block/mtdblock5 /data yaffs2 rw
/dev/block/mmcblk0p1 /sdcard/AppData vfat rw
/dev/block/mmcblk0p2 /system/sd auto rw
/system/modules/modules.sqf /system/modules squashfs ro,loop
/system/xbin/xbin.sqf /system/xbin squashfs ro,loop
Heres the output of "df"
Code:
C:\>adb shell df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 197600 0 197600 0% /dev
tmpfs 4096 0 4096 0% /sqlite_stmt_journals
/dev/block/mtdblock3 148480 100088 48392 67% /system
/dev/block/mtdblock5 200960 63752 137208 32% /data
/dev/block/mtdblock4 97280 39628 57652 41% /cache
/dev/block//vold/179:1
15643712 6843256 8800456 44% /sdcard

@britoso
This is what I found out about mounts in Android...
The init program directly mounts all filesystems and devices using either hard-coded file names or device names generated by probing the sysfs filesystem (thereby eliminating the need for a /etc/fstab file in Android).
And from what I see in your df output, it didn't mount /sdcard/AppData...
Have a few ideas in mind... gonna try 'em out now...

craigacgomez said:
gonna try 'em out now...
Click to expand...
Click to collapse
thanks for the info. Let us know how it works out.

Here's what I reached finally...
To achieve this, I have 2 ideas...
1. We gotta modify the init and change the SD mount point to AppData and add another for the rest of the SD... this however would require a rebuilt ROM (I can't edit init on the phone, need to edit init.c from the source)
2. We push some startup scripts to achieve this, but so far, I haven't been able to mount anything else on /sdcard (operation failed), but I think I'm doing something wrong...
Didn't get much time to experiment... and it mite be a busy end of week for me... but I'll try to squeeze in so time to get this...

Why not ask Cyanogen to do this for us in his next ROM?
Or your next favorite modder?
I'm sure they'll like this idea!?

theres a setting in /init.rc that may help
Code:
export EXTERNAL_STORAGE /sdcard
However / is mounted read-only
mount
rootfs on / type rootfs (ro,relatime)
Click to expand...
Click to collapse

Related

[Q] Hello there have some problems with moving system files

Hi i moved some files from system/app into the sd card to get some space so i could use the metamorph app but i didnt work so i was going to move back the files from the sd card to system/app but now they wont move there anyone know a soloution how to do this?
thanks in advance
system is readonly
you must do an
adb shell
mount /dev/block/mtdblock3 /system
then you can fool around with your system apps
mount /dev/block/mtdblock3 /system || I wrote that but it says
"mount: mounting /dev/block/mtdblock3 on /system failed: Device or resource busy"
i rooted my phone yesterday quite knew to android and i have no clue what to do
You are doing that in recovery mode right?
I tried in ClockworkMod Recovery v2.5.0.1 but it says Device or resource busy :/ have no clue.
ClockworkMod has a nice green menu on screen from where you can see (partitions menu) which partitions are already mounter and which are not.
You can also do adb shell and run "mount" in it to see which partitions are mounted and in what way. ClockworkMod has /etc/fstab so you can mount system just by running "mount /system". If system is already mounted, you can cd to /system/app and try "touch test". If you get permission denied then your system is mounted read-only otherwise you will see test file in /system/app if you run "ls".
I did adb shell and did run "mount" and it says /dev/block/mtdblock3/ on /system type yaffs2 <ro>
I downloaded a app called root explore and the main reason for that was so i could move some files from system/app so i could get some free space so i could use metamorph that was my plan and i moved some files i have eard you could move that wouldnt harm anything but it wasnt enough free space, so my plan was to move back the files i had moved into the sd card some went great but i have like 4 files that i cant bks it says "You cannot paste here because the file system is read-only" is there any other way to push those file into the system/app again? have tried the things u wrote up.
And im not a very pro of theese things i started with this yesterday so excuse me for being stupid!
This:
/dev/block/mtdblock3/ on /system type yaffs2 <ro>
...means that system is mounted read-only (mind that "ro" at the end).
Try running "mount -o remount,rw /system". If it doesn't help run "cat /etc/fstab" and post here the output. You need to be in recovery mode while doing this of course!
did "mount -o remount,rw /system" and it said mount: can't find /system in /proc/mounts
and the other one said
/dev/block/mtdblock4 /cache yaffs2 rw
/dev/block/mtdblock5 /data yaffs2rw
/dev/block/mtdblock3 /system yaffs2 rw
/dev/block/mmcblk0p1 /sdcard vfat rw
/dev/block/mmcblk0p2 /sd-ext auto rw
used my brain a little now and in the recovery settings i did mount the /system in the menu and now i tried to write cd /system/app and now in the cmd it is like this "/system/app #" anything useful?
Sure... as I already told you try to run "touch /system/app/test". This command shoud make empty test file in /system/app. If you get permission denied then you have read-only system. If it suceede, then your /system is writable and you can see all the contents of /system/app by runing "ls".
I wrote that and it wrote the same
"touch /system/app/test"
no permmission denied then it may have worked?
i checked and there is a testfile in /system/app now
I think i got it to work now thanks man for all your help!

[Q] How to release space in /system [JPK]

So... I've been messing around with framework-res.apk. To migrate the file onto the i9000 i rm the original, then cp the new version in. It looks like everytime I do this though, the filesystem never releases free space.
"du -ks /system/*" totals to 260552k, but "df -k /system" shows:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/block/stl9 282432 281316 1116 100% /system
So it appears like the last 3 or so framework-res.apk's haven't had their space released. I've had to move out some apps from /system/apps to copy in the last couple of framework-res.apk's.
Any suggestions as to how to release the free space?
(My guess is that I remount as rw before copying the file, but there are many processes with handles on the old file so the filesystem cant release the space until reboot, and with the reboot the filesystem is mounted as ro so it can't release the free space?)
** SOLVED **
followed bilboa1's advice on RFS errors in this thread : forum.xda-developers.com/showthread.php?t=797650&highlight=mount+%2Fsystem , fsck_msdos'd the /system partition, did a reboot and regained the free space:
/dev/block/stl9 275.8M 273.7M 2.2M 99% /system
# /system/bin/fsck_msdos -p -f /dev/block/stl9
# reboot
/dev/block/stl9 275.8M 267.2M 8.7M 97% /system
*** solution bump ***

[Q] app2SD - can't mount ext2 partition

Hi, I have an unlocked, rooted Milestone running 2.1-update1.
I am having some issues getting App2SD up and running.
Everything seems to be working fine except for one piece:
I can't mount the ext2 partition of my SDCard.
I have a 16gb sdcard, formatted with two primary partitions, 14.5gb for FAT32 and 1.5gb for ext2.
busybox was installed ok, all the shell scripts seem to have installed fine as well, however, in order for it to work, the "mount_sd.sh" script has to be able to mount the second partition in order to link /data/app to it - but the damn thing won't mount.
I have tried re-partitioning the SD card multiple times, using multiple different partitioners (gparted in Ubuntu, Minitool in XP, even fdisk in the Android shell itself...) but nothing seems to work - I always get the same error:
Code:
# mount -t ext2 /dev/block//vold/179:2 /system/sd
mount -t ext2 /dev/block//vold/179:2 /system/sd
mount: No such device
The device however, most certainly DOES exist:
Code:
# ls /dev/block//vold
ls /dev/block//vold
179:2
179:1
179:0
I have seen that some people use the /dev/block/mmcblk0 instead of /dev/block//vold/179 - I am unsure as to why (anyone know which one I should be using on the Milestone???) but I tried that as well:
Code:
# mount -t ext2 /dev/block/mmcblk0p2 /system/sd
mount -t ext2 /dev/block/mmcblk0p2 /system/sd
mount: No such device
Again, it tells me the device doesn't exist, when it clearly DOES:
Code:
# ls /dev/block/mmc*
ls /dev/block/mmc*
/dev/block/mmcblk0
/dev/block/mmcblk0p1
/dev/block/mmcblk0p2
When I try to verify the partitions are there in the ADB shell, it looks like /dev/block//vold/179 doesn't exist or is some kind of special device (incidentally, does anyone know wtf the double slashes "//" are for?):
Code:
# fdisk /dev/block//vold/179
fdisk /dev/block//vold/179
fdisk: can't open '/dev/block//vold/179'
However, I CAN fdisk /dev/block/mmcblk0, and it gives me the following partition table:
Code:
# fdisk /dev/block/mmcblk0
fdisk /dev/block/mmcblk0
...snip...
Disk /dev/block/mmcblk0: 16.0 GB, 16039018496 bytes
255 heads, 63 sectors/track, 1949 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1 1762 14153233+ b Win95 FAT32
/dev/block/mmcblk0p2 1763 1949 1502077+ 83 Linux
So, it looks like /dev/mmcblk0 is the correct block device, however, mount tells me this:
Code:
# mount
mount
...snip...
/dev/block//vold/179:1 /sdcard vfat rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=101
020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
So, mount is telling me that the first partition is mounted onto /sdcard from /dev/block//vold/179:1
I am confused. The only thing left I need to do in order to get App2SD working on my Milestone, is to mount the bloody second partition of my SD card and link it to the file system, yet the damn thing refuses to mount.
Does anyone know where I am going wrong here?
Which is the correct block device I should even be trying to mount /dev/block/mmcblk0 or /dev/block//vold/179:2?
I don't want to flash to an unofficial 2.2 and I have everything else working just the way I want it, so I'd rather not reset either.
There MUST be a solution somewhere, but I am getting frustrated.
Thanks for any help you can give me!
Hello!
I'm having exactly the same problem... I've been trying to find a solution for this problem for the last 3 hours, but I can't figure out a way...
Can anyody give us a light??
Thanks!
Same question here. Partitioned more than a month ago, but then I reached a dead end. I don't know a reliable way to mount the ext2 partition. I'm familiar with Linux, and I have tried all kinds of crazy shell scripts, but the Android filesystem is still a bit alien to me.
By the way, what is this App2SD that you speak of? It's something different from the Apps2SD app on Froyo, right?
JoeDuncan said:
Code:
# mount -t ext2 /dev/block/mmcblk0p2 /system/sd
mount -t ext2 /dev/block/mmcblk0p2 /system/sd
mount: No such device
Click to expand...
Click to collapse
A shot in the dark would be ext2.ko is not insmodded ... ?
got this problem to on stock US froyo kernel for Samsung Galaxy 5. I also suspected ext2 was missing but it seems compiled into kernel.
Code:
# cat /proc/filesystems
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev tmpfs
nodev debugfs
nodev sockfs
nodev pipefs
nodev anon_inodefs
nodev rpc_pipefs
nodev inotifyfs
nodev devpts
ext2
nodev ramfs
vfat
nodev nfs
rfs
For the MS, you have to insert a ext2 Kernel module, look around here on the forums..
Depending on which module-version you're using try "-t auto" instead of "-t ext2"
Also you should use "/dev/block/mmcblk0p2" if this is your ext2 partition
Besides, there should be some packages available which contain the necessary scripts and files to install this automatically and at boot, applicable as OR-updates
It was my understanding that Apps2SD could not be used on 2.1, you needed 2.2 to use that app. Although I have the same issue with Links2SD which is suppose to work with 2.1. I can't get anything to see an ext2 or 3 or Fat partition.
My amator tries
Hy,
I've got the same problem on Cyanogen and Goapk roms:
mount -t auto /dev/block/mmcblk0p2 /sd-ext
doesn't work
I verified sd-ext was present
mkdir /sd-ext
Nothing changed.
My mount description is somethime using vold instead of mmcblk0p... I don't really understand.
However I succeeded to mount sdext by using busybox (on goapk rom)
busybox mount -r -w -t auto /dev/block/mmcblk0p2 /sd-ext
result mount:
rootfs / rootfs rw 0 0
tmpfs /dev tmpfs rw,mode=755 0 0
devpts /dev/pts devpts rw,mode=600 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
tmpfs /mnt/asec tmpfs rw,mode=755,gid=1000 0 0
/dev/block/mtdblock3 /system yaffs2 ro 0 0
/dev/block/mtdblock5 /data yaffs2 rw,nosuid,nodev 0 0
/dev/block/mtdblock4 /cache yaffs2 rw,nosuid,nodev 0 0
/dev/block/vold/179:1 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,uid=1000,g
id=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-
1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:1 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,uid=1
000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso
8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /mnt/sdcard/.android_secure tmpfs ro,size=0k,mode=000 0 0
/dev/block/mmcblk0p2 /sd-ext ext2 rw,errors=continue 0 0
Just in case, If somebody can help me:
*I have a symlink /data/drm =>/data/local :how to unsymlink it? (unbind isn't present and replacement doesn't work:" Invalid cross-device link")
*perl script are unable to decompresse boot.img, how to change init.rc in this case?
thanks
symlinks
lamidesbetes said:
*I have a symlink /data/drm =>/data/local :how to unsymlink it? (unbind isn't present and replacement doesn't work:" Invalid cross-device link")
Click to expand...
Click to collapse
Symlinks can be removed with the rm command.
The "cross device link" error happens when one uses the ln command without the "-s" option (so attempting a hard link instead of symlink).

[Q] [Coding] File Explorer --> Cant access /data

Hello there,
Im trying to create my own file explorer (a very stripped down one) with root privileges just to learn how to code for android. Anyways, i am able to access my /system folder and look in every folder besides the /data folder. There are no subdirectories... its just empty. When i check through ADB or through terminal emulator, i can see al the folders in the /data folder. So what am i doing wrong???
I have this setup for now,
Code:
final Runtime runtime = Runtime.getRuntime();
try {
runtime.exec("su");
}
just go get root access, but i dont even know if thats correct. The app asks for root permissions and i can accept it but i still cant view the /data folder...
I also tried
Code:
runtime.exec("mount -o remount,ro -t yaffs2 /dev/block/mtdblock5 /data");
and
Code:
runtime.exec("mount -o remount,rw -t yaffs2 /dev/block/mtdblock5 /data");
and still nothing...

Remount/Bind mount /sdcard as executable

I have a rooted Pixel 5a running latest Android 12.
While I can write to the data partition, I would like to keep my own files and programs on the /sdcard tree.
However, it seems that I cannot execute (or link) files on the corresponding fuse filesystem.
Code:
# mount | grep /storage/emulated
/dev/fuse on /storage/emulated type fuse (rw,lazytime,nosuid,nodev,noexec,noatime,user_id=0,group_id=0,allow_other)
I tried doing 'mount /storage/emulated -o remount exec' but while it removed the 'noexec' flag, I still couldn't chmod any file to be executable.
So is there any way to re-mount or bind-mount /storage/emulated or any subtree of it to allow executable files?
Similarly, is there any way to mount it to allow links?
If that is not possible, what is the best place to create my own personal directory of executable files.
What about /data/<mydir> ?
Thanks
Files and directories on sdcardfs have fixed ownership and permissions.
But you can store your executables anywhere under /data, like /data/bin.

Categories

Resources