ESXi 5.1 上的数据存储上有两个卷。在 GUI 上,一个显示为灰色,并显示“(非活动)”字样。另一个在 GUI 上根本不显示。
但是,在命令行上:
~ # esxcli storage nfs list
Volume Name Host Share Accessible Mounted Read-Only Hardware Acceleration
----------- -------------- ------------------------- ---------- ------- --------- ---------------------
volume1 10.200.201.140 /export1 true true false Supported
volume2 10.200.201.140 /export1/somedir true true false Supported
有没有办法在命令行上检测到这种情况?更重要的是,有没有办法“重新激活”它们?
编辑:我无法发表评论或回答我自己的问题。:-(
无论如何,我最终做了类似的事情(针对每一卷):
#!/bin/sh
while [[ 1 ]]; do
echo "$(df -h)" | grep -q "/vmfs/volumes/volume1$"
volume1_mounted=$?
if [[ $volume1_mounted -ne 0 ]]; then
esxcli storage nfs add -H 10.200.201.140 -s /share1 -v volume1
fi
done
答案1
您可以使用:
esxcfg-nas -r
在 ESXi 上重新挂载 NAS 文件系统。请参阅命令语法:
esxcfg-nas <options> [<label>]
-a|--add Add a new NAS filesystem to /vmfs volumes.
Requires --host and --share options.
Use --readonly option only for readonly access.
-o|--host <host> Set the host name or ip address for a NAS mount.
-s|--share <share> Set the name of the NAS share on the remote system.
-y|--readonly Add the new NAS filesystem with readonly access.
-d|--delete Unmount and delete a filesystem.
-l|--list List the currently mounted NAS file systems.
-r|--restore Restore all NAS mounts from the configuration file.
(FOR INTERNAL USE ONLY).
-h|--help Show this message.