由于未知原因,Linux服务器上的Amazon S3 Fuse挂载全天都会失败。唯一的解决方案是再次umount
然后mount
目录。我尝试编写以下shell脚本,当手动卸载它工作并重新安装时,但我知道当链接失败但实际上没有卸载时必须有一些其他“状态”。
原始错误:
[root@app3 mnt]# cd s3fs
[root@app3 s3fs]# ls
ls: cannot access amazon: Transport endpoint is not connected
amazon
[root@app3 s3fs]# umount amazon
[root@app3 s3fs]# mount amazon/
如果失败,Shell脚本会尝试检查mount和remount(在手动测试中工作但失败):
#!/bin/bash
cat /etc/mtab | grep /mnt/$1 >/dev/null
if [ "$?" -eq "0" ]; then
echo /mnt/$1 is mounted.
else
echo /mnt/$1 is not mounted at this time.
echo remounting now...
umount /mnt/$1
mount /mnt/$1
fi
答案 0 :(得分:0)
我知道这已经过时了,但它可能会帮助其他人面对这个问题。 我们遇到类似的问题,我们的存储桶随机卸载并且“传输端点未连接”错误。
我使用“df -hT”而不是使用“cat / etc / mtab”,而是使用我的脚本。问题是它被困在这种奇怪的状态,半被卸载并且“mtab”仍然将其视为已安装;但我仍然不知道为什么。
这是我正在使用的代码:
#!/bin/bash if [ $(df -hT | grep -c s3fs) != 1 ] then # unmount it first umount /path/to/mounted/bucket; # remount it /usr/local/bin/s3fs bucket-name /path/to/mount/bucket -o noatime -o allow_other; echo "s3fs is down"; # maybe send email here to let you know it went down fi
还要确保以root用户身份运行脚本,否则将无法卸载/重新安装。