6 Replies Latest reply on Feb 18, 2019 6:59 AM by LVANDUIJN

    Copy App Stacks to Another Environment

    jeffrobinson85 Enthusiast

      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

        • 1. Re: Copy App Stacks to Another Environment
          Ray_handels Master
          vExpertCommunity Warriors

          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.:)

          • 2. Re: Copy App Stacks to Another Environment
            nburton935 Novice

            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

            • 3. Re: Copy App Stacks to Another Environment
              BC559 Novice

              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.

              • 4. Re: Copy App Stacks to Another Environment
                LVANDUIJN Novice
                vExpert

                Better do this with powercli.

                If you do this on a vSAN datastore your copy will be corrupted
                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/

                • 5. Re: Copy App Stacks to Another Environment
                  sjesse Master
                  vExpert

                  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.

                  • 6. Re: Copy App Stacks to Another Environment
                    LVANDUIJN Novice
                    vExpert

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