Storage Sense and OneDrive in VDI and FSLOGIX

I ran into a weird issue when I was migrating 100s of GB of data to OneDrive. I was getting an error that the disk was out of space but when I checked the local disk there was plenty of space. I eventually traced this to the OneDrive cache that was housed in my FSLOGIX. I needed to run storage sense and have it dehydrate the local files so that I would have space. I set a GPO on the OU where the computers reside to enable Storage sense, run it daily, and to dehydrate any file that was not touched in 1 day. I learned a few other things along the way.

My VDI desktop is a non-persistent instant clone that has my profile data redirected to an FSLOGIX container on a NAS. Our profiles have a 25GB quota. We redirect Documents, Desktop, AppData and some other folders. We specifically exclude Downloads, and browser cache/temp folders. OneDrive’s Cache by default lives in the user’s profile

During my testing I attempted to change the location of the OneDrive folder to a folder outside of the profile (remember it’s redirected with FSLOGIX, and this is a non-persistent desktop so everything not redirected is destroyed on logout). I used the DefaultRootDir setting in the OneDrive GPO to send this to c:\tmp. The initial login and configure went just fine. I logged out, and when I logged back in with a new session OneDrive was very angry. It choked on the missing OneDrive – [Organization] root folder. I created this and OneDrive then complained that there was nothing there. I modified the image so that the root folder was preset and OneDrive would not launch automatically and complain. On another computer I saw a large number of files being deleted on my OneDrive. I assume this was related to the missing files on the test computer.

Ultimately I decided even if I was able to get OneDrive to stop complaining, and to automatically launch for the user I couldn’t subject my users to the delay as OneDrive built all the stub-files on the local system. Not to mention the unaddressed deletes. This means I need to keep the OneDrive folder within the profile data that we are persisting for the user.

We have always set the FilesOnDemandEnabled in the OneDrive GPO to only download the necessary files to the local system. As you interact with files they are cached locally for you to use. This only handles the hydration of files, not the dehydration. I found that this is handled by Storage Sense, which should kick off when you are low on disk space. (No I have not found what the threshold for low is). This requires the storage service to be running on your computer. Because this is a VDI optimized windows configuration we have disabled unnecessary services like the storage service.

Enter the Storage Sense GPO to save me from myself. Through the GPO I enabled Storage sense, and set it to run daily, I also set the threshold to dehydrate files to 1 day. These are both the most aggressive that they can be set. This means that storage sense will run at some point every day (I did not investigate deeply to see when this happens, I know it is not at logon) and will dehydrate files that haven’t been accessed in the last 24 hours. I think this means that if my desktop session stays logged in the longest a file will remain cached is just under 48 hours.

I did not configure any of the other storage sense options like downloads, recycle bin or temp file cleanup. This is a non-persistent VDI desktop and we don’t capture these in the FSLOGIX profile so they are destroyed on logout. I also set storage sense to run daily so that it is likely to run at some point while a user is logged in. If a user logs in a 8a and out at 5 there is a greater chance that the cleanup will run if I have it execute daily. The 1 day dehydration was an aggressive setting for testing, I will likely change this to a more realistic setting for my every-day users.

Some interesting things to note:

  • Automatic dehydration will not impact files that a user has specified to ‘Always keep on this device’ they will only dehydrate when the user unchecks this. It should auto-dehydrate based on the storage sense policy or immediately if the user selects Free up space
  • The keep on this device setting is per device. In a VDI scenario is translates to keep with this profile. This does not impact the locality of data on physical endpoints, or other VDI desktops where the user gets a different profile. (On-prem vs Cloud if the profile is not shared between them)

Resources:

Leave a comment