【问题标题】:What happens if you mount to a non-empty mount point with fuse?如果您使用保险丝安装到非空安装点会发生什么?
【发布时间】:2013-12-14 18:50:23
【问题描述】:

我是新手。当我尝试运行 FUSE 客户端程序时,我收到此错误:

fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' mount option

我了解挂载点是您将逻辑附加到 FUSE 文件系统的目录。如果我安装到这个位置会发生什么?有什么危险?只是目录会被覆盖吗?基本上:如果挂载到非空目录会发生什么?

【问题讨论】:

  • 这发生在我身上。我注意到我在尝试挂​​载的目录下错误地保存了一些文件。我刚刚删除了它们,一切又好了。

标签: linux fuse


【解决方案1】:

您需要确保通过 fuse 挂载的设备上的文件不与非空挂载点中已经存在的文件具有相同的路径和文件名。否则这会导致混乱。如果您确定,请将 -o nonempty 传递给 mount 命令。

您可以使用以下命令尝试正在发生的事情..(Linux 摇滚!).. 不破坏任何东西..

// create 10 MB file 
dd if=/dev/zero of=partition bs=1024 count=10240

// create loopdevice from that file
sudo losetup /dev/loop0 ./partition

// create  filesystem on it
sudo e2mkfs.ext3 /dev/loop0

// mount the partition to temporary folder and create a file
mkdir test
sudo mount -o loop /dev/loop0 test
echo "bar" | sudo tee test/foo

# unmount the device
sudo umount /dev/loop0

# create the file again
echo "bar2" > test/foo

# now mount the device (having file with same name on it) 
# and see what happens
sudo mount -o loop /dev/loop0 test

【讨论】:

  • mount 命令是这个意思吗? FUSE(FuseHandler(a), b, foreground=True) 我是否在该调用中添加 -o nonempty?
  • 你是用命令行工具还是编程语言来控制fuse?
  • 我正在调用一个导入pyfuse的python文件
  • 但是,您可以尝试我列出的步骤,以查看挂载时是否存在具有相同名称的文件的情况......然后玩玩。最后,我认为如果您使用 fuse 或 regular 安装,这没有什么区别......而且在使用编程语言时也应该没有区别.. 最便携和最安全的方式将仍然是:“装入空文件夹”
  • @patryk.beza 那是因为重定向> test/foo 将由当前shell 执行,并具有执行脚本的用户的权限,而不是sudo。您可以改用tee:echo "bar" | sudo tee test/foo。 PS:感谢您发现这个问题!
【解决方案2】:

显然没有任何反应,它以非破坏性方式失败并给你一个警告。

我最近也发生过这种情况。解决此问题的一种方法是将非空挂载点中的所有文件移动到其他位置,例如:

mv /nonEmptyMountPoint/* ~/Desktop/mountPointDump/

这样你的挂载点现在是空的,你的mount 命令将起作用。

【讨论】:

  • 唯一真正回答原始问题的答案!
【解决方案3】:

只需在命令行中添加-o nonempty,如下所示:

s3fs -o nonempty  <bucket-name> </mount/point/>

【讨论】:

  • 挂载非空目录后如何将数据从 droplet 同步到 Space 对象?
【解决方案4】:

用 -l 强制它

    sudo umount -l ${HOME}/mount_dir

【讨论】:

  • 解释一下它的作用以及为什么你推荐它而不是以前的答案提出的方法会很有用。
【解决方案5】:

对我来说,如果我在重新安装之前卸载旧的安装,错误消息就会消失:

fusermount -u /mnt/point

如果尚未安装,则会出现非严重错误:

$ fusermount -u /mnt/point

fusermount: entry for /mnt/point not found in /etc/mtab

所以在我的脚本中,我只是在安装它之前先卸载它。

【讨论】:

    【解决方案6】:

    只需在 /etc/fstab 中将“非空”设置为可选值

    例如:

    ## mount a bucket
    /usr/local/bin/s3fs#{your_bucket_name}  {local_mounted_dir}  fuse _netdev,url={your_bucket_endpoint_url},allow_other,nonempty 0 0
     
    ## mount a sub-directory of bucket, Do like this:
    /usr/local/bin/s3fs#{your_bucket_name}:{sub_dir}  {local_mounted_dir}  fuse _netdev,url={your_bucket_endpoint_url},allow_other,nonempty 0 0
     
    

    【讨论】:

      猜你喜欢
      • 2017-03-24
      • 1970-01-01
      • 2019-08-25
      • 2014-07-28
      • 2019-06-09
      • 1970-01-01
      • 1970-01-01
      • 2019-05-25
      • 2013-06-05
      相关资源
      最近更新 更多