1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# Ideas # Probar la integridad de las copias de seguridad: # - Crear un plan de pruebas. # - Ventajas del uso de máquinas virtuales para las pruebas de integridad de los backups. # - Comprobar si los tiempos de restauración son asumibles. # Ficheros que se van a copiar # fichero1.txt # fichero2.txt # fichero3.txt # fichero4.txt # Ficheros que tienen las integridades de los ficheros 1,2,3,4 # fichero1integridad.txt # fichero2integridad.txt # fichero3integridad.txt # fichero4integridad.txt # crear el zip 1,2,3,4 # -------------------- RECUPERACIÓN # descomprimir zip 1,2,3,4 # ver integridad fichero que tiene los hashes 1,2,3,4 # fichero1 si abro si la integridad es correcta "hola" > fichero1.txt (Get-FileHash .\fichero1.txt).hash (Get-FileHash .\fichero1.txt).hash > fichero1integridad.txt # zip meter fichero1.txt más integridades.txt (se puede separar en dos archivos) # hay fallo y tengo que recuperar la copia # descomprimir y ver si el fichero1.txt lo puedo ver # porque la integridad de fichero1 es correcta # h(f1) == f1* if((gc .\fichero1integridad.txt) -eq (Get-FileHash .\fichero1.txt).hash) { "El hash coincide" } else { "El hash no coincide" } # Ver si el hash coincide para todos los ficheros mkdir ficheros cd .\ficheros "hola" > fichero1.txt (Get-FileHash .\fichero1.txt).hash (Get-FileHash .\fichero1.txt).hash > fichero1integridad.txt "holas" > fichero2.txt (Get-FileHash .\fichero2.txt).hash (Get-FileHash .\fichero2.txt).hash > fichero2integridad.txt # Se supone que se ha comprimido # Hay fallo # Verificar que todos los hashes son correctos ls fichero?.txt | %{ $ficherointeg = $_.FullName $ficherointeg2 = $ficherointeg.replace(".txt","") $ficherofinal = ([String]$ficherointeg2+"integridad.txt") if(((Get-FileHash $_).hash) -eq (gc $ficherofinal)) { "El hash coincide" } else { "El hash no coincide" } } |