50 lines
2.3 KiB
PowerShell
50 lines
2.3 KiB
PowerShell
# Сверка полного бэкапа с флешкой.
|
||
$dest = 'C:\PF\flash-backup-2026-10-30-3'
|
||
|
||
function Stat($p) {
|
||
$f = Get-ChildItem $p -Recurse -File -Force -ErrorAction SilentlyContinue |
|
||
Where-Object { $_.FullName -notmatch '\\\$RECYCLE\.BIN\\|\\System Volume Information\\' }
|
||
$m = $f | Measure-Object -Sum Length
|
||
[pscustomobject]@{ Count = $m.Count; Sum = $m.Sum }
|
||
}
|
||
|
||
'--- объёмы:'
|
||
foreach ($v in @(@('F:','F:\', "$dest\01-PARAVIS-F"), @('G:','G:\', "$dest\02-VTOYEFI-G"), @('H:','H:\', "$dest\03-DATA-H"))) {
|
||
$a = Stat $v[1]; $b = Stat $v[2]
|
||
' {0} источник {1,6:N0} / {2,16:N0} байт бэкап {3,6:N0} / {4,16:N0} {5}' -f `
|
||
$v[0], $a.Count, $a.Sum, $b.Count, $b.Sum, $(if ($a.Count -eq $b.Count -and $a.Sum -eq $b.Sum) { 'OK' } else { 'РАСХОЖДЕНИЕ' })
|
||
}
|
||
|
||
'--- SHA-256 ключевых файлов (мелкие):'
|
||
$key = @(
|
||
'efi\Paravis\Boot\grub2\grub.cfg',
|
||
'efi\Paravis\Boot\g4d\grldr',
|
||
'efi\Paravis\Boot\xor\xmbr.bin',
|
||
'efi\Boot\x86.xor',
|
||
'efi\Boot\1x86.bmp',
|
||
'efi\Paravis\Boot\bcd\bcd',
|
||
'efi\Paravis\KRD\live\KRD\10-krd.srm',
|
||
'efi\Paravis\KRD\live\vmlinuz',
|
||
'Change_bootLoader.exe'
|
||
)
|
||
foreach ($k in $key) {
|
||
$a = Join-Path 'F:\' $k
|
||
$b = Join-Path "$dest\01-PARAVIS-F" $k
|
||
if (-not (Test-Path $a)) { ' {0,-46} нет на флешке' -f $k; continue }
|
||
if (-not (Test-Path $b)) { ' {0,-46} НЕТ В БЭКАПЕ' -f $k; continue }
|
||
$h1 = (Get-FileHash $a -Algorithm SHA256).Hash
|
||
$h2 = (Get-FileHash $b -Algorithm SHA256).Hash
|
||
' {0,-46} {1}' -f $k, $(if ($h1 -eq $h2) { 'OK ' + $h1.Substring(0,12) } else { 'РАСХОЖДЕНИЕ' })
|
||
}
|
||
|
||
'--- SHA-256 крупных ISO (по одному):'
|
||
$isos = Get-ChildItem 'H:\ISO' -File -Filter '*.iso' | Sort-Object Length -Descending
|
||
foreach ($iso in ($isos | Select-Object -First 1) + ($isos | Select-Object -Last 1)) {
|
||
if (-not $iso) { continue }
|
||
$b = Join-Path "$dest\03-DATA-H\ISO" $iso.Name
|
||
$t = Get-Date
|
||
$h1 = (Get-FileHash $iso.FullName -Algorithm SHA256).Hash
|
||
$h2 = (Get-FileHash $b -Algorithm SHA256).Hash
|
||
' {0} ({1:N1} ГБ) {2} [{3:mm\:ss}]' -f $iso.Name, ($iso.Length/1GB), $(if ($h1 -eq $h2) { 'OK ' + $h1.Substring(0,12) } else { 'РАСХОЖДЕНИЕ' }), ((Get-Date)-$t)
|
||
}
|