5

So let's say I have a file attached to a loop device /dev/loop1 how could I mount that using fuse (filesystem in user space) ?

AlexandruC
  • 3,527
  • 6
  • 51
  • 80
  • This is a system administration question, not a programming question, and more properly belongs on ServerFault. Also, it would be more helpful if you provided details -- what kind of filesystem you're trying to mount, what you've tried already and how that thing failed. – Charles Duffy Jun 27 '12 at 17:46

2 Answers2

4

If you're using fuse, you don't need a loop device at all, and can directly mount the file itself. So, you can do either this:

$ sudo ext4fuse test.ext4 /mnt

Or, if for some bizarre reason you really want to use a loop device, this:

$ sudo losetup /dev/loop0 test.ext4
$ sudo ext4fuse /dev/loop0 /mnt
ypnos
  • 50,202
  • 14
  • 95
  • 141
Charles Duffy
  • 280,126
  • 43
  • 390
  • 441
  • I have fuse executable made from source. I don't use fuseext2. How can I use that let's say my fuse executable is fusexmp, the filesystem contained in the file is fat32. – AlexandruC Jul 05 '12 at 10:52
  • Are you sure the first command line is correct? It tells me `losetup: /dev/test.ext2: failed to set up loop device: No such file or directory` – Joachim Wagner Jun 24 '16 at 09:57
  • @JoachimWagner, I'm a bit miffed at my past self for lack of proofreading. Corrected and tested (and modernized a bit, moving to ext4fuse rather than fuseext2). – Charles Duffy Jun 24 '16 at 16:09
  • 1
    `losetup --read-only` is a reason for doing it in 2 steps, e.g. when you don't want any write operations, not even from re-playing a journal. – Joachim Wagner Jun 27 '16 at 09:12
  • Doesn't using `sudo` defeat the point of using `fuse`? – OrangeDog Jan 06 '23 at 15:27
  • @OrangeDog, ...some of the potential points, but not all of them (f/e, if you're mounting a suspected-corrupt filesystem and want to avoid kernel panics). It's not essential here, but more of a simplification factor; leaving it out results in changes in effective file permissions, and in potential configuration dependencies that it's easier to leave out-of-scope. – Charles Duffy Jan 06 '23 at 16:28
0

Once you set the permissions of the loop device so that the fuse process can access it, you can mount it the same way as any other device.

Joachim Wagner
  • 860
  • 7
  • 16