简体   繁体   English

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

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

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.我知道挂载点是您将在逻辑上附加 FUSE 文件系统的目录。 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?基本上:如果挂载到非空目录会发生什么?

You need to make sure that the files on the device mounted by fuse will not have the same paths and file names as files which already existing in the nonempty mountpoint.您需要确保通过fuse 挂载的设备上的文件不会与非空挂载点中已存在的文件具有相同的路径和文件名。 Otherwise this would lead to confusion.否则这会导致混乱。 If you are sure, pass -o nonempty to the mount command.如果您确定,请将-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

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

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

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, eg:解决此问题的一种方法是将非空挂载点中的所有文件移动到其他地方,例如:

mv /nonEmptyMountPoint/* ~/Desktop/mountPointDump/

This way your mount point is now empty, and your mount command will work.这样您的挂载点现在是空的,您的mount命令将起作用。

For me the error message goes away if I unmount the old mount before mounting it again:对我来说,如果我在重新安装之前卸载旧安装,错误消息就会消失:

fusermount -u /mnt/point

If it's not already mounted you get a non-critical error:如果尚未安装,则会出现非严重错误:

$ fusermount -u /mnt/point

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

So in my script I just put unmount it before mounting it.所以在我的脚本中,我只是在安装它之前卸载它。

用 -l 强制它

    sudo umount -l ${HOME}/mount_dir

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM