主机服务器:FreeNAS-9.10(FreeBSD 10.3-STABLE)
为了备份的目的,我安装了一个监狱,在监狱内安装FreeNAS主机的备份文件系统。
使用borgbackup备份到远程服务器正在工作。
作为根和非特权用户,在监狱内,我无法:
(1)通过sshfs挂载远程文件系统:
$ sshfs remote_user@remote_host:remote_dir /mnt/restore
(2)使用borg mount来挂载档案:
$ borg mount \ --show-rc \ remote_user@remote_host:repo::archive /mnt/restore
(1)和(2)都失败:
mount_fusefs: /dev/fuse on /mnt/restore: Operation not permitted fuse: failed to mount file system: No such file or directory
即使运行命令的用户拥有/ mnt / restore也是如此
更多信息:
$ ls -la /dev/fuse crw-rw---- 1 root operator 0xc5 May 11 11:22 /dev/fuse $ id backup uid=1001(backup) gid=1001(backup) groups=1001(backup),5(operator) $ kldstat | grep fuse 32 1 0xffffffff821c9000 de7a fuse.ko $ sysctl -a | grep fuse vfs.fuse.kernelabi_minor: 8 vfs.fuse.kernelabi_major: 7 vfs.fuse.reclaim_revoked: 0 vfs.fuse.lookup_cache_enable: 1 vfs.fuse.lookup_cache_misses: 0 vfs.fuse.lookup_cache_hits: 0 vfs.fuse.sync_unmount: 1 vfs.fuse.enforce_dev_perms: 0 vfs.fuse.init_backgrounded: 1 vfs.fuse.filehandle_count: 0 vfs.fuse.iov_credit: 16 vfs.fuse.iov_permanent_bufsize: 524288 vfs.fuse.ticket_count: 0 vfs.fuse.version: 0.4.4 vfs.fuse.fix_broken_io: 0 vfs.fuse.sync_resize: 1 vfs.fuse.refresh_size: 0 vfs.fuse.mmap_enable: 1 vfs.fuse.data_cache_invalidate: 0 vfs.fuse.data_cache_enable: 1 vfs.fuse.node_count: 0 $ sysctl vfs.usermount vfs.usermount: 1
我将不胜感激任何build议如何解决这个问题。 让我知道是否有任何细节缺失,以帮助诊断。 谢谢。
简短的回答是否定的,你不能在监狱里挂载sshfs。 SSHFS基于FuseFS,FuseFS不是一个对监狱友好的文件系统。 请从jail命令的man page下面阅读 。
除非文件系统被标记为jail-friendly,jail的allow.mount参数被设置,并且jail的enforce_statfs参数小于2,否则不可能在jail中挂载(8)或者umount(8)任何文件系统。
您可以使用lsvfs命令检查文件系统标志。 在FreeNAS上输出如下。
root@freenas:~ # lsvfs Filesystem Num Refs Flags -------------------------------- ---------- ----- --------------- nfs 0x0000003a 0 network msdosfs 0x00000032 0 nullfs 0x00000029 1 loopback, jail cd9660 0x000000bd 0 read-only procfs 0x00000002 1 synthetic, jail unionfs 0x00000041 0 loopback ufs 0x00000035 0 zfs 0x000000de 11 jail, delegated-administration devfs 0x00000071 3 synthetic, jail tmpfs 0x00000087 3 jail fdescfs 0x00000059 1 synthetic, jail fusefs 0x000000ed 0 synthetic
正如你所看到的,fusefs没有监狱的旗帜。 所以freebsd并不认为fusefs是一个对jail友好的文件系统。
在这种情况下,唯一的方法是将sshfs端点挂载到主机,而不是监狱。 就你而言,这不是FreeNAS的build议选项。 也许你可以考虑VM或Docker选项。 (FreeNAS Corral或FreeNAS 11)。
如果你想挂载其他的jail友好的文件系统,你必须把下面的sysctl添加到jail选项,并把security.jail.enforce_statfs=1或者security.jail.enforce_statfs=0到全局的sysctls中。
allow.mount=true,allow.mount.nullfs=true,allow.mount...