[KERNEL] fuse module & unionfs-fuse & fusecompress HTC's 2.6.32.15-gf9c0527 kernel

FloHimself

Senior Member
May 27, 2010
558
218
0
what's this for ?????
FUSE = Filesystem in USErspace: http://en.wikipedia.org/wiki/Filesystem_in_Userspace
unionfs-fuse = A userspace unionfs implementation: http://podgorny.cz/moin/UnionFsFuse

I'm using this for "overlaying" some directories and "merging" its content...

How can we use it? Any guidelines?
Load the kernel module and use the unionfs binary for mounting. More information can be found in the man page e.g. http://manpages.ubuntu.com/manpages/lucid/man8/unionfs-fuse.8.html
 

FloHimself

Senior Member
May 27, 2010
558
218
0
flo, based on your works, i am pretty sure you're an excellent DEV. mind sharing your own custom ROM you mentioned here? ;)
Thank you! My custom ROM would`t be a benefit for you. It`s mainly for development and testing. All my work is published here and is included in several ROMs already...
 

FloHimself

Senior Member
May 27, 2010
558
218
0
Updated first post with fuse-utils & fusecompress...

FuseCompress provides a mountable Linux filesystem which transparently compresses its content.

Files stored in this filesystem are compressed on the fly and FUSE allows to create a transparent interface between compressed files and user applications.

FuseCompress supports different compression methods: LZO, gzip, bzip2, and LZMA.
http://code.google.com/p/fusecompress/

Playing with a compressed /data/data partition atm...
 

FloHimself

Senior Member
May 27, 2010
558
218
0
Note to myself:

Using fusecompress on /data/data doesn`t work properly... phone working but some settings (wallpaper) doesn`t get saved... maybe some permission problems...

However, I`m using it to transparently compress /data/dalvik-cache with
Code:
fusecompress -o cache,cache_size=24 /data/dalvik-cache
in init script.

Compressed size of dalvik-cache:
Code:
# du -sh /data/dalvik-cache
10.5M	/data/dalvik-cache
Uncompressed size of dalvik-cache (copied to temp directory):
Code:
# du -sh /data/local/tmp/dalvik-cache_uncompressed
17.8M	/data/local/tmp/dalvik-cache_uncompressed
Another effect: 24mb compressed data is cached in mermory (cache_size=24)... Maybe some speed improvement?
 

FloHimself

Senior Member
May 27, 2010
558
218
0
Running it for almost a day now without problems. Only thing that scares me is that it doesn`t work on /data/data. But maybe really only some permission thingie...
 

ranwej

Senior Member
Oct 2, 2009
173
200
0
2FloHimself: Can you pls help me with mount command? I tried overlayer "/system/xbin" with "/sdcard/system/xbin", but my command doesn't work and i only see files in "/system/xbin". Here is my command:
Code:
unionfs -o cow,nonempty /sdcard/system/xbin=RW:/system/xbin=RO /sdcard/system/mountpoint
What can be wrong?
 

FloHimself

Senior Member
May 27, 2010
558
218
0
Sorry... it works this way:

Code:
mkdir /data/local/tmp/system_rw
mkdir /data/local/tmp/system_ro
mount -o bind /system/xbin /data/local/tmp/system_ro
unionfs -o cow,max_files=32768,allow_other,suid,nonempty /data/local/tmp/system_rw=rw:/data/local/tmp/system_ro=ro /system/xbin
 

ranwej

Senior Member
Oct 2, 2009
173
200
0
Sorry... it works this way:

Code:
mkdir /data/local/tmp/system_rw
mkdir /data/local/tmp/system_ro
mount -o bind /system/xbin /data/local/tmp/system_ro
unionfs -o cow,max_files=32768,allow_other,suid,nonempty /data/local/tmp/system_rw=rw:/data/local/tmp/system_ro=ro /system/xbin
Nice solution, thanks!
 

FloHimself

Senior Member
May 27, 2010
558
218
0
wow! almost 2x! will be a major disk space saver if it's stable :)
Using it for a week now without any problems so I assume it`s stable and save to use. With lzo compression the saving is about 33% on dalvik-cache. More is possible with gz/bz2/lzma compression, but read/write speed would be affected negatively. The usage is simple. First load the fuse.ko kernel module:
Code:
insmod /system/lib/modules/fuse.ko
Then mount /data/dalvik-cache with fusecompress:
Code:
fusecompress -o cache,cache_size=24 /data/dalvik-cache
That`s it. Primarily use this in some init script at startup.
 
Last edited:

worstenbrood

Senior Member
May 14, 2008
1,063
1,401
0
"full" /system access acquired with unionfs-fuse :)

Yo guys,

Got my own modded rom running with a rw /system using unionfs !

I modded the original htc boot.img (ota 2.2 2.09.405.8) ramdisk, in particular init.rc, to create a directory /sd-ext.
I modified the apps2sd script to mount/symlink everything to /sd-ext (instead of /system/sd).
Then i created a unionfs script that makes /system writable.

The trick was:

- Make sure unionfs is in /system/xbin
- Create 3 directories: /sd-ext/system_ro, /sd-ext/system_rw and /sd-ext/system_union
- busybox mount --move /system /sd-ext/system_ro, at this point we dont have acccess to /system anymore.
- /sd-ext/system_ro/xbin/unionfs -o cow,max_files=32768,allow_other,suid,nonempty /sd-ext/system_rw=RW:/sd-ext/system_ro=RO /sd-ext/system_union
- /sd-ext/system_ro/xbin/busybox mount --bind /sd-ext/system_union /system

Output of mount:
Code:
/dev/block/mmcblk0p2 /sd-ext ext3 rw,noatime,nodiratime,errors=continue,data=wri
teback 0 0
unionfs /sd-ext/system_union fuse.unionfs rw,nodev,relatime,user_id=0,group_id=0
,default_permissions,allow_other 0 0
unionfs /system fuse.unionfs rw,nodev,relatime,user_id=0,group_id=0,default_perm
issions,allow_other 0 0
Output of df (using 1 GB ext3 partition):
Code:
/system: 1193297K total, 301966K used, 891331K available (block size 1024)
Output of test:
Code:
# touch /system/w00000t
touch /system/w00000t
# ls /system/w0*
ls /system/w0*
/system/w00000t
# rm /system/w00000t
rm /system/w00000t
#
Got it running for half a day now without any issues ! :D

Checkout the attachment for the modified boot.img/scripts.
 

Attachments

Last edited: