Jump to content
Covecube Inc.

fly

Members
  • Content Count

    30
  • Joined

  • Last visited

  • Days Won

    3

fly last won the day on June 11

fly had the most liked content!

About fly

  • Rank
    Advanced Member

Recent Profile Visitors

265 profile views
  1. Since the C&P here was a little wonky, I uploaded it to Github. There have probably been some slight moditifcations to it since then as well. https://gist.github.com/flyize/ff78a44fa502c6b4cd10dd0e25212fb9
  2. fly

    SSD Optimzer Feature Request

    Hopefully they can update the balancer, but in the meantime, my PowerShell script might help.
  3. If you'd like to see the genesis of this script, check out my original thread here Since I finally got my PowerShell script running, and I thought I'd post it here in case anyone else might find it helpful. SYNOPSIS: Script will move files from one DrivePool to another according to FIFO policy REQUIRED INFRASTRUCTURE: The expected layout is a DrivePool consisting of two DrivePools, one magnetic and one solid state. The main variables are pretty obviously documented. I added the file archive limit for people like me who also run SnapRAID Helper. That way the script doesn't trip the 'deleted' file limit (I'm assuming moves would trip it, but I didn't actually test it). Warning, I've obviously only tested this on my system. Please test this extensively on your system after you have ensured good backups. I certainly don't expect anything to go wrong, but that doesn't mean that it can't. The code is full of on-screen debugging output. I'm not a great coder, so if I've done anything wrong, please let me know. I've posted the code here so that you can't C&P it into a script of your own, since Windows can be annoying about downloaded scripts. Please let me know if you have any questions. Set-StrictMode -Version 1 # Script drivePoolMoves.ps1 <# .SYNOPSIS Script will move files from one DrivePool to another according to FIFO policy .DESCRIPTION The script can be set to run as often as desired. The expected layout is a DrivePool consisting of two DrivePools, one magnetic and one solid state. .NOTES Author : fly (Zac) #> # Number of files to move before rechecking SSD space $moveCount = 1 # Path to PoolPart folder on magnetic DrivePool drive $archiveDrive = "E:\PoolPart.xxxxx\Shares\" # Path to PoolPart folder on SSD DrivePool drive $ssdSearchPath = "F:\PoolPart.xxxxx\Shares\" # Minimum SSD drive use percent. Below this amount, stop archiving files. $ssdMinUsedPercent = 50 # Maximum SSD drive use percent. Above this amount, start archiving files. $ssdMaxUsedPercent = 80 # Do not move more than this many files $fileArchiveLimit = 200 # Exclude these file/folder names [System.Collections.ArrayList]$excludeList = @('*.covefs*', '*ANYTHING.YOU.WANT*') # Other stuff $ssdDriveLetter = "" $global:ssdCurrentUsedPercent = 0 $fileNames = @() $global:fileCount = 0 $errors = @() Write-Output "Starting script..." function CheckSSDAbove($percent) { $ssdDriveLetter = $ssdSearchPath.Substring(0, 2) Get-WmiObject Win32_Volume | Where-object {$ssdDriveLetter -contains $_.DriveLetter} | ForEach { $global:ssdUsedPercent = (($_.Capacity - $_.FreeSpace) * 100) / $_.Capacity $global:ssdUsedPercent = [math]::Round($ssdUsedPercent, 2) } If ($ssdUsedPercent -ge $percent) { Return $true } Else { Return $false } } function MoveOldestFiles { $fileNames = Get-ChildItem -Path $ssdSearchPath -Recurse -File -Exclude $excludeList | Sort-Object CreationTime | Select-Object -First $moveCount If (!$fileNames) { Write-Output "No files found to archive!" Exit } ForEach ($fileName in $fileNames) { Write-Output "Moving from: " Write-Output $fileName.FullName $destFilePath = $fileName.FullName.Replace($ssdSearchPath, $archiveDrive) Write-Output "Moving to: " Write-Output $destFilePath New-Item -ItemType File -Path $destFilePath -Force Move-Item -Path $fileName.FullName -Destination $destFilePath -Force -ErrorAction SilentlyContinue -ErrorVariable errors If ($errors) { ForEach($error in $errors) { if ($error.Exception -ne $null) { Write-Host -ForegroundColor Red "Exception: $($error.Exception)" } Write-Host -ForegroundColor Red "Error: An error occurred during move operation." Remove-Item -Path $destFilePath -Force $excludeList.Add("*$($fileName.Name)") } } Else { Write-Output "Move complete." $global:fileCount++ # Increment file count, then check if max is hit If ($global:fileCount -ge $fileArchiveLimit) { Write-Output "Archive max file moves limit reached." Write-Output "Done." Exit } Else { Write-Output "That was file number: $global:fileCount" } } Write-Output "`n" } } If (CheckSSDAbove($ssdMaxUsedPercent)) { While (CheckSSDAbove($ssdMinUsedPercent)) { Write-Output "---------------------------------------" Write-Output "SSD is at $global:ssdUsedPercent%." Write-Output "Max is $ssdMaxUsedPercent%." Write-Output "Archiving files." MoveOldestFiles Write-Output "---------------------------------------" } } Else { Write-Output "Drive not above max used." } Write-Output "Done." Exit
  4. Figured it out. For whatever reason, when using mount points, the PoolPart folders don't get created until something is written to it. That doesn't seem to be the case for drive letters. Is that possible or am I missing something?
  5. Thanks. I did see that KB, but I'm not sure I follow. Where will the Poolpart folders be for the new top level drive? Hopefully this makes sense: D: - Top level drive pool |___ E: Magnetic drive pool |____ C:\mount\1\PoolPart |____ C:\mount\2\PoolPart |___ F: Sold state drive pool |___ R:\ edit: Just created the above DrivePool hierarchy. The top level drive was empty and I only saw one PoolPart folder in C:\mount\1. I'm clearly missing something.
  6. Am I asking really dumb questions? (Other than this one?)
  7. And to follow that up... If I create a new top level DP drive hierarchy, how do I prime the new top level drive with the contents of DP drive below it?
  8. Okay, so I've been thinking more about this again. Here's my plan to have a FIFO SSD cache. Create a DrivePool of magnetic drives (E:) Create a DrivePool of solid state drives (F:) Create a DrivePool containing E: and F: (D:) I would create placement rules for D: that tell DP to only place files on F:. Then I'd simply write a PS script that would check free space on F: and move files to E: until there was XXXGB of free space. If it matters, the only reason that E: and F: would exist is so that I don't have to find the underlying disk with the most free space on E: or find the SSD under F: that needs files archived off. I just have my script move things and let DP deal with file placement. Would this work?
  9. I actually assumed that's how they would work, but apparently not. I have an SSD that I want to add to the pool, but only have new files placed there. As soon as I create the '* > SSD' rule, DP starts filling up the SSD. What am I not understanding?
  10. fly

    DrivePool SSD Cache

    No. I asked about this a few months ago as well. At the time, I started working on a PowerShell script that would move stuff in FIFO fashion from SSD to platter. At that time, I failed. But I've started working on it again.
  11. This is all a good point. Not sure why I didn't think of it before. Thank you. edit: Can I 'backup' the same data from the same CloudDrive to multiple storage providers?
  12. I'm confused and concerned. I use CloudDrive to backup important client data for my business, as I assumed it was the perfect backup solution. Are people actually losing data?
  13. I often travel for work with simply my ChromeBook. Is it possible for me to access my encrypted files from it?
  14. Just checking in to see if any movement was possible on this?
  15. While I would guess that there's no real correlation, that was the easy part in PowerShell. This recursively (and surprisingly quickly) searches a directory and grabs the two oldest files: $fileNames = Get-ChildItem -Path $searchPath -Force -Rec | Where-Object { -not $_.PsIsContainer } | Sort-Object CreationTime | Select-Object -Property FullName -First 2
×
×
  • Create New...