Linux 如果使用保险丝挂载到非空挂载点会发生什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20271101/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 01:29:37  来源:igfitidea点击:

What happens if you mount to a non-empty mount point with fuse?

linuxfuse

提问by bernie2436

I am new to fuse. When I try to run a FUSE client program I get this error:

我是新来的保险丝。当我尝试运行 FUSE 客户端程序时,出现此错误:

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

I understand that a mountpoint is the directory where you will logically attach the FUSE filesystem. What will happen if I mount to this location? What are the dangers? Is it just that the directory will be overwritten? Basically: what will happen if you mount to a non empty directory?

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

回答by hek2mgl

You need to make sure that the files on the device mounted by fuse will nothave the same paths and file names as files which already existing in the nonempty mountpoint. Otherwise this would lead to confusion. If you are sure, pass -o nonemptyto the mount command.

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

You can try what is happening using the following commands.. (Linux rocks!) .. without destroying anything..

您可以使用以下命令尝试正在发生的事情..(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

回答by DaJF

Apparently nothing happens, it fails in a non-destructive way and gives you a warning.

I've had this happen as well very recently. One way you can solve this is by moving all the files in the non-empty mount point to somewhere else, e.g.:

显然什么也没发生,它以非破坏性的方式失败并给你一个警告。

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

mv /nonEmptyMountPoint/* ~/Desktop/mountPointDump/

This way your mount point is now empty, and your mountcommand will work.

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

回答by Vaseem007

Just add -o nonemptyin command line, like this:

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

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

回答by vipul kapoor

force it with -l

用 -l 强制它

    sudo umount -l ${HOME}/mount_dir