Using the VMware App Volumes snapvol.cfg File to Customize Writable Volumes
By Daniel Bakshi, Technical Account Manager, VMware
In the previous blog post Why Upgrade to App Volumes 2.10: Experience from the Field, I explained what VMware App Volumes is and why you should upgrade to the latest version. In this blog post, I will focus on how you can customize writable volumes for more granular control and, more importantly, in which use cases this would greatly improve your environment and user experience.
Introducing snapvol.cfg – A Writable Volume Configuration File
The snapvol.cfg configuration file is located in the root folder of each individual writable volume. This file contains information such as what should be captured and not captured on the writable volume for a user-installed application or user data.
The snapvol.cfg file contains not only paths to folders in the user’s C: drive, but also registry locations to capture (or not to capture), file types in a given path, specific process names, and so on.
This configuration file allows you to customize writable volumes to suit business needs.
As the administrator, you will customize the snapvol.cfg file. You can find the snapvol.cfg file for a specific writable volume on a machine where the user is logged in and the writable volume is attached. In the Computer Management utility on the Windows machine, from the left panel, click Storage and then Disk Management. The writable volume is listed and is called CVWritable by default, with a drive with no assigned letter. Right-click CVWritable and select Change Drive Letter and Paths (Figure 1).
Note: When a user logs into a machine, that user has access to only their own CVWritable volume.
Figure 1: Computer Management Utility
In the Change Drive Letter and Paths for CVWritable window (Figure 2), you see where CVWritable is currently mounted. All of the volumes managed by VMware App Volumes are mounted, hidden from users, to a location under C:\SnapVolumesTemp.
Figure 2: Change Drive Letter and Paths for CVWritable Window
Now that you know the location of the writable volume (C:\SnapVolumesTemp\MountPoints\…), go to it (Figure 3), and you see the configuration file for the writable volume, snapvol.cfg.
Figure 3: The snapvol.cfg File Inside the Writable Volume
Examining the snapvol.cfg File Structure
Open the snapvol.cfg file to examine its structure.
The writable volume configuration file is organized into categories. The categories are easily identified by their respective comments, and are mostly self-explanatory.
Some example categories are file system paths to virtualize and to exclude. See Figure 4.
Figure 4: File System Categories in the snapvol.cfg File
In the example under File system, “‘\” is the root folder (your C: drive).
Other categories are the Registry inclusions and Registry exclusions sections. See Figure 5.
Figure 5: Registry Categories in the snapvol.cfg File
Note: This is not the complete list of categories.
Now that we have reviewed the basics, you need to understand the specifics that you can tweak to better fit your business and environment needs. Following are some general rules when working with the snapvol.cfg file:
- Always try to keep the snapvol.cfg file organized and write your changes in the correct section or create a new section for your adjustments.
- If a line starts with # (number sign), it is treated as a comment (and not a configuration), which is a good way to mark a section to briefly explain what you are doing and why.
- Commenting is also useful for versioning your snapvol.cfg files or differentiating CFG files and saving those changes. For example, if you are planning to edit the CFG file more than once (maybe to exclude a registry path), and you would like to keep versions for future tracking or debugging purposes, you can keep those versions on an administration CIFS share for future reference by adding a comment (#) with the version number inside each CFG file.
A virtualize statement in a snapvol.cfg file means what to include from the capture of the file system to the writable volume. The default is to include everything, then deal with your exclusions.
means to virtualize everything in the root folder, which is your C: drive.
In most cases you should not modify this statement unless you need to to change from the default strategy of inclusion to a strategy of exclusion, which is rare. Modify this only if you want to capture a single file or folder.
However, to specifically exclude a file-system path that is captured by default, add an exclude_path statement:
Note: Environment variables that are defined on a machine before the user logs in are legal options when creating a new exclude_path command. This means you can do things such as the following:
To include a registry path, use virtualize_registry and follow with a virtualize_to statement.
This means you are capturing KeyWeNeed and virtualizing it. In this case, you are virtualizing KeyWeNeed to its original path in the registry tree. (\REGISTRY is hidden by design; the virtualize_to statement virtualizes it to its original path.)
To exclude a registry path, add an exclude_registry statement:
As someone who works in the field, I find the next feature particularly useful because of the level of flexibility it gives the admin. With VMware App Volumes you can specifically exclude capturing everything a specific process is doing. For example, your writable volume is capturing any user data written to anywhere on the C: drive, but you do not want to save any files created by the Paint application. You could exclude this process from the captures.
Using exclude_process_name as an example, you can exclude everything that MyProcess.exe does, by entering the following:
To exclude all of the processes that are running from a specific folder, use exclude_process_path:
Use Cases for Customizing the snapvol.cfg File
Examples of use cases for customizing the snapvol.cfg file follow.
Using Storage Space Efficiently
You can save storage space on the datastores hosting App Volumes by excluding unnecessary user information that you do not want to capture to your writable volumes (for example, things that are treated as temporary, such as C:\Temp).
Optimizing the File System, Registry, and Process to Be Captured According to Business Needs
When deciding what you want or need to capture, you should consider various business needs, such as security, storage, and user experience. For example, you probably do not want to capture sensitive information.
Solving Legacy Application Issues
You may have a legacy company application that you expect to read a file on the writable volume. However, the application may be looking at the NTFS file system “raw” or “as is,” meaning ignoring the files directed to the C: drive during virtualization. Therefore, this application will not see a file located on the writable volume (for example, C:\SnapVolumesTemp\xx\xx\xx\myfile.txt).
To solve this problem, you can exclude the file system path C:\folder\myfile.txt so that it will not be virtualized.
After you have customized the snapvol.cfg file, it is ready for you to test. Testing should be done by copying the new CFG file to some users’ writable volumes. Ask these users to work for a while with the new CFG file and provide you with feedback of the new behavior.
After that, you can update all of your users’ writable volumes by way of the App Volumes Manager Update Writables feature.
Figure 6: Update Writables Option
For more information about how to use the Update Writables feature, see the App Volumes User Guide.
Note: Changes to the snapvol.cfg file apply to future captures of applications and data to the user’s writable volume. Previous captures are not affected.
Important: Modifying the snapvol.cfg file is not officially supported. If you experience issues with the new configuration after changing it, Tech Support may require you to revert to the original snapvol.cfg file to validate that the issue is not related to changes in the file.
I hope this blog post demonstrates why and how you can tweak and customize your writable-volume configurations to best suit your needs. You can adjust how App Volumes treats the file system, the registry, and even the processes during capture of user-installed applications and data. We hope you find many uses for this flexible feature.