OsburnM
Hot Shot
Hot Shot

How to sync a Datastore's folder contents across multiple datastores

Greetings all--

I'm looking to develop a script (bash on ESXi or powershell/cli) or other automated process (vRO is also on the table) to replicate a directory containing files to multiple datastores.  Specifically, I have many clusters with different shared storage in difference datacenters & vcenters. I want to implement a shared tools locker repository where I simply point my hosts product locker symlink to a folder on a datastore local to a given environment.  I'll have a "master" repo/datastore that I update and my script/automation pushes to all the downstream datastores.  The other usecase is a master repo for some boot ISO that we update regularly.

For those wondering, Content Library is out of the question as hosts cant be configured to point to a CL for the product locker; and, given CLs are object based, if we have to rev a boot ISO, it receives a new uuid that would mean we'd have to go and touch ever vm that has the iso mounted.

So there it is-- in a Windows world I'd use something like Powershell and Robocopy with a Windows Scheduled task.  In a linux world I'd use rsync with a chron job; but, ESXi can't do either of those. 

One last point-- I know there's a CopyDatastore-Item powecli cmdlet but in my testing, it's PAINFULLY slow (a 1GB directory can take over 15 minutes to copy where as an SCP or sFTP copy takes about 10 seconds) so that would be impractical given the number of hosts/datastores I'd have.

0 Kudos
0 Replies