14

Can I write a custom userspace file system that can be run on non-rooted factory devices through the standard available utilities?

I am aware of the existence of fuse-android, however as far as I have understood, it requires a rooted device. If that is not the case, please do correct me.

The goal I am trying to achieve is create a 'fake' FS that actually is mounted to a file.

tshepang
  • 12,111
  • 21
  • 91
  • 136
K.Steff
  • 2,164
  • 3
  • 19
  • 25

3 Answers3

15

I had the same need some time ago and came to the point where I had to admit that's not possible at all (mostly). It shouldn't be a problem to build libfuse for android, also the Java wrapper is no problem.

The real problem is that most of the systems I have seen aren't build with fuse support buildin nor do they provide modules which may be loaded (which would require root, but anyway).

You can easily find out if fuse is enabled by reading /proc/filesystems. It should list fuse, otherwise you will need root. But it's very likely that most android devices are build without fuse support.

My other ideas were to use another filesystem to "fake" something like fuse. This may be possible with nfs or some other network filesystem where you can implement the server by yourself. This whould enable you to write a fake fuse but I don't think it's worth it.

Edit: And even if many devices would have fuse support buildin chances are high they wouldn't let you mount it as a user, you would need root access as your app wouldn't have the privileges to mount fuse filesystems.

Luminger
  • 2,144
  • 15
  • 22
  • 1
    Thanks, that is *exactly* the answer I needed. Bounty well spent :) – K.Steff Feb 15 '12 at 13:20
  • i encounter the same problem.But anyway,i think i can make it if i overcome the following problems.1:make the android kernel capable of loading the kernel module(i've done it)2:cross-compile the fuse project(i've done it)3:modprobe the fuse.ko into the android kernel(because i have no idea where the ko switchs to in the fuse 2.9.0,i stop here).So,anyone can help me throgh?here is the detail of the problem:http://stackoverflow.com/questions/10477309/what-substitute-the-fuse-ko-as-the-kernel-modlue-in-fuse-2-9 – kaiwii ho May 07 '12 at 07:16
  • well check out apps like Web Drive or Wuala. They are able to mount on Android and iOS without root. Anyone has an idea on how they do this? – Kimutai Aug 11 '15 at 08:51
  • @Bryan Kim: are you sure they create a virtual file system ? they may well just use a regular folder and monitor it for changes... – acapola Sep 04 '15 at 15:41
  • @acapola I actually realized that they don't actually mount. because they don't appear as extra "SD Cards", and I can't actually browse them using my file managers. – Kimutai Sep 04 '15 at 19:32
2

Luminger almost has the right idea. Here's what I found on my Galaxy S3 (on Verizon):

The appropriate fuse stuff does exist in /proc/filesystems. So something must be using it, quite possibly system. However, when I attempt to execute 'fusermount', I get "Cannot execute -- Permission denied."

So it looks like all the FUSE stuff is there, but I've got no idea whether I could actually use it directly (dropbox? sshfs?) without rooting the device.

1

It depends on your implementation. What it sounds like to me is you want to have a physical file(s) that represent a full user space file system. Perhaps similar to a mounted .iso. If this is the case, I cannot think of any reason for needing root: You simply create/install the file somewhere such as /sdcard/ and "mount" your file system on top of it.

That said, if you want said file system to be accessible from other applications that you do not control, you'll need root as your application will be running in a Android sandbox otherwise.

NuSkooler
  • 5,391
  • 1
  • 34
  • 58
  • Ok, so if I want to have other apps access it too and to have it shown in the general file system tree, there's no way, right? – K.Steff Feb 14 '12 at 21:19
  • No way that I know of without root, no. – NuSkooler Feb 14 '12 at 23:53
  • @NuSkooler I need to have a file mounted as a filesystem just for my application, not for others. How is it possible? You seem to know something about this partial achievement that would be enough for me. Please, any suggestion or advice from you is highly appreciated. Thanks in advance – P5music May 28 '12 at 09:45
  • @P5music Without knowing more details on your goals it's hard to say. Perhaps something like https://code.google.com/p/whefs/wiki/HomePage. – NuSkooler May 28 '12 at 19:58
  • @NuSkooler Thank you. I think that library does not mount any filesystem. I need that a Zip file is seen as a mounted folder so that Java methods that want a path (file:////path/file.ext) can be feeded. For example if I have a Zip file containing an HTML file and its images folder I want that the WebView is able to load the HTML file and then the images in it (which have src='images/image.jpg' as attribute). – P5music May 29 '12 at 07:46
  • @P5music The linked library allows you to interact with a virtual file system that are all stored in one physical file (or memory). If you're looking to use a persistent zip file with WebView I suggest you open a question for that specifically. – NuSkooler May 29 '12 at 17:34
  • @P5music were you able to figure out how to do this? I have a similar requirement, where I want to have WebView render html + resources inside .zip file. – Super-intelligent Shade Dec 22 '19 at 22:49
  • 1
    @Innocent Bystander No problem achieving that by simply overriding some WebView or/and WebClient methods. It's all about loading HTML as data and then also intercepting resources loading. But you have to keep the zip file open in RAM because unzipping happens there I think with available Zip classes. – P5music Dec 23 '19 at 11:25