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

后端 未结 5 1463
小鲜肉
小鲜肉 2020-12-28 13:54

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 \'nonem         


        
相关标签:
5条回答
  • 2020-12-28 14:13

    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
    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
    
    0 讨论(0)
  • 2020-12-28 14:25

    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.

    0 讨论(0)
  • 2020-12-28 14:30

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

    s3fs -o nonempty  <bucket-name> </mount/point/>
    
    0 讨论(0)
  • 2020-12-28 14:32

    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.

    0 讨论(0)
  • 2020-12-28 14:34

    force it with -l

        sudo umount -l ${HOME}/mount_dir
    
    0 讨论(0)
提交回复
热议问题