[FIXED] full r/w access via overlay filesystem

Search This thread

antweb

Member
Jan 26, 2010
24
0
Hey guys!

Together with some others at android-hilfe.de I'm working on an overlay filesystem for the Desire.
We've chosen aufs (Another Unionfs) to implement our idea.

Basically, two filesystems are combined to a single one.
The first filesystem contains the initial data. The second one is used to overlap it.
Aufs first searches the second for files, then the first. We plan to use a fully writeable filesystem for the second and a secured filesystem for the first.
If you want to modify a file on the first partition, you can put it on the second filesystem and change it there.
So we can get indirect write access to the secured filesystem by mounting the aufs partition to the right path so that the system sees it as the original, secured filesystem.

In theory, a full r/w acces to the all partions on the phone could be possible.

Visit the project site for files and instructions.
 
Last edited:

Beaverman20

Senior Member
Jul 29, 2010
224
5
that is actually a pretty good idea... and would be awesome if it could be implemented ;) i have no experience in android development and would therefore not be at much help there, but i could help you with testing, as i don't use my phone for any important stuff :D
 

billias

Senior Member
Nov 28, 2008
81
2
Hey guys!

Together with some guys at android-hilfe.de I'm working on an overlay filesystem for the Desire.
We've chosen aufs (Another Unionfs) to implement our idea.
.......
We still could use some help, as for now we are only 2 active developers.

Nice thought. Wish i could help :(
 

daveba

Senior Member
Mar 4, 2010
398
61
Dubai
Great idea, and it seems it should work and will obviate the need for a eng-SPL.

Have you tried it ? You seem to have all the necessary bits (you don't really need the utils) so i'm not sure what else you need at this point. This should work with adb in normal mode (ie not recovery) as you should be able to remount the system ontop of itself like so:

adb shell

first to get to your desire root shell. Then do

insmod aufs2

Then create some persistent storage on your sdcard

mkdir /sdcard/sysrw

Then mount the dir

mount -t aufs -o br=/sdcard/sysrw=rw:/system=ro none /system

you should now be able to write to /system, so try doing a

touch /system/foo

If that works, you should be away.

Clearly your modules you provide above will be specific to a certain kernel and with so many ROMS out there i can't say it will work with the one i have so you can try and report back.

Putting the persistent storage on the sdcard means that when it is mounted via usb you will loose access to it and bad things will happen.

Also remember if this works you need to add this to your init scripts
 
Last edited:

antweb

Member
Jan 26, 2010
24
0
mount -t aufs -o br=/sdcard/sysrw=rw:/system=ro none /system

This step fails. All I get is
Code:
mount: No such Device

Clearly your modules you provide above will be specific to a certain kernel and with so many ROMS out there i can't say it will work with the one i have so you can try and report back.

Every ROM (with a custom kernel) will need some kernel patches anyways as otherwise many simbols are missing (and sure some other stuff, no clue what the aufs kernel patches do in detail). The attachements include a patched stock kernel. To try it out, you'll have to install the included kernel.

Also remember if this works you need to add this to your init scripts

Yep, thats the next step after I get a successful mount.
 

billias

Senior Member
Nov 28, 2008
81
2
My basic question:

If we use more and more the SD card, i believe we will drain more and more battery.
Apps2sd, system2sd etc

Or it is not draining more battery the extended sd usage?
 

daveba

Senior Member
Mar 4, 2010
398
61
Dubai
My basic question:

If we use more and more the SD card, i believe we will drain more and more battery.
Apps2sd, system2sd etc

Or it is not draining more battery the extended sd usage?

Not much stuff gets written to /system constantly. Just a few changes so you shouldn't see much of a drain.
 

daveba

Senior Member
Mar 4, 2010
398
61
Dubai
Ok, so it looks like this actually works. You can't put the rw partition on a VFAT sdcard partiton only. SO in theory if you make a ext{123} partition on your sdcard it should work. For now i tried with the writeable mtd /data partition on my CM nightly and all works. Look:

Code:
adb shell
modprobe aufs
lsmod (to check aufs worked)
mkdir /data/rw
mount -t aufs -o  br=/data/rw=rw:/system=ro none /system
(no errors here)
touch /system/foo (YES IT WORKED)
ls -l /system/foo 
-rw-rw-rw-    1 root     root             0 Aug  8 20:30 /system/foo

A writeable /system !!!
And here is the real data on /data/rw

Code:
 ls -l /data/rw/
-rw-rw-rw-    1 root     root             0 Aug  8 20:30 foo

In theory Metamorph, adblock and all the rest that require /system should now work as expected.
 

Nekromantik

Senior Member
Apr 1, 2010
7,055
1,032
London
Google Pixel 7 Pro
Google Pixel Watch
Ok, so it looks like this actually works. You can't put the rw partition on a VFAT sdcard partiton only. SO in theory if you make a ext{123} partition on your sdcard it should work. For now i tried with the writeable mtd /data partition on my CM nightly and all works. Look:

Code:
adb shell
modprobe aufs
lsmod (to check aufs worked)
mkdir /data/rw
mount -t aufs -o  br=/data/rw=rw:/system=ro none /system
(no errors here)
touch /system/foo (YES IT WORKED)
ls -l /system/foo 
-rw-rw-rw-    1 root     root             0 Aug  8 20:30 /system/foo

A writeable /system !!!
And here is the real data on /data/rw

Code:
 ls -l /data/rw/
-rw-rw-rw-    1 root     root             0 Aug  8 20:30 foo

In theory Metamorph, adblock and all the rest that require /system should now work as expected.

could you try metamorph?
 

cTrox

Senior Member
Apr 19, 2010
571
174
Nice work!! :O

Edit: Ok I tried this but metamorph still gives me an error when trying to set it up.

Code:
adb shell
modprobe aufs
lsmod (to check aufs worked)
mkdir /data/rw
mount -t aufs -o  br=/data/rw=rw:/system=ro none /system
(no errors here)
touch /system/foo (YES IT WORKED)
ls -l /system/foo 
-rw-rw-rw-    1 root     root             0 Aug  8 20:30 /system/foo
 
Last edited:

daveba

Senior Member
Mar 4, 2010
398
61
Dubai
Oh I just saw, that metamorph is giving me an error because I havn't got enough free space in /system. How much do I need? I have 20MB free.

Where did you put the writeable partition on ? Ensure it has enough space. I'm not sure exactly what checks metamorph does when it runs but it definetly succeeded for me.
 

daveba

Senior Member
Mar 4, 2010
398
61
Dubai
+1 I'm very interested on this :D

It's exactly as i wrote in the previous page.

You'll need to ROM to have the aufs overlay 'filesystem' built in or as a module. If you're on CM6 you're lucky as it has it builtin (i was suprised it loaded when i did the modprobe myself as i didn't think it was included).

You should see a aufs.ko if it's built in as a module. Try running a jar/grep on your ROM of choice to see if it's included

Code:
 jar tvf RoufianosV6.zip |grep aufs
gives no output, but
Code:
jar tvf cm_bravo-08082010-104323.zip |grep aufs
169400 Fri Feb 29 02:33:46 GST 2008 system/lib/modules/2.6.34.2-cyanogenmod/kernel/fs/aufs/aufs.ko
does.

You can do the steps described earlier (via adb) when your desire is fully booted as it doesn't require it at recovery only.

This needs to be pushed out to rom creators as it needs to be included in the startup scripts or else the next time you reboot your desire you'll lose all changes you made while the overlay was active.
 
Last edited:

cTrox

Senior Member
Apr 19, 2010
571
174
This needs to be pushed out to rom creators as it needs to be included in the startup scripts or else the next time you reboot your desire you'll lose all changes you made while the overlay was active.

Oh that's why it didn't work I thought I might have to reboot the device to get access :D
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Hi all ;)

    Try several time but can't remount the system :/

    I run my personal rom with kernel 2.6.35.6 (with aufs 2.1)

    the log

    Code:
    Filesystem           1K-blocks      Used Available Use% Mounted on
    tmpfs                   208080        12    208068   0% /dev
    tmpfs                   208080         0    208080   0% /mnt/asec
    /dev/block/mtdblock3    256000    117992    138008  46% /system
    /dev/block/mtdblock5    151168     13112    138056   9% /data
    /dev/block/mtdblock4     40960      1260     39700   3% /cache
    /dev/block/mmcblk0p2    703028    101853    563667  15% /sd-ext
    /dev/block/mmcblk0p1   7018488   6647016    371472  95% /mnt/sdcard
    ------------------------
    rootfs on / type rootfs (ro,relatime)
    tmpfs on /dev type tmpfs (rw,relatime,mode=755)
    devpts on /dev/pts type devpts (rw,relatime,mode=600)
    proc on /proc type proc (rw,relatime)
    sysfs on /sys type sysfs (rw,relatime)
    tmpfs on /mnt/asec type tmpfs (rw,relatime,mode=755,gid=1000)
    /dev/block/mtdblock3 on /system type yaffs2 (ro,relatime)
    /dev/block/mtdblock5 on /data type yaffs2 (rw,nosuid,nodev,relatime)
    /dev/block/mtdblock4 on /cache type yaffs2 (rw,nosuid,nodev,relatime)
    /sys/kernel/debug on /sys/kernel/debug type debugfs (rw,relatime)
    /dev/block/mmcblk0p2 on /sd-ext type ext2 (rw,noatime,nodiratime,barrier=1,data=ordered)
    /dev/block/mmcblk0p1 on /mnt/sdcard type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
    ------------------------
    /sbin:/system/sbin:/system/bin:/system/xbin:/data/local/sysro/xbin
    /system/etc/init.d/02aufssetup: /sysro/xbin/busybox: not found
    /system/etc/init.d/02aufssetup: /data/local/sysro/xbin/busybox: not found
    /system/etc/init.d/02aufssetup: /system/xbin/busybox: not found
    ------------------------

    Thx for any help ... :)

    Clearly you can't find the busybox binary in your ROM. Install it and all should be fine.

    However no one should use this method anymore since SPL-OFF is now available for the Desire - both CDMA and GSM. So this method is no longer recommended.