Jump to content
Welcome to our new Citrix community!
  • How I Run a Defrag on a PVS Target vDisk


    cugcblogs

    raydavis22rnd.jpg by Ray Davis

    This quick write-up isn’t anything advanced. Most of you out there know this, but some may still question it. We know there is a lot of documentation around PVS and Martin Zugec is updating a lot of this within Citrix Tech Zone. This is more of a confirmation that running a defrag on the VHDX on a merged vDisk is still needed on today’s PVS server vDisk. I reached out to some guys on Slack, as I knew I would get a solid answer fast. As you can see, it is still needed. Some rebuild images, and some just do what I do, which is the manual way (and which can be automated as well).

    Some people today may think, is this needed when I have SSD/NVMe. Yes, it is, because we are talking about all the version changes, and it’s the actual VHDX itself. Think of how you shrink FSLogix VHDX/VHD. To me, it’s the same concept. The type of storage doesn’t matter because it's not at the OS layer. It’s about keeping the VHDX clean, optimized, and reducing any write cache bloats that will occur from the fragmentation on the VHDX as a whole. Now, some people may think, 'why do it the long and manual way? Automate it...' Yes, and I agree. However, I need to make sure the steps are solid, as I have destroyed things with Automation. It's really around me not fully testing the script, which is on me. 

    davis102620-01.png.ef439f382f73f1b992aa3a11c94b3849.png

    My advice is to first read this blog, as it will shed a lot of light on what I am talking about and much more.

    https://www.citrix.com/blogs/2015/01/19/size-matters-pvs-ram-cache-overflow-sizing/

     

    "Defragment the vDisk before deploying the image and after major changes. Defragmenting the vDisk resulted in write cache savings of up to 30% or more during testing. This will impact any of you who use versioning as defragmenting a versioned vDisk is not recommended. Defragmenting a versioned vDisk will create excessively large versioned disks (.AVHD files). Run defragmentation after merging the vDisk versions. Note: Defragment the vDisk by mounting the .VHD on the PVS server and running manual defragmentation on it. This allows for a more robust defragmentation as the OS is not loaded. An additional 15% reduction in the write cache size was seen with this approach over standard defragmentation.

    Here is a good script to defrag and shrink the VHDX: 

    Put the devices into Maintenance Mode in Studio. (No devices can be streaming off the vDisk to defrag the vDisk).

    davis102620-02.png.7d18ac439fb2d81b359df27c9de7ab54.png

    Make sure the connections say “0”:

    davis102620-03.png.35df2df3a67af40bbe25ecb85bf1274d.png

    You could copy the merged vDisk off and import it to do all the work if needed. Then, you would need to mess with the active streaming devices. And after you're complete, just update all the targets. 

    I didn’t do it this way, but it is an option.

    Also, make sure you have no locks. As per my example above, XD7CALLTST has none.

    Now, Merge the selected vDisk.

    Select "Merged base -Last base + all updates from that base" and then select "Test" mode.

    davis102620-04.png.439715f4080247975e155263b91b3290.png

    Wait for the percentage to complete 100%.

    davis102620-05.png.719a261e52127f609903d874321b8eb3.pngdavis102620-06.png.849c47010062434c8a5456cca72ef436.png

    Once it’s merged, it will look like this:

    davis102620-07.png.e838b68df172adb3df1d8d15c2db498e.png

    Now click on the vDisk and click "Mount vDisk."

    davis102620-08.png.06b260816cd8be1de0e45dddb611bc88.png

    The icon will look like this on the vDisk:

    davis102620-09.png.f86e41279df1d8beb70fc8835c77e5f0.png

    Now open up File Explorer, and find the drive.

     

    Analyze it to see if it’s needed.

    davis102620-10.png.8910bc6ecce2dc69005a790a2d83b1ad.png

    Now defrag it.

    davis102620-11.png.d57beb8e81ec1d5e248b1fe4f3a875ae.png

    Once completed, go back and select "Unmount."

    davis102620-12.png.2312f2363b4dd0bbecbde85390f55f78.pngdavis102620-13.png.da879aa01a49dc0cd04fb730d8e9a187.png

    The Icon will go back to the original look:

    davis102620-14.png.88e9364d50e36f9931679e7b610a6728.png

    At this point, I boot up my Maintenance device to make sure things are good.

    davis102620-15.png.feb37ca182ec081f7095b1830d311fd9.png

    And you see its number: 3.

    davis102620-16.png.3f3d75821a6a5fb740a7b38d0e7f3246.png

    Once the machine boots up, you will see it in use in the “show vDisk Usage” box.

     

    Now that the machine is up, log in, and make sure it’s good.

    davis102620-17.png.4cb3eee5f0d3a75887c36c29a6936a38.png

    Now shut it down, and promote to PROD.

    You will see the “show vDisk Usage” go to no devices.

    davis102620-18.png.e970209d714afcd42d278d6a7482adaa.png

    Promote to Prod. Select "Immediately" or you can schedule it.

    davis102620-19.png.661818b4e8ecbf6456ced7bd6d0d76bc.png

    It will now look like this:

    davis102620-21.png.875529b5a41da25fd5809103b020e0b1.png

    Now copy the new Vdisk #3 file to your other PVS servers to get this all green:

     

    Copy from the server you did the work on. In my case, VS1PVS03.

    davis102620-22.png.15a28b2124d6aa67adf5d5b096abdfa1.png

    Destination:

    davis102620-23.png.feb6fcc067a1ea784167f93474dff360.png

    Once the copy is completed, the replication will show green.

    davis102620-24.png.7ff8af3c637530e7ecf94684fdedb885.pngdavis102620-25.png.eb2642e475f2ab1e32cb22754654ecd9.png

    PVS Target check:

    davis102620-26.png.93ef70e0f983e56def2f4dc4bb10e865.png

    At this point, I booted it up and it was golden.

     

    This can be automated: https://dennisspan.com/automate-vhd-offline-defrag-for-citrix-provisioning-server/

     

    Extra information:

    https://twitter.com/mohrpheus78/status/1320650888973897728?s=21

    https://support.citrix.com/article/CTX229864

     

    Total Breakdown of why it’s needed:

    https://www.citrix.com/blogs/2015/01/19/size-matters-pvs-ram-cache-overflow-sizing/


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...