VMware Horizon Community
jeffrobinson85
Enthusiast
Enthusiast

Copy App Stacks to Another Environment

Hello,

I'm trying to copy some of our productions App Stacks to our new UAT environment. There is no shared storage between the two environments. I'm trying to use the process in the following KB. Using WinSCP I can upload the *.vmdk, *.vmdk.metadata, *-flat.vmdk files but they become thick provisioned. I tried using vmkfstools -K AppStack_Template_Name.vmdk to convert it back to being thin provisioned but I get an error "Not a supported filesystem type" If I try to manually attach it to a VM I get a error in the vSphere console " VMDK cannot be opened for writing. It might be shared with some other VM". I'm think the vmdk or flat file is corrupting, but I'm not sure. I can't figure out what I'm doing wrong.

Does anyone have any other tips for copying App Stacks?

VMware Knowledge Base 

VMware Knowledge Base

Thanks

Jeff

6 Replies
Ray_handels
Virtuoso
Virtuoso

I'd suggest trying to use some sort of crossover server, You can just copy the Appstacks from one server to another but if you "remove" it from VCenter by backupping to windows it will simply get thick provisoned, I don't believe there is anything you can do about it.

The fact that you get the "cannot open for writing" error is because it is delete protected. If you want to you can change it by opening tha .vmdk file (NOT the flat file) and changing the value from ddb.deletable=false to ddb.deletable=true. Do keep in mind to change it back otherwise you could end up with a deleted appstack when you remove a machine where this appstack is still attached.

That being said I would suggest just using vcenter to copy it, saves the hassle.:)

Reply
0 Kudos
nburton935
Hot Shot
Hot Shot

A good way to do this is create a NFS share and mount it between hosts in both prod and POC vCenters. Rescan the storage in both AV prod and POC and mark the new NFS datastore as non-attachable (this will prevent Appstacks in NFS from attaching).

Create a storage group in each environment which contains the local AppStacks datastore + NFS; you can set to automatically import/replicate or manual.

AppStacks will be replicated between POC > NFS, and then NFS > prod. This is the same method used when deploying to multi-site environments.

Configure Storage Groups

-Nick B

Reply
0 Kudos
BC559
Enthusiast
Enthusiast

You may be doing this already...

When you copy them over via WinSCP each app will have 3 files (.vmdk, .vmdk.metadata,-flat.vmdk)

In WinSCP right-click the .vmdk and select 'File Names' -> 'Copy to Clipboard (Including Paths)'

Then when you SSH into the ESX host to thin provision just do 'vmkfstools -K <"paste in the whole path you copied from WinSCP">

I would also triple check that the AppStacks aren't attached to any machines when you try to export them via WinSCP.

Reply
0 Kudos
LVANDUIJN
Contributor
Contributor

Better do this with powercli.

If you do this on a vSAN datastore your copy will be corruptedSmiley Happy
Created a script back in the days to do this. Not the best coding i have done but worked great.

https://vdr.one/script-copy-app-volumes-appstacks-another-datastore/

Reply
0 Kudos
sjesse
Leadership
Leadership

I need to test this again since I haven't test this 5.5, but I'm pretty sure the core command(copy-datastoreitem) in this script, doesn't work between vcenter environments. II have a similar one that I use, but it requires downloading the vmdk from one vcenter and uploading it to the other one, which loses thin provisioning.

Reply
0 Kudos
LVANDUIJN
Contributor
Contributor

yeah, I had a shared NFS lun on both sides available. Made life easy to transport the appstacks between environments.