MSIX app attach – How To Manage CIMFS File Sprawl – Tips and Tricks
CIMFS is a new file system known as the composite file system. A CIM is essentially a small collection of flat files containing one or more data and metadata region files, one or more object ID files and one or more filesystem description files. CIM’s image format is a similar concept to a WIM or a read-only VHDVHDX.
The term composite means that the image can contain multiple file system volumes which can be mounted individually while sharing the same data region files. I am yet to see this in action; however, this is possible with CIMFS.
CIM can be accessed read-only using the standard Win32 or NT API file system interface.
Whilst CIMFS offers improved reduced resource consumption for large deployments, it does present a file management challenge in a sense there are several files to take care of rather than with a VHD or a VHDX you only have one file to worry about (per MSIX image).
When creating CIM images, it is recommended that you should create them in one folder per .CIM (group of files). If you create multiple CIM images all in one folder, how do you differentiate between them? Its not easy and creates a bit of a challenge.
The image below depicts a small MSIX image which contains an MSIX package in the format of CIMFS. You will note that there are many files that all relate to the same MSIX image known as testapp.cim.
You will also note each object id and region file has the same guid associated. However, how do you associate the CIM file with the region and object id files? This is tricky….
The guid shown on the object and region files is the guid provided during the creation of the cim and is not the guid when mounting the cim image on future mounts.
This is what it looks like if you output all your cim images into the same folder:
You will note that there are two Cims in the folder. However, how can you identify the two different CIM file groups between each other? The object and region files show different guids, which helps. How do you match the .CIM to the region and object files?
Solution to the problem
To avoid the problem in the first place, always create a CIM image in its own dedicated folder.
It does not impact MSIX app attach when separating your CIMs into individual folders. You still have to specify the absolute path of the MSIX image in WVD. However, the slight change is you would not specify the root path; you would rather specify the specific folder “\pathcimfolderapp1.cim”. Put CIM’s in folders !
When the CIM image files are first created, a creation timestamp is added to the file attributes. We can grab all the associated files to a specific CIM image to collect file attributes and match them when tidying up.
Get creation time stamps for CIMFS
The following PowerShell cmdlet reads the files in...