Where can I save files on G1? - G1 Android Development

So my sd card just fried, more info on that in another thread. And I'm looking for somewhere to save .txt files in the G1's memory.
But it seems most of the folders are either A) read-only so I can't make a directory or B) I'm wondering if some directories might auto-wipe my files on a reboot or something (or worse, putting random files in some system directory breaks something).
Does anyone know a safe location on the G1's main memory to make a directory for a few .txt files?

I should mention that most (all?) of the directories on the internal memory are read-only etc *even with root* and superuser access. (Can't even mkdir from terminal.)
Anyone know some obscure folder to use, or a way to get around this?

Either download DroidSans from the market to mount the system as read/write or use this command.
mount -o rw,remount -t yaffs2 /dev/block/mtdblock03 /system
Then you can create a tmp folder and add your txt files.

Related

modified: Installing & Run application on sdcard

WARNING: Proceed at your own risk, this may damage your phone and/or make it unstable. This is for advanced users only and should only be attempted by those who understand the risks of the following changes
Original post: http://www.androidin.net/thread-1099-1-1.html
AS usual, this is for those WITH ROOT ONLY
Preparation:
1. Installed JF RC30 V1.2 (only if you are using JF RC30 1.2 , this is not compatible with RC8)
2. Make a NANDROID backup (you may get everything back to normal if the phone screw up)
3. A MICRO-SD card with 2 partitions divided : (1) a fat-32 partition, (2) a ext2, you need a linux/mac to format the sdcard with ext2 partition
* the fat 32 will be mounted as sdcard and the ext2 will be mounted as /sd for application data, make your own decision for the size*
4. insert the sdcard with 2 partition on the phone
5. set the phone to aeroplane mode for safe
Procedure:
1. adb pull /system/etc/mountd.conf /*somewhere you may want to back it up*
2. rm -f /system/etc/mountd.conf
3. using the modified mountd.conf, adb push /*the path of modified mount.conf */mount.conf /system/etc/mountd.conf
4. adb pull /system/init.rc /*somewhere you may want to back it up*
5. rm -f /system/init.rc
6. using the modified init.rc, adb push /*the path of modified init.rc*/init.rc /system/init.rc
7. reboot
8. busybox cp -a /data/app /sd/
9. rm -r /data/app
10. ln -s /sd/app /data/app
11. reboot
Now, the phone will install and run everyone on /sd, still mounting /sdcard as usual. It is possible that to mount or unmount /sdcard by usb without everything screwed up. Beware that your sdcard will be used as part of system, removing the sdcard may freeze the phone. If the phone get freeze because of removing the sdcard, plug the sdcard again and soft reset.
It is also possible that copy the application data to another card. If you want to change the sdcard, switch the phone off, mounting the sdcard to computer directory, copy the /sd partition to another sdcard with ext2 partition
Back to normal:
1. rm -f /system/etc/mountd.conf
2. adb push /*the backup of mountd.conf* /system/etc/mountd.conf
3. rm -f /system/init.rc
4. adb push /*the backup of init.rc* /system/init.rc
5. busybox cp -a /sd/ /data/app
6. rm -r /sd/
Change of mountd.conf:
changing /dev/block/mmcblk0 to /dev/block/mmcblk0p1
change of init.rc:
adding
insmod /system/modules/2.6.25-01843-gfea26b0/kernel/fs/ext2/ext2.ko
mknod /dev/mmcblk0p2 b 179 2 1000
mount ext2 /dev/mmcblk0p2 /sd noatime nodiratime
Any chance of this being simplified into the actual commands necessary for this!?
I'm a semi-noob at *nix stuff... I can format my SD card into 2 partitions, but I'm lost at step 4... What do we need to edit??
Changed step 4...just adb pull the mount.conf for editing..open the file in text editor..find "mmcblk0" and change it "mmcblk0p1" ..save the .conf...del the original one..push the new one to the original directory..
Yay. Now hopefully we can get this in an update.zip to flash
Yeah, I'm putting off doing this until someone makes an update.zip which I definitely know how to apply and get rid of if I screw anything up
REPLACES the internal memory...?
So the internal memory isnt used?
kinda the same trick as the browser cache and market cache, just a bit more complex as its an entire filesystem your moving, which wouldnt let the sys see the internal, mem, please correct me if im reading it wrong, Im not a total noob at linux but no guru dev either...
bhang
The internal memory is still used, just not for /data/app
19.rm -r /data/app
20.ln -s /sd/app /data/app
Click to expand...
Click to collapse
It should probably be /sdcard/app. In any case, this is a fairly complex mod that is not suited for Linux newbies. I would advise against folks considering this mod unless they understand and can test each step before attempting.
I agree and added a warning to the first post
Ummm yea, so what happens when you mount your sdcard for storage? I expect the phone goes crazy?
This tutorial, if you could call it that,(no offense) is really badly written and this process seems too risky for what you gain considering that if we are patient google will come out with this themselves.
Stericson
Stericson said:
Ummm yea, so what happens when you mount your sdcard for storage? I expect the phone goes crazy?
This tutorial, if you could call it that,(no offense) is really badly written and this process seems too risky for what you gain considering that if we are patient google will come out with this themselves.
Stericson
Click to expand...
Click to collapse
The procedure calls for two partitions on the microsd, one FAT32, other EXT. Theoretically it should work with mounting for mass storage. However, I agree that it's a rather sloppy hack.
There is talk about a similar strategy being officially implemented by the Android team. Instead of two partitions, it would be loopback mounted to a file in the FAT32. That would also provide some encryption security. See here. It's just talk though. Won't be a reality for at least a few months.
Well talk is certainly better than nothing...thanks for the info....
Stericson
I post a method withtout compiling the ramdisk.img but that do not force mounting the sd ext2 drive under rootfs but still workable...probably when i back to work I can compile 1 to flash
Am I the only one that thinks there are a few things that are getting 'lost in translation' here?
I'm not getting /sd mounted properly upon reboot...there's no way I'm going to continue attempting this till I see a better (no offense) tutorial or do a little more research on the command lines.
I would really shy away from this if you're an average user or don't know what mountd and init.rc files are used for....this could flat out wreck your phone.
TheDudeOfLife said:
Am I the only one that thinks there are a few things that are getting 'lost in translation' here?
I'm not getting /sd mounted properly upon reboot...there's no way I'm going to continue attempting this till I see a better (no offense) tutorial or do a little more research on the command lines.
I would really shy away from this if you're an average user or don't know what mountd and init.rc files are used for....this could flat out wreck your phone.
Click to expand...
Click to collapse
/sd is /sdcard (mount point for the micro sd card's partition)
I'm getting stuck right here:
8. busybox cp -a /data/app /sd/
9. rm -r /data/app
10. ln -s /sd/app /data/app
11. reboot
It's saying read only system blah blah, even though I have indeed mounted it is rw
pershoot said:
/sd is /sdcard (mount point for the micro sd card's partition)
Click to expand...
Click to collapse
No....no it is not.
/sd is a mount of the ext2 partition used for the 'copy' of /data/app (one of the things i disagreed with is picking /sd as a mount point for the second partition.)
/sdcard is the fat32 mount point...used as usual for mounting files.
IzzeLing said:
I'm getting stuck right here:
8. busybox cp -a /data/app /sd/
9. rm -r /data/app
10. ln -s /sd/app /data/app
11. reboot
It's saying read only system blah blah, even though I have indeed mounted it is rw
Click to expand...
Click to collapse
Type mount in adb shell and see if /sd is even mounted. I wasn't seeing it in my list. I don't think his mount command in the init.rc is correct, but I'm too busy with holiday stuff.
Don't rm -r /data/app if you have not 100% verified the copy works.
This line looks mangled (need flags in the args):
Edit: nevermind, looks like it should work in the init.rc
TheDudeOfLife said:
No....no it is not.
/sd is a mount of the ext2 partition used for the 'copy' of /data/app (one of the things i disagreed with is picking /sd as a mount point for the second partition.)
/sdcard is the fat32 mount point...used as usual for mounting files.
Click to expand...
Click to collapse
ahh yea. i just re-glanced over the instructions.
cool.
TheDudeOfLife said:
Type mount in adb shell and see if /sd is even mounted. I wasn't seeing it in my list. I don't think his mount command in the init.rc is correct, but I'm too busy with holiday stuff.
Don't rm -r /data/app if you have not 100% verified the copy works.
Click to expand...
Click to collapse
Yeah, don't see it. Hm.

Can't use ringtones that stored on /sdcard/ringtones

Suddenly I couldn't find any of my ringtones that stored on the /sdcard/ringtones directory from Ringtones Settings.
The /sdcard/ringtones is still avaliable on the sdcard and If I tried to play them throw the mp3 player they works fine.
I found out that the sdcard is mounted as Read-Only and not Read/Write as before. Even if I plug it in to the PC I can't change any of the data on the sdcard only read it.
The latest change that I made few days ago was to store all cache files on the sdcard. I am not sure that this is the reason but it could be.
Does anyone here have any idea why it happened?
install Rings Extended from the market. Open your soundsettings with the program. It will prompt to open with rings extended or standard.
Don't know about the read-only stuff, but you could take a look at the ownership and the rights you have as a user/admin... if all fails.. format?
thanks for the advice, I will try it...
does anyone have more ideas regarding the read only issue?
yes could this be your problem too http://forum.xda-developers.com/showthread.php?t=473256
unfortunately its not the same issue, I have root access to the phone and when I run the mount command this is the output I have for /sdcard
/dev/block/mmcblk0p1 on /sdcard type vfat (ro,dirsync,nosuid,nodev,noexec,uid=1000,gid=1000,fmask=0711,dmask=0700,codepage=cp437,iocharset=iso8859-1,utf8)
I can't use the camera and the ringtones because of that.
I do able to remount the /sdcard as rw but any time I reboot the phone it become ro.
can you please copy for me the output that you have from mount command on /sdcard/ and the permissions you have on that directory from ls -l command?
zrubi said:
unfortunately its not the same issue, I have root access to the phone and when I run the mount command this is the output I have for /sdcard
/dev/block/mmcblk0p1 on /sdcard type vfat (ro,dirsync,nosuid,nodev,noexec,uid=1000,gid=1000,fmask=0711,dmask=0700,codepage=cp437,iocharset=iso8859-1,utf8)
I can't use the camera and the ringtones because of that.
I do able to remount the /sdcard as rw but any time I reboot the phone it become ro.
can you please copy for me the output that you have from mount command on /sdcard/ and the permissions you have on that directory from ls -l command?
Click to expand...
Click to collapse
I suspect the fat partition on your sdcard got corrupted. Try a reformat
you were right thanks
I did chkdisk from windows and it did fix the fs.
now its working just fine...

[Q] How to have write permission in some file in /system???

My captivate is already rooted, i use the Astro app to edit files and now im trying to edit the /system/etc/gps.conf, but when i try to save...does not save...i notice this file is read only rights. How can i edit that and save it???
to mount /system as read write, you need to be rooted (obviously) and open up an adb shell.
mount -o rw /dev/block/stl9 /system
depending on what kernel you're running and what filesystem /system is mounted as you *may* need to specify the filesystem ("-t vfat" for rfs, "-t ext4" for voodoo) but I've never had to before.

Idea for creating extra storage space

I have a good 2 GB of space that I am unlikely to use on the /data partition. So I created an 'sdcard' directory in there. What I'm trying to do is trick the system into believing that it's a second SD card. Can android support more than one? It's all good getting the directory to work as a secondary storage place, but the problem is, media scanner will not show pictures/music that are in that directory.
So my question is, is it possible to edit the ramdisk (init.rc) or vold.fstab etc or any other files, so the system is tricked into believing it's an actual storage card? I have tried making symlinks and doing directory bindings from /data/sdcard to /storage/sdcard1, but haven't had any luck.
Edit:
something like this maybe in init.rc??
symlink /storage/sdcard /sdcard
symlink /storage/sdcard1 /data/sdcard
export EXTERNAL_STORAGE /storage/sdcard
export SECONDARY_STORAGE /storage/sdcard1
I'm sure something is possible.
The nicest thing would be to have vold bind-mount a directory or loop-mount a filesystem image, but I'm not sure vold can do that at all and if it can I don't know what the syntax for that would be.
This would probably be a bit different between sense and aosp as it looks like vold is different.
You can easily bind-mount it yourself.
Either way, if you want to mount it on (say) /sdcard2 or anywhere on the root file system, you have to edit the ramdisk in the boot image.
But you can also mount it on top of /sdcard
mkdir /data/extra_sd
mkdir /sdcard/extra_sd
busybox mount --bind /data/extra_sd /sdcard/extra_sd
( ^^^-- I found that /system/bin/mount doesn't do --bind or -o loop and that busybox mount does.)
I tried this and it works. I have not yet experimented with putting it in an init.d script or so to mount it on boot and see if mediascanner scans it.
However, using this method you may corrupt stuff when you USB-mount your sdcard onto your PC. I'm not sure.
-Jobo
I've actually been trying numerous ways of mount bind all day. From init.d to repacking kernels with adjusted init.rc. Nothing worked.
The only way that works is using ScriptManager to run a busybox mount -o bind command at startup. It binds a subfolder in /sdcard/music to /data/media, where I've offloaded 1.5 GB of my music. I've rebooted many times and it seems to mount on time before messing up the media storage, and now I have 1.5 G extra SD space
Well, you could try "partitioning" the phone with LVM.
Which would actually be really interesting. I've got an extra gig of space in each of /system and /data that I'm not using. Being able to span that with /sdcard would be handy.
Actually, with that in place, you could combine /data and /sdcard into a single large partition and then just have both directories on that.
ardax said:
Well, you could try "partitioning" the phone with LVM.
Which would actually be really interesting. I've got an extra gig of space in each of /system and /data that I'm not using. Being able to span that with /sdcard would be handy.
Actually, with that in place, you could combine /data and /sdcard into a single large partition and then just have both directories on that.
Click to expand...
Click to collapse
That would be the ideal solution, which I have been hoping since day 1 becomes available from our phone, but does it not require S-OFF?
djsubtronic said:
That would be the ideal solution, which I have been hoping since day 1 becomes available from our phone, but does it not require S-OFF?
Click to expand...
Click to collapse
I don't think it should, since it's not changing the partition layout of the internal memory itself, just globbing it together and slapping virtual volumes on top with LVM. The biggest things are making sure that the kernel has LVM support and binaries built in and that recovery can get to those LVM binaries.
Perhaps I'm wrong though.
djsubtronic said:
I've actually been trying numerous ways of mount bind all day. From init.d to repacking kernels with adjusted init.rc. Nothing worked.
The only way that works is using ScriptManager to run a busybox mount -o bind command at startup. It binds a subfolder in /sdcard/music to /data/media, where I've offloaded 1.5 GB of my music. I've rebooted many times and it seems to mount on time before messing up the media storage, and now I have 1.5 G extra SD space
Click to expand...
Click to collapse
I really like the idea using data to get some extra space.
I tried "busybox mount --bind" via console and it works. Now i will have a look at ScriptManager.
But what happens if you are installing/updating a new ROM. Do you lose all your things located in /data?
regards
If you format /data then yes, obviously. You are only creating a "shortcut" to /data/folder.
Also, if you run out of space in /data/app/ you can move apps to /system/app instead.
I did that on my blade with a way too big /system/ partition and way too small /data/ partition
djsubtronic said:
I've actually been trying numerous ways of mount bind all day. From init.d to repacking kernels with adjusted init.rc. Nothing worked.
The only way that works is using ScriptManager to run a busybox mount -o bind command at startup. It binds a subfolder in /sdcard/music to /data/media, where I've offloaded 1.5 GB of my music. I've rebooted many times and it seems to mount on time before messing up the media storage, and now I have 1.5 G extra SD space
Click to expand...
Click to collapse
Could I get a hold of that script by chance?
Daiskei said:
Could I get a hold of that script by chance?
Click to expand...
Click to collapse
+1. Yes, please share.
One S | Xparent Blue Tapatalk 2 | Viper 1.2.1 | Bricked Beastmode
So updating a ROM without formating data partition should be no problem.
But for installing a new ROM i have to backup the folder in the data partition.
I tried to use ScriptManager, but this app seems to be bit overloaded.
After this i installed GScriptsLite.
In there i made a new script with something like this:
busybox mount --bind /data/myfolder /sdcard/myfolder
The script is not started automatically after a reboot, but after running the script via GScriptsLite the folder is mounted.
Yeah I suppose it could be difficult if changing ROMs, but I use CM only so I never worry about changing the data partition. But if I do, I just copy the /data/media folder onto my PC using adb pull, then do the wiping/flashing, and finally push the media folder back before booting the ROM.
As for the script, it's essentially just this one line:
Code:
busybox mount -o bind /data/media /storage/sdcard0/Music/Music2
I've kept the script file itself on the /data partition as well. In script manager I've set it to run the script as SU and on boot, and that's it. I've mounted it into a sub folder within Music since I use PlayerPro and it only adds music found within /sdcard/Music.
Yes, ScriptManager is a lot more complicated than GScripts, but it always mounts it automatically on boot so saves the hassle of having to remember to manually run the script if you ever reboot. Plus you only have to sort it out once then never open the app again if you don't want to

/system remounting as RO after explicit RW mount

I have used the adb shell to mount my system partition as RW (mount -o remount,rw /system) but it appears to revert to RO. I can't tell exactly why.
I wish to move app updates to /system.
I have used CF Auto Root to root the device.
I installed Titanium Backup Pro.
I have set the app mode to AUTO/indirect as recommended for Samsung devices.
I select Integrate updates to system ROM (or similar, I don't have the screen in front of me). As soon as I do this, the /system partition is remounted as read only (cat /proc/mounts | grep system)
TB just seems to hang. The Gmail base.apk has been copied to /system/apps and the com.google.android.gm-1 folder has been removed from /data/app.
If I don't mount /system as RW the same thing happens.
If I manually copy the app data from /data/app to /system/app and set the permissions the app still fails to function.
Does anyone have any ideas why this is happening?
EDIT:
I cannot load apks via adb - I am told I have a RO file system, even though I can clearly see the /system partition is mounted.

Categories

Resources