Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

linux

fuse

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?

like image 224
bernie2436 Avatar asked Nov 28 '13 16:11

bernie2436


People also ask

Can you use a non empty directory as mount point?

The restrictions on mounting file systems are: The mount point must be a directory. If it is not an empty directory, files in that directory are not accessible while the file system is mounted.

What is Nonempty mount option?

If there is some file/directory under your mount point , s3fs(mount command) can not mount to mount point directory. Then you can use nonempty option, that option for s3fs can do.

How do you unmount a fuse?

Therefore, the preferable way to unmount a unionfs-fuse is through the FUSE system directly using fusermount -u ~/example-mount-point (the -u switch means "unmount"). A big advantage of using fusermount instead of umount is it requires no privilege elevation. As the name implies, FUSE all happens in userspace.

How do I unmount a device in Linux?

On Linux, the easiest way to unmount drives on Linux is to use the “umount” command. Note : the “umount” command should not be mispelled for “unmount” as there are no “unmount” commands on Linux.


1 Answers

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 
like image 200
hek2mgl Avatar answered Sep 17 '22 22:09

hek2mgl