Snapshots in JunOS
Storage Volumes
Juniper’s EX-series switches are resilient. One of the ways they achieve this is to have two storage volumes:
- /dev/gpt/junos – The primary partition; This is where JunOS boots from, and where logs go
- /dev/gpt/oam – OAM is Operations, Administration, and Maintenance; This is a backup volume that is used if the primary volume fails
Snapshots
Snapshots are used to backup the configuration, software packages, and so on. They are stored on the volumes listed above.
A recovery snapshot is stored on the OAM volume, and is used to recover the system in the case of a major failure. This can be used to rebuild the Junos volume if necessary. There is only one of these snapshots.
A non-recovery snapshot is stored in the Junos volume. It contains a backup of the configuration, and a pointer to the software packages in use at the time it was created. There can be several of these snapshots.
Using Snapshots
Use show system snapshot to see if any snapshots have been created.
user@Switch01> show system snapshot fpc0: -------------------------------------------------------------------------- No non-recovery snapshots available on the Junos volume Recovery Snapshots: Snapshots available on the OAM volume: recovery.ufs Date created: Thu Jan 1 10:31:35 AEST 1970 Junos version: 18.1R3.3 Total recovery snapshots: 1
In this example, there is a recovery snapshot, and no non-recovery snapshots. To create a snapshot, use request system snapshot [recovery]. This can take quite a while to run.
User@Switch01> request system snapshot recovery fpc0: -------------------------------------------------------------------------- Creating image ... Compressing image ... Image size is 248MB Recovery snapshot created successfully
You may need to clean up some additional space before running this command.
Select a snapshot to load on reboot with request system snapshot load [snapshot-name].
Volume Recovery
Both the junos and the oam volumes can be rebuilt. Recover the junos volume from the OAM if the device won’t boot.
Sometimes the oam volume may need to be rebuilt if, for example, there is a ‘no space left on device’ error.
This can be done with the request system recover command:
User@Switch01> request system recover oam-volume NOTICE: Recovering the OAM volume ... da0p1 deleted da0p1 added /dev/gpt/oam: 500.0MB (1024000 sectors) block size 32768, fragment size 4096 using 4 cylinder groups of 125.03MB, 4001 blks, 16128 inodes. super-block backups (for fsck_ffs -b #) at: 192, 256256, 512320, 768384 Verified oam signed by PackageProductionEc_2018 method ECDSA256+SHA256 Installing OAM volume contents ... The OAM volume is now installed NOTICE: Creating a recovery snapshot on the OAM volume ... Creating image ... Compressing image ...
References
Juniper – Recovery and non-recovery snapshots on EX2300/EX3400
Juniper – request system recover