簡體   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