Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RW files not replaying back into profile after optimisation. #26

Open
BurundiLapp opened this issue Oct 21, 2020 · 4 comments
Open

RW files not replaying back into profile after optimisation. #26

BurundiLapp opened this issue Oct 21, 2020 · 4 comments

Comments

@BurundiLapp
Copy link

BurundiLapp commented Oct 21, 2020

HI, we ran this script in anger for the first time this morning, it didn't have any issues during the test runs and proved to save more space compared to our homebrew script.

The issue we've had is that if the user doesn't sign out from Citrix properly they end up with a disconnected session and if the Citrix server was unable to log them out, usually due to unsaved changes in a document preventing logoff then the Citrix server doesn't reboot automatically as it is supposed to.

To get around this we then run a script which checks for any servers that have run for longer than 24 hours and the script power cycles them to reset them.

The net result of this is that the RW file is still present in the users profile folder and hasn't been written back into their profile VHDX file but when they login teh RW file is re-attached and things carry on as normal.

This has worked fine previously as our homebrew script doesn't try to optimise any profiles that have an RW file in the same folder and continuity is maintaned.

This morning though after running the Invoke-FslShrinkDisk overnight instead a significant number of users have had issues with their profiles, bringing up the following error in the FSLogix logs:

Open diff disk (The chain of virtual hard disks is corrupted. There is a mismatch in the identifiers of the parent virtual hard disk and differencing disk.)

FSlogix has then opened a RO diff disk in the temp file of the Citrix session host server.

Created RO diff: C:\Windows\TEMP\S-1-5-21-1177238915-1085031214-1801674531-28690_RO.VHDX

These RO files have casued a lot more disk usage in the Citrix session hosts which has caused a few to run out of space.

We've also had a lot of OST corruption issues as well which seems to happen when the RW file is not written back, the helpdesk team have recreated a lot of Outlook caches today.

Is there anyway for Invoke-FslShrinkDisk to replay changes from the RW differencing disk back into the profile folder and then compact or just not touch profiles which have an RW file present, even if they are not locked for writing.

Thanks

@codeprutser
Copy link

codeprutser commented Mar 29, 2022

I have the same problem, did you ever found a solution for this problem?

A simple fix would be that if the script skips the VHDX file is a RW,VHDX is in the same folder

@JimMoyle
Copy link
Contributor

JimMoyle commented Mar 29, 2022

I'd advise you make sure that make sure that users log out gracefullly.

If that's not possible the script will take a list of files so you could do something like:

$disks = gci \\server\share -recurse -file
$newDiskList = foreach ($disk in $disks){
$folderContents = Get-ChildItem $Disk.Directory -Name

if ($folderContents -ncontains 'rw.vhdx' -or $folderContents -ncontains 'Merge.vhdx') {
write-Output $disk

    }

}

$newDiskList | Invoke-FslShrinkDisk

NOTE! I have not check this code for syntax etc, it's just a place to start.

@codeprutser
Copy link

I'd advise you make sure that make sure that users log out gracefullly.

If that's not possible the script will take a list of files so you could do something like:

$disks = gci \server\share -recurse -file $newDiskList = foreach ($disk in $disks){ $folderContents = Get-ChildItem $Disk.Directory -Name

if ($folderContents -ncontains 'rw.vhdx' -or $folderContents -ncontains 'Merge.vhdx') { write-Output $disk

    }

}

$newDiskList | Invoke-FslShrinkDisk

NOTE! I have not check this code for syntax etc, it's just a place to start.

Thank you for your quick response. My Colleague already came up with this filter inserted in line 1477:

# Start Filter all VHDX files where an RW.VHDX exists in same directory

$pathWithRWs = @()
$filteredDiskList = @()

foreach ($disk in $disklist) {
    if ($disk.Name -eq "RW.VHDX") {
       $pathWithRWs += $disk
    }
}

foreach ($disk in $disklist) {
    $HasRw = $false
    foreach ($pathwithRW in $pathWithRWs) {
        if ($pathwithRW.Directory.FullName -eq $disk.Directory.FullName) {
            $HasRw = $true
        }
    }

    if (-not $hasrw) {
        $filteredDiskList += $disk
    }
}

$diskList = $filteredDiskList

# End Filter all VHDX files where an RW.VHDX exists in same directory

This seems to work. Obviously it's better that user are logged off gracefully, however in large environments this is simply not happening for all users all the time.

@chrismoore-28
Copy link

@JimMoyle We also encounted a similar issue, we edited the following at line 1469 to prevent the cleanup running over users with an RW disk.

#Get a list of Virtual Hard Disk files depending on the recurse parameter
    if ($Recurse) {
        $diskList = Get-ChildItem -File -Filter *.vhd? -Path $Path -Recurse
    }
    else {
        $diskList = Get-ChildItem -File -Filter *.vhd? -Path $Path
    }
    
    $diskListrw = $diskList | Where-Object { $_.Name -eq "Merge.vhdx" -or $_.Name -eq "RW.vhdx" }
    $diskList = $diskList | Where-Object {(Compare-Object -ReferenceObject $_ -DifferenceObject $diskListrw -Property Directoryname).SideIndicator -eq '<=' }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants