使用FUSE时,如何在挂载点挂载所有现有目录?

时间:2022-02-11 23:15:16

I'm trying to build a new filesystem with deduplication using FUSE.

我正在尝试使用FUSE构建一个带重复数据删除的新文件系统。

I tried running the fusexmp_fh.c provided in the example section of the FUSE. However after mounting the filesystem at a mount point, I can see all the existing directories inside the mount point. I dont need those directories. I want the mounted filesystem to be empty.

我尝试运行FUSE示例部分提供的fusexmp_fh.c.但是在将文件系统挂载到挂载点之后,我可以看到挂载点内的所有现有目录。我不需要那些目录。我希望挂载的文件系统为空。

I tried searching through fusexmp_fh.c but could not find out where the existing directories get added.

我尝试搜索fusexmp_fh.c,但无法找到现有目录的添加位置。

  • Can someone explain to me how this works?
  • 有人可以向我解释这是如何工作的吗?

Also

  • can fusexmp_fh.c be taken as a base for building the filesystem?
  • fusexmp_fh.c可以作为构建文件系统的基础吗?
  • Does it have all the basic functionalities?
  • 它是否具有所有基本功能?

1 个解决方案

#1


1  

Are you saying that you mounted the file system over a non-empty directory, and you can see the previous contents of the directory? (In which case, the answer is "don't mount to a non-empty mount point". Usually it throws an error to tell you not to do that.)

您是说您将文件系统挂载在非空目录上,您可以看到该目录的先前内容吗? (在这种情况下,答案是“不要挂载到非空挂载点”。通常会抛出错误告诉您不要这样做。)

If what you're seeing is the directories and files in the directory that you are using as your base directory, that's the normal behavior for a loopback file system, which is what fusexmp_fh.c is. The example file system takes a mount point, and passes all commands on that mount point through to a backing directory. If you use a backing directory that has files in it, you will now see those files in two places, the original location and the mounted fuse directory.

如果您所看到的是您用作基本目录的目录中的目录和文件,那么这是回送文件系统的正常行为,这就是fusexmp_fh.c。示例文件系统采用挂载点,并将该挂载点上的所有命令传递到后备目录。如果您使用其中包含文件的后备目录,您现在将在两个位置看到这些文件,即原始位置和已安装的fuse目录。

If you want to understand how the directory filling works, start by taking a look at readdir, and see how the stat items that it returns are constructed. Each of those is a single directory entry.

如果你想了解目录填充的工作原理,首先看看readdir,看看它返回的统计项是如何构建的。每个都是一个目录条目。

Yes, you can use fusexmp_fh.c as the basis for a basic file system, it's got all the necessary pieces, although extended metadata isn't supported. (But adding it is fairly trivial for a loopback.)

是的,你可以使用fusexmp_fh.c作为基本文件系统的基础,虽然不支持扩展元数据,但它有所有必要的部分。 (但是对于环回来说,添加它是相当简单的。)

#1


1  

Are you saying that you mounted the file system over a non-empty directory, and you can see the previous contents of the directory? (In which case, the answer is "don't mount to a non-empty mount point". Usually it throws an error to tell you not to do that.)

您是说您将文件系统挂载在非空目录上,您可以看到该目录的先前内容吗? (在这种情况下,答案是“不要挂载到非空挂载点”。通常会抛出错误告诉您不要这样做。)

If what you're seeing is the directories and files in the directory that you are using as your base directory, that's the normal behavior for a loopback file system, which is what fusexmp_fh.c is. The example file system takes a mount point, and passes all commands on that mount point through to a backing directory. If you use a backing directory that has files in it, you will now see those files in two places, the original location and the mounted fuse directory.

如果您所看到的是您用作基本目录的目录中的目录和文件,那么这是回送文件系统的正常行为,这就是fusexmp_fh.c。示例文件系统采用挂载点,并将该挂载点上的所有命令传递到后备目录。如果您使用其中包含文件的后备目录,您现在将在两个位置看到这些文件,即原始位置和已安装的fuse目录。

If you want to understand how the directory filling works, start by taking a look at readdir, and see how the stat items that it returns are constructed. Each of those is a single directory entry.

如果你想了解目录填充的工作原理,首先看看readdir,看看它返回的统计项是如何构建的。每个都是一个目录条目。

Yes, you can use fusexmp_fh.c as the basis for a basic file system, it's got all the necessary pieces, although extended metadata isn't supported. (But adding it is fairly trivial for a loopback.)

是的,你可以使用fusexmp_fh.c作为基本文件系统的基础,虽然不支持扩展元数据,但它有所有必要的部分。 (但是对于环回来说,添加它是相当简单的。)