Do you guys have a tried/true method of shrinking ...
# microsoft-fslogix
j
Do you guys have a tried/true method of shrinking VHDX sizes? I'm not talking about the space being 'used' by the profile itself, but when we first started with FSLOGIX, we somehow ended up with 300GB "disks".. at some point we set it to 50GB in the GPO, but those early created are still 300GB , even though the file is only 20GB or so. I tried shrinking them with resize-vhd but it just complained. Any other ideas?
n
Have you tried the OG script written by Jim Moyle? I used it exclusively for years, thought I cannot recall if it handles the situation you're in. Easy enough to test, though. https://github.com/FSLogix/Invoke-FslShrinkDisk
j
thats not just a "compact" right?
I think it might be, because that website .. first thing it says "microsoft now supports disk compaction natively in the FSLogix product"
n
I swear I had the issue you did, but am not seeing it in my notes
j
🙂 understandable.. i forget more than i remember
r
Jim Moyles script is compaction. Are your files VHDs or VHDX's. If the later I think you can use hyperv to shink them https://learn.microsoft.com/en-us/powershell/module/hyper-v/resize-vhd?view=windowsserver2025-ps
j
they are VHDX's. I tried the powershell modules , i.e. Resize-VHD but it said it wouldnt do it because it might contain user data, etc
n
Maybe @Aaron Parker can chime in, but searching my notes, I did find a reference to this: https://github.com/aaronparker/fslogix/blob/main/Modules/Fslogix.Powershell.Disk/Public/Set-FslDisk.ps1
r
I think you first would need to shrink the partition size in the disk
j
Yep, I did that one too
mounted it and then went into disk manager and shrunk size (or maybe i did it in powershell, but it shrunk)
then tried to resize the entire disk and it wouldnt
I just re-mounted and will try again:
oh there we go.. maybe the key was making the partition slightly smaller than the disk.
r
good to know
j
Copy code
PS C:\Windows\System32> mount-vhd -path C:\temp\Profile_ARB.vhdx -ReadOnly:$false
PS C:\Windows\System32> get-disk | Where-Object IsOffline -eq $false

Number Friendly Name Serial Number                    HealthStatus         OperationalStatus      Total Size Partition
                                                                                                             Style
------ ------------- -------------                    ------------         -----------------      ---------- ----------
1      Msft Virtual…                                  Healthy              Online                  292.97 GB GPT
0      NVMe BG6 KIO… 8CE3_8E10_01F9_9E75.             Healthy              Online                  238.47 GB GPT

PS C:\Windows\System32> resize-partition -disknumber 1 -PartitionNumber 1 -size 45GB
PS C:\Windows\System32> resize-vhd -path C:\temp\Profile_ARB.vhdx -SizeBytes 50GB
curious, once a vhdx is mounted, how can you see the contents? tells me access denied
n
I always mounted them on a box where I was logged in with my admin account, which had full control over the file from the share.
a
@Nick Panaccio that module is a copy of something Jim originally wrote. I haven't looked at it for years
j
Copy code
trying to figure out why i always have issues with one particular/user profile [08:58:57.331][tid:00000c04.0000e248][INFO]             Configuration setting not found: SOFTWARE\FSLogix\Profiles\LockedRetryCount.  Using default: 12
[08:58:57.331][tid:00000c04.0000e248][INFO]             Configuration setting not found: SOFTWARE\FSLogix\Profiles\LockedRetryInterval.  Using default: 5
[08:58:57.332][tid:00000c04.0000e248][INFO]             Status set to 11: Cannot open virtual disk
[08:58:57.332][tid:00000c04.0000e248][INFO]             ErrorCode set to 59 - Message: An unexpected network error occurred.
[08:58:57.332][tid:00000c04.0000e248][ERROR:0000003b]   Failed to open virtual disk: \\<http://braytonlaw.com|braytonlaw.com>\files\FSLogix\S-1-5-21-1177238915-2025429265-682003330-1112_ARB\Profile_ARB.vhdx (An unexpected network error occurred.)
Copy code
[08:58:57.336][tid:00000c04.0000e248][ERROR:0000003b]   LoadProfile failed. Version: 3.25.822.19044 User: ARB. SID: S-1-5-21-1177238915-2025429265-682003330-1112. SessionId: 29. FrxStatus: 31 (An unexpected network error occurred.)
r
Maybe permissions
j
no different than anyone else.. 😕
r
doesnt fslogix use the currnt user so if you copy the profile a another user permnissison cna get jacked up