VMware Cloud Community
Byron_Zhao
Enthusiast
Enthusiast

rescan SAN on multiple servers

I want to know how people are doing this in their ESX environment. Now it is painful to add a LUN to it. I need to rescan every host from VC or run esxcfg-rescan vmhba0 from SC, and reflesh the storage for each host in order for the hosts to see the new LUN. Is there a quick way to rescan multiple ESX 3.0.1 servers when a new LUN is added?

Thanks for any help.

0 Kudos
5 Replies
Texiwill
Leadership
Leadership

Hello,

You would need to either use the VIPerl Toolkit....

Setup RSA/DSA Authentication for SSH and run from a known host 'ssh admin@servername sudo /usr/sbin/esxcfg-rescan vmhba0' and perhaps allow this command to be run via sudo without a password....

Or use ssh without the RSA/DSA Authentication.... etc.

There is quite a bit that could happen here from a scripting perspective....

Best regards,

Edward

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
Dave_Mishchenko
Immortal
Immortal

I haven't used it myself, but clusterssh may help you with this.

http://directory.fsf.org/sysadmin/hookup/ClusterSSH.html

0 Kudos
Byron_Zhao
Enthusiast
Enthusiast

Thanks Texiwill, but it seems running esxcfg-rescan vmhba# won't make the storage shows up in VC, and sometimes I need to run esxcfg-rescan a couple times. Then I need to go to VC's ESX host-> Configuration-> Storage, and click on refresh it before I can see the LUN.

0 Kudos
Byron_Zhao
Enthusiast
Enthusiast

Thanks, I will take a look at it and give it a try.

0 Kudos
marvinthebassma
Contributor
Contributor

Hi Byron,

try this command after esxcfg-rescan ... for adding or removing SAN LUNs or NAS datastore

vimsh -n -e "internalsvc/refresh_datastores"

about 10 sec. later the VC shows the updated datastores for that ESX.

So you can use this command scripted like esxcfg-rescan

Marvin

0 Kudos