Linux块设备模拟与仿真保险丝
我的项目涉及通过远程主机模拟块设备。
为了进行测试,我使用 FUSE,我的文件系统是“hello”示例应用程序的简单更改,其中我不返回常量字符串,而是直接从文件读取数据。
当我尝试正常安装文件时( mount -o Loop=/dev/loop1 ),它运行良好。 当我加载保险丝并通过它公开该文件时,所有正常的文件操作都可以工作。但安装失败并显示“权限被拒绝”。
任何人都知道“权限被拒绝”来自哪里?
还有其他方法可以让我在用户空间中创建一个可安装的虚拟设备(仅支持块访问)吗?
提前致谢
My project involves simulating a block device by remote host.
For testing I am using FUSE, my file system is a simple change of the "hello" example app, where instead of returning a constant string I just read data directly from a file.
When I try to mount the file normally (mount -o loop=/dev/loop1 ) it works well.
When I load fuse and expose this file via it, all the normal file operations work. But mounting fails with "Permission denied".
Anyone has an idea where the "permission denied" is coming from ?
Any other methods to that will allow me to create a virtual device (only support block access) in users space, that will be mountable ?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
据推测,问题在于 FUSE 文件系统不支持循环挂载所需的功能。
您是否考虑过使用网络块设备,例如 NBD 或 iSCSI 目标?
Presumably the problem is that the FUSE filesystem doesn't support the features required to have loop-mounts on it.
Have you considered using a network block device instead, such as NBD or iSCSI target?
您是否以 Root 权限执行?您可以使用“strace”跟踪程序,然后检查到底哪里失败了。
Are you executing with Root permission. You can trace the program with "strace" and then check where exactly this fails.
当 mount 命令开始打印错误时,它真的很难用。尝试“-v”,但通常情况下,额外的输出不会有帮助:(
The mount command is a real hell to use when it starts to print errors. Try "-v" but more often than not, the additional output won't help :(