Managing NVS Cards on SRP Modules
Each SRP module contains an NVS card that stores system files. In this documentation, the NVS card on the primary SRP module is referred to as the primary NVS card; the NVS card on the redundant SRP module is referred to as the redundant NVS card.
If you have two SRP modules installed in a system, you can use NVS cards of different capacities on the SRP modules. The effective capacity of the higher-capacity NVS card will equal that of the lower-capacity NVS card.
NVS Features
The software contains a number of features that optimize the way the system restores its configuration if it is shut down improperly:
- The system tracks improper shutdowns.
- If you shut down the system improperly, it will run an investigation of the file allocation table (FAT) the next time it reboots.
- The system creates backups of critical files.
- When you install a new NVS card or restart the system after shutting it down incorrectly, a utility scans the NVS card to detect corrupt sectors. If the utility finds files or directories that contain corrupt sectors, it removes the files and directories, because they can no longer be used. The utility also fixes problems with unused sectors. If the utility cannot correct a corrupt sector, it marks the sectors so that they cannot be reused.
- In a system that contains two SRP modules, if the scanning utility detects corrupt sectors in NVS on the primary SRP module during rebooting, the primary SRP module will reboot again. Both SRP modules will now have standby status and will be rebooting. The first SRP module to complete rebooting will assume the primary role. Because the former redundant module started to reboot first, it will probably assume the primary role. When the former primary has rebooted and the scan utility has fixed corrupt sectors in its NVS, the SRP modules will synchronize. Any files or directories removed by the scan utility will be restored during the synchronization.
- If you reboot the system before it has completely written configuration updates to NVS, the system will start with the last saved configuration. If you reboot the system after it has written the configuration updates to NVS, but before it has applied those updates to actual configuration data, the configuration update process resumes immediately following the reboot and completes before any application accesses its configuration data.
To prevent corruption of NVS cards, always issue the halt command before you remove an NVS card or an SRP module (see Removing an SRP Module). Always reboot the system using the rebooting procedure (see Chapter 8, Booting the System); do not reboot the system by switching it off and on.
Installing and Removing NVS Cards
For information about replacing NVS cards, see ERX Installation and User Guide, Chapter 3, Installing ERX Modules.
Synchronizing NVS Cards
If the system contains two SRP modules, it is important to keep the contents of the modules' NVS cards synchronized. Synchronization prevents the redundant NVS card from overwriting saved files on the primary NVS card if the primary SRP module fails and the redundant SRP module assumes control.
By default, autosynchronization is enabled on the system. Autosynchronization runs as a background process every 5 minutes, tracking changes in image, configuration, and script files, and keeping the two SRP modules synchronized. You can also synchronize the SRP modules manually by issuing the synchronization command.
Before synchronization, the system does the following:
- Checks that critical files on the primary SRP module are present. If there are missing files, the system does not proceed with the synchronization.
- Checks whether there is enough space on the redundant NVS to copy all the new or changed files from the primary NVS card.
Depending on the outcome of the second check, the system proceeds as follows:
- If there is enough space, the system copies new or changed files from the primary NVS card to the redundant NVS card without deleting any files on the redundant NVS card. If the system is interrupted when it is synchronizing with this method, the synchronization will resume when it has recovered from the interruption.
- If there is not enough space, the system deletes any files on the redundant NVS card that do not appear on the primary NVS card, then copies new or changed files from the primary NVS card to the redundant NVS card. If the system is interrupted when it is synchronizing with this method, it will not resume with the synchronization when it has recovered from the interruption.
If an SRP synchronization is in progress or has failed and the system is recovering, the system will prevent the redundant SRP module from assuming the primary role while the primary is rebooting, and for thirty seconds after the primary has rebooted. These conditions prevent a redundant SRP module with corrupted or missing files from becoming the primary and overwriting files or directories on the primary module.
synchronize
- Use to force the file system of the redundant SRP module to synchronize with the NVS file system of the primary SRP module.
- If you synchronize the redundant SRP module with the primary SRP module and the redundant module is armed with a release different from the one it is currently running, the redundant SRP module is automatically rebooted to load the armed release.
- Optionally, you can use the low-level-check keyword to force the system to validate all files or only configuration files in NVS, and to synchronize all files that failed the checksum test during the flash-disk-compare command as well as any other files that are unsynchronized. See Validating and Recovering Redundant SRP File Integrity later in this chapter for details.
- Examples
host1#synchronizehost1#synchronize low-level-check allhost1#synchronize low-level-check configurationSynchronizing NVS Cards of Different Capacities
If the capacity of the primary NVS card is equal to or smaller than that of the redundant NVS card, the system copies all the files from the primary NVS card to the redundant NVS card. However, if the capacity of the primary NVS card exceeds that of the redundant NVS card, the system creates an invisible synchronization reserve file on the primary NVS card, provided that there is enough space for the file.
The purpose of the synchronization file is to prevent the creation of data that will not fit on the redundant NVS card. The file contains no useful data, and is not visible when you view the files in NVS. The size of the file is equal to the difference in capacities of the two NVS cards. For example, if the primary NVS card has a capacity of 224 MB, and the redundant NVS card has a capacity of 220 MB, the size of the synchronization file is 4 MB, and only 220 MB of space is available on the primary NVS card.
If there is not enough space on the primary NVS card to create the synchronization reserve file, the synchronize command fails, and you see a warning message on the console. To resolve this issue, either delete unwanted files from the primary NVS card or replace the redundant NVS card with a higher-capacity NVS card.
Disabling Autosynchronization
If autosync is enabled while you are copying very long scripts or installing new software releases, it detects a disparity between the modules during the middle of the process. This feature causes significant unnecessary synchronization, resulting in prolonged copy times.
If you have installed a redundant SRP module, perform the following steps before copying long scripts:
- Turn off autosynchronization with the disable-autosync command.
- Perform the installation or copy the script.
- Reenable autosynchronization with the no disable-autosync command.
- Manually synchronize the modules with the synchronize command.
Refer to the commands and guidelines in the previous section and below.
disable-autosync
host1(config)#disable-autosync
- Use the no version to revert to the default situation, in which automatic synchronization runs as a background process every 5 minutes.
Validating and Recovering Redundant SRP File Integrity
Even when NVS cards on the primary and redundant SRP modules are synchronized, differences can exist in the content of files that reside on the primary NVS card and the redundant NVS card. You can use the flash-disk compare command to detect these differences so you can validate and, if necessary, recover the file integrity of the redundant SRP module.
The flash-disk compare command validates only those files that are synchronized between the primary and redundant SRP modules. It does not compare files that are normally excluded from the synchronization process, such as log files and core dump files. The command uses a simple checksum error detection algorithm to compare the contents of a file residing on the NVS card of the primary SRP module with the contents of the same file residing on the NVS card of the redundant SRP module.
To validate and recover redundant SRP file integrity:
- Ensure that the file systems on the primary NVS card and the redundant NVS card are synchronized. (See Synchronizing NVS Cards earlier in this chapter for details.)
- Issue the flash-disk compare command, specifying whether to perform the checksum validation for all files in NVS or only for configuration files.
host1#flash-disk compare allhost1#flash-disk compare configurationThe flash-disk compare configuration command, which validates only configuration files, excludes larger files such as software releases and scripts from the validation process. As a result, this command takes less time to complete than the flash-disk compare all command, which validates all NVS files.
If the flash-disk compare command detects differences in the content of one or more files, the system reports a checksum test failure.
- If one or more files failed the checksum validation, determine whether the corrupted files reside on the primary SRP module or on the redundant SRP module.
- If the corrupted file resides on the primary SRP module, issue the srp switch command to force a switch from the primary SRP module to the redundant SRP module.
This action ensures that the error-free version of the file will be on the SRP module that assumes control after the switch.
- Validate all files in NVS (when you use the all keyword) or only configuration files in NVS (when you use the configuration keyword).
- Synchronize all files that failed the checksum test during the flash-disk compare command, as well as any other unsynchronized files.
host1#synchronize low-level-check allhost1#synchronize low-level-check configurationThis action should resolve any file discrepancies between the primary and redundant SRP modules and restore SRP file integrity.
Note: Both the flash-disk compare and synchronize low-level-check commands perform CPU-intensive processing that can take several minutes to complete. For best results, do not run these commands simultaneously on the same system. In addition, do not run multiple instances of the flash-disk-compare command simultaneously on the same system.![]()
flash-disk compare
- Use to perform a checksum validation that compares the contents of the NVS file system on the primary SRP module with the contents of the NVS file system on the redundant SRP module.
- The command validates only those files that are synchronized between the primary and redundant SRP modules; it does not validate log files, core dump files, and other files that are excluded from the system synchronization process.
- Specify one of the following keywords:
- all - compares all files in NVS; this option can take several minutes to complete
- configuration - compares only configuration files; this option takes less time to complete because it compares only a subset of the files in the NVS file system
- If all files pass the validation test, the system reports that all checksums matched and displays the total number of files and total number of bytes of information compared.
- If one or more files fail the validation test, the system reports a checksum test failure and does not display the total number of files and bytes compared.
- If one or more of the following conditions exist, the command fails and the system displays a message that explains why it cannot perform the checksum test:
- The file systems on the primary NVS card and the redundant NVS card are not synchronized.
- The system does not contain a redundant SRP module.
- The redundant SRP module is offline.
host1#flash-disk compare allWARNING: This command may take several minutes to complete.Proceed? [confirm]WARNING: No changes should be made to the system while this command is inprogress.Please wait.........................................................All file checksums matched.Number of Files = 866Number of Bytes = 61660650host1#flash-disk compare configurationWARNING: This command may take several minutes to complete.Proceed? [confirm]WARNING: No changes should be made to the system while this command is inprogress.Please wait......At least one configuration file failed checksum test.synchronize
- Use to force the NVS file system of the redundant SRP module to synchronize with the NVS file system of the primary SRP module.
- If you synchronize the redundant SRP module with the primary SRP module and the redundant module is armed with a release different from the one it is currently running, the redundant SRP module is automatically rebooted to load the armed release.
- Optionally, you can use the low-level-check keyword to force the system to validate all files or only configuration files in NVS, and to synchronize all files that failed the checksum validation test during the flash-disk-compare command as well as any other files that are unsynchronized.
- When you use the low-level-check keyword, you must also specify one of the following keywords:
- all - validates all files in NVS, and synchronizes all files that failed the checksum test as well as any other unsynchronized files; this option can take several minutes to complete
- configuration - validates all configuration files in NVS, and synchronizes all files that failed the checksum test as well as any other unsynchronized files; this option takes less time to complete because it validates only a subset of the files in the NVS file system
- If one or more of the following conditions exist when you use the low-level-check keyword, the command fails and the system displays a message that explains why it cannot perform the synchronization:
- The system does not contain a redundant SRP module.
- The redundant SRP module is offline.
- The armed releases are different on the primary SRP and redundant SRP.
host1#synchronizehost1#synchronize low-level-check allhost1#synchronize low-level-check configurationReformatting the Primary NVS Card
You can reformat the primary NVS card. To do so:
- From Privileged Exec mode, enter the reload command. Information on the reloading process displays.
- When the countdown begins, press the <mb> key sequence (case-insensitive).
This puts the CLI in Boot mode (:boot## prompt).
If you do not press the <mb> key sequence, the reloading process continues and returns the CLI to the normal User Exec mode.flash-disk initialize
Note: This command is available only in the Boot mode.![]()
host1#halt primaryhost1#reloadWARNING: Execution of this command will cause the system to reboot.Proceed with reload? [confirm]Reload operation commencing, please wait...[ Press mb]:boot##flash-disk initializeCopying the Image on the Primary SRP Module
You can copy the contents of NVS on the primary SRP module to a spare NVS card. To do so:
- From Privileged Exec mode, enter the reload command. Information on the reloading process displays.
- When the countdown begins, press the <mb> key sequence (case-insensitive).
This action puts the CLI in Boot mode (:boot## prompt).
If you do not press the <mb> key sequence, the reloading process continues and returns the CLI to the normal User Exec mode.
- Issue the flash-disk duplicate command.
- Follow the instructions on the screen. When prompted, insert the original or spare NVS card in the primary SRP module.
flash-disk duplicate
- Use to copy the contents of the primary NVS card to a spare NVS card.
- The primary and spare NVS cards must be from the same manufacturer and must have the same size.
Note: This command is available only in the Boot mode.![]()
- When you issue the flash-disk duplicate command, insert the original and spare NVS cards when prompted. The system copies the NVS contents incrementally, so you may need to exchange the NVS cards several times.
- Example
host1#halt primaryhost1#reloadWARNING: Execution of this command will cause the system to reboot.Proceed with reload? [confirm]Reload operation commencing, please wait...[ Press mb]:boot##flash-disk duplicateScanning NVS Cards
You can find both structural errors in the data in NVS and physical errors in the NVS card. You can also remove files with errors, and attempt to repair structural or physical errors.
check-disk
- Use to find and repair structural inconsistencies and damage in the DOS file system in NVS on the primary SRP module.
Note: This command is available only in the Boot mode.![]()
- If the system contains primary and redundant modules, only NVS on the primary SRP module will be scanned.
- Example
:boot##check-diskCopyright (c) 1993-1996 RST Software Industries Ltd. Israel. All rights reservedver: 2.6 FCSDisk Check In Progress ...total disk space (bytes) : 512,122,880bytes in each allocation unit : 8,192total allocation units on disk : 62,515bad allocation units : 1available bytes on disk : 120,651,776available clusters on disk : 14,728maximum available contiguous chain (bytes) : 120,651,776available space fragmentation (%) : 0clusters allocated : 47,786Done Checking Disk.flash-disk scan
- Use to find and repair files physical errors in NVS. These errors are created if the system is not powered down or reset correctly.
Note: This command is available only in the Boot mode.![]()
- If the system contains primary and redundant modules, only NVS on the primary SRP module will be scanned.
- If the repair fails, the system will no longer use the corrupted areas.
- Example
In this example, the user scans NVS and finds one file with an error. The user then issues the flash-disk scan with the repair keyword to remove the file. Finally, the user scans NVS again, and finds no files with errors.:boot##flash-disk scanProceed with Flash disk scan? [confirm]Srp PCMCIA Card Scan...Boot Block OKFile Allocation Table OKRoot Directory OKChecking File SpacePlease Wait...Checking Free SpacePlease Wait...PCMCIA Card Scan Detected Errors in:\\images\ct1Diag\ct1Diag3c440e9e.cmpPCMCIA Card Scan successful!:boot##flash-disk scan repairWARNING: Execution of this command may cause the contents of the Flash disk tobe modified.Proceed with Flash disk scan? [confirm]Srp PCMCIA Card Scan...Boot Block OKFile Allocation Table OKRoot Directory OKChecking File SpacePlease Wait...Checking Free SpacePlease Wait...PCMCIA Card Scan Removed:\\images\ct1Diag\ct1Diag3c440e9e.cmpPCMCIA Card Scan successful!:boot##flash-disk scanProceed with Flash disk scan? [confirm]Srp PCMCIA Card Scan...Boot Block OKFile Allocation Table OKRoot Directory OKChecking File SpacePlease Wait...Checking Free SpacePlease Wait...PCMCIA Card Scan successful!Monitoring NVS Cards
Use the show nvs command to monitor the status of NVS on the primary SRP module. Use the show flash command to view information about the NVS card.
show nvs
- total nvs file sizes - sum of sizes of all files in NVS, in bytes
- total nvs file errors - number of read and write errors in all files in NVS
- nvs flash in use - NVS used, in bytes
- available nvs flash - NVS available, in bytes
host1#show nvstotal nvs file sizes = 228864total nvs file errors = 0nvs flash in use = 1265152available nvs flash = 35435008show flash
- Flash Manufacturer - name of manufacturer of the NVS card
- Capacity - total capacity of the NVS card, in bytes
host1#show flashFlash Manufacturer: STI Capacity: 224133120