What happens if you mount to a non-empty mount poi

2019-02-04 09:27发布

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

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?

标签: linux fuse
3条回答
淡お忘
2楼-- · 2019-02-04 09:44

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. Otherwise this would lead to confusion. If you are sure, pass -o nonempty to the mount command.

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

// 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
sudo echo "bar" 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
查看更多
劫难
3楼-- · 2019-02-04 09:53

Just add -o nonempty in command line, like this:

s3fs -o nonempty  <bucket-name> </mount/point/>
查看更多
放荡不羁爱自由
4楼-- · 2019-02-04 09:55

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 mount command will work.

查看更多
登录 后发表回答