Reclaiming #FSLogix disk space

#FSLogix profile and O365 virtual hard disks are Dynamically Expanding disks and as such do not natively shrink when the volume of data within them reduces, they stay at the ‘High water mark’ of historical data volume within them. This means that Enterprises can wish to reclaim whitespace inside the disks to keep cost down if the storage is cloud based, or make sure they don’t exceed capacity limits if storage is on-premises. This excellent script from Jim Moyle (@JimMoyle) does exactly that.

This Script is designed to work at Enterprise scale to reduce the size of thousands of disks in the shortest time possible. This script can be run from any machine in your environment it does not need to be run from a file server hosting the disks. It does not need the Hyper-V role installed.

Powershell version 5.x and 7 and above are supported for this script. It needs to be run as administrator due to the requirement for mounting disks to the OS where the script is run.

This tool is multi-threaded and will take advantage of multiple CPU cores on the machine from which you run the script. It is not advised to run more than 2x the threads of your available cores on your machine. You could also use the number of threads to throttle the load on your storage.

Reducing the size of a virtual hard disk is a storage intensive activity. The activity is more in file system metadata operations than pure IOPS, so make sure your storage controllers can handle the load. The storage load occurs on the location where the disks are stored not on the machine where the script is run from. I advise running the script out of hours if possible, to avoid impacting other users on the storage.

With the intention of reducing the storage load to the minimum possible, you can configure the script to only shrink the disks where you will see the most benefit. You can delete disks which have not been accessed in x number of days previously (configurable). Deletion of disks is not enabled by default.

By default the script will not run on any disk with less than 5% whitespace inside (configurable). The script can optionally also not run on disks smaller than (x)GB (configurable) as it’s possible that even a large % of whitespace in small disks won’t result in a large capacity reclamation, but even shrinking a small amount of capacity will cause storage load. The script will output a csv in the following format:

via Invoke-FslShrinkDisk/README.md at master · FSLogix/Invoke-FslShrinkDisk

Leave a Reply

Your email address will not be published. Required fields are marked *