繁体   English   中英

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

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

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

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

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

您需要确保通过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

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

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

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

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

mv /nonEmptyMountPoint/* ~/Desktop/mountPointDump/

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

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

fusermount -u /mnt/point

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

$ fusermount -u /mnt/point

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

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

用 -l 强制它

    sudo umount -l ${HOME}/mount_dir

暂无
暂无

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

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