Repte 2.3:Restauració de backups
Com hem fet la creació de backups des de vagrant, aquesta tasca serà senzilla, ja que només cal fer una comanda, però explicaré el procés des de 0, un cop acabes el teu backup, que són snapshots del vagrant pot utilitzar aquesta comanda:
vagrant snapshot list En el meu cas:
[11:22:31][debian][hbarbera@hbarbera]-$ vagrant snapshot list
==> debianproxy: No snapshots have been taken yet!
debianproxy: You can take a snapshot using `vagrant snapshot save`. Note that
debianproxy: not all providers support this yet. Once a snapshot is taken, you
debianproxy: can list them using this command, and use commands such as
debianproxy: `vagrant snapshot restore` to go back to a certain snapshot.
==> router_2:
backup_20260410_110232
==> router_0: VM not created. Moving on...
==> router_9: VM not created. Moving on...
==> router_3: VM not created. Moving on...
==> rocky_client: VM not created. Moving on...
==> ubuntu: VM not created. Moving on...
==> w10: VM not created. Moving on...
==> debiandns:
backup_20260410_110232
==> debianslave: No snapshots have been taken yet!
debianslave: You can take a snapshot using `vagrant snapshot save`. Note that
debianslave: not all providers support this yet. Once a snapshot is taken, you
debianslave: can list them using this command, and use commands such as
debianslave: `vagrant snapshot restore` to go back to a certain snapshot.
==> debianldap: No snapshots have been taken yet!
debianldap: You can take a snapshot using `vagrant snapshot save`. Note that
debianldap: not all providers support this yet. Once a snapshot is taken, you
debianldap: can list them using this command, and use commands such as
debianldap: `vagrant snapshot restore` to go back to a certain snapshot.
==> rockyFTP:
backup_20260410_110232
==> rockyNFS: No snapshots have been taken yet!
rockyNFS: You can take a snapshot using `vagrant snapshot save`. Note that
rockyNFS: not all providers support this yet. Once a snapshot is taken, you
rockyNFS: can list them using this command, and use commands such as
rockyNFS: `vagrant snapshot restore` to go back to a certain snapshot.
==> debianlab: VM not created. Moving on...
==> rockylab: VM not created. Moving on...
==> rockylabgui: VM not created. Moving on...
==> ubuntulab: VM not created. Moving on...
==> w10lab: VM not created. Moving on...
[11:22:53][debian][hbarbera@hbarbera]-$
Com es pot veure, et diu quines màquines tenen fetes snapshots i quines no, el nostre script no força que cap màquina s’encengui, ja que volem assegurar-nos que no es trenqui res.
Una vegada tenim el nom dels backups només cal executar aquesta comanda:
vagrant snapshot restore router_2 backup_20260410_110232 Aquí estàs fent la restauració de la màquina “router_2” amb el backup “backup_20260410_110232”.
Un cop això queda fet ja tens la teva màquina restaurada.