Courseiva
SystemPrivileged EXEC

write memory

Saves the current running configuration to the startup configuration in NVRAM, ensuring changes persist after a reload.

Definition: write memory is a Cisco IOS privileged exec command. Saves the current running configuration to the startup configuration in NVRAM, ensuring changes persist after a reload.

Overview

The 'write memory' command is a fundamental IOS command that saves the current running configuration to the startup configuration stored in NVRAM. This ensures that all configuration changes made during a session persist after a router or switch reload. The command is synonymous with 'copy running-config startup-config' and is often preferred by experienced engineers for its brevity.

Understanding this command is critical for CCNA and CCNP candidates because it directly impacts configuration management and disaster recovery. Without saving changes, any configuration applied during a session is lost upon reboot, which can lead to network outages or security vulnerabilities. The command operates at the system level, requiring privileged EXEC mode (enable mode).

It writes the entire running configuration to the startup configuration file, overwriting the previous startup config. This is a non-disruptive operation that does not affect the running configuration or network traffic. However, it is important to note that the command does not validate the configuration; it simply saves whatever is currently in the running config.

Therefore, engineers should verify the running configuration before saving to avoid propagating errors. In a broader workflow, 'write memory' is typically the final step after making changes, following verification with 'show running-config' or 'show ip interface brief'. Alternatives include 'copy running-config startup-config' (more explicit) or 'copy running-config tftp:' for backup.

The command is available in all IOS versions and platforms, including IOS-XE, though in some modern platforms, the startup configuration may be stored in a different location (e.g., flash: instead of NVRAM). The command also has a variant 'write erase' to delete the startup configuration. Privilege level 15 is required to execute 'write memory'.

The output is minimal: it simply displays '[OK]' upon success or an error message if the write fails (e.g., due to insufficient NVRAM space). This command is one of the first that network engineers learn, as it is essential for making configuration changes permanent.

Syntax·Privileged EXEC
write memory

When to Use This Command

  • After making configuration changes on a router or switch, use this command to save them so they survive a reboot.
  • Before performing a reload or power cycle, run this command to preserve the current configuration.
  • When deploying a new device, after initial configuration is complete, save the configuration to NVRAM.
  • After troubleshooting and applying a fix, save the configuration to ensure the fix is permanent.

Command Examples

Basic save of running configuration

write memory
Building configuration...
[OK]

The output 'Building configuration...' indicates the router is compiling the running config into a format for NVRAM. '[OK]' confirms the save was successful.

Alternative command with same effect

copy running-config startup-config
Destination filename [startup-config]? 
Building configuration...
[OK]

This is the longer form of the same command. It prompts for a filename (default is startup-config). Press Enter to accept. The output confirms success.

Understanding the Output

The output of 'write memory' is minimal. It first displays 'Building configuration...' which means the router is processing the running configuration and preparing to write it to NVRAM. Then it shows '[OK]' to indicate the write was successful.

If there is an error (e.g., NVRAM full or hardware failure), you might see 'Error writing to NVRAM' or similar. A successful save is critical for configuration persistence; without it, all changes are lost on reload.

Configuration Scenarios

Save OSPF Configuration on a Branch Router

A network engineer has configured OSPF on a branch router (R1) to establish connectivity with the head office. After verifying that OSPF neighbors are up, the engineer needs to save the configuration so that it persists after a reload.

Topology

R1(Gi0/0)---10.0.12.0/30---(Gi0/0)R2

Steps

  1. 1.Step 1: Enter privileged EXEC mode: R1> enable
  2. 2.Step 2: Verify the running configuration: R1# show running-config | section router ospf
  3. 3.Step 3: Save the configuration: R1# write memory
  4. 4.Step 4: Confirm the save: R1# show startup-config | section router ospf
Configuration
! OSPF configuration on R1
router ospf 1
 network 10.0.12.0 0.0.0.3 area 0
 network 192.168.1.0 0.0.0.255 area 0
! Save
R1# write memory
Building configuration...
[OK]

Verify: R1# show startup-config | section router ospf router ospf 1 network 10.0.12.0 0.0.0.3 area 0 network 192.168.1.0 0.0.0.255 area 0

Watch out: Forgetting to save after making changes is a common mistake. If the router reloads unexpectedly, all unsaved changes are lost. Always verify the running config before saving.

Save VLAN Configuration on a Catalyst Switch

A network administrator has created new VLANs and assigned access ports on a Catalyst 2960 switch. To ensure these VLANs survive a power cycle, the configuration must be saved to startup config.

Topology

SW1(Gi0/1)---PC1 SW1(Gi0/2)---PC2

Steps

  1. 1.Step 1: Enter privileged EXEC mode: SW1> enable
  2. 2.Step 2: Verify VLAN configuration: SW1# show vlan brief
  3. 3.Step 3: Save the configuration: SW1# write memory
  4. 4.Step 4: Verify saved configuration: SW1# show startup-config | include vlan
Configuration
! VLAN configuration on SW1
vlan 10
 name Sales
vlan 20
 name Engineering
interface GigabitEthernet0/1
 switchport mode access
 switchport access vlan 10
interface GigabitEthernet0/2
 switchport mode access
 switchport access vlan 20
! Save
SW1# write memory
Building configuration...
[OK]

Verify: SW1# show startup-config | include vlan vlan 10 name Sales vlan 20 name Engineering

Watch out: On some older switches, VLAN configuration is stored in a separate VLAN database file (vlan.dat) and not in the startup config. In such cases, 'write memory' may not save VLANs; use 'copy running-config startup-config' or 'copy vlan.dat flash:vlan.dat' instead. Modern IOS switches store VLAN config in the running config.

Troubleshooting with This Command

When troubleshooting configuration persistence issues, 'write memory' is often the first command to check. If a device loses configuration after a reload, the most common cause is that the running configuration was not saved. To diagnose, start by examining the startup configuration with 'show startup-config'.

If it is empty or missing expected changes, the configuration was not saved. Next, verify the running configuration with 'show running-config' to confirm the desired configuration is present. If the running config is correct but the startup config is not, simply execute 'write memory'.

However, if the running config itself is incorrect, do not save it; instead, correct the configuration first. Another scenario is when the startup configuration file is corrupted or the NVRAM is full. In such cases, 'write memory' may fail with an error message like 'Error: NVRAM full' or 'Error: cannot write to NVRAM'.

To resolve, delete unnecessary files from NVRAM or use 'erase startup-config' and then save again. For devices with redundant supervisors or dual flash, ensure the configuration is saved to the correct location. In some IOS versions, 'write memory' may prompt for confirmation if the startup config is empty.

Always look for the '[OK]' message to confirm success. If the command hangs, it may indicate a hardware issue with NVRAM. Correlate with 'show file systems' to verify available space.

Additionally, if the device is part of a high-availability pair (e.g., VSS or StackWise), ensure both devices have their configurations synchronized. The 'write memory' command only saves to the local device; for redundancy, use 'copy running-config stby-startup-config' on some platforms. Finally, remember that 'write memory' does not save the configuration to external storage; for backups, use 'copy running-config tftp:' or 'copy running-config flash:backup-config'.

By following these steps, engineers can quickly resolve configuration persistence issues.

CCNA Exam Tips

1.

CCNA exam tip: 'write memory' and 'copy running-config startup-config' are equivalent; know both.

2.

CCNA exam tip: The command must be executed in Privileged EXEC mode (enable mode).

3.

CCNA exam tip: If you forget to save, a reload will revert to the last saved configuration.

4.

CCNA exam tip: On some older IOS versions, 'write memory' is deprecated but still works.

Common Mistakes

Mistake 1: Running 'write memory' in User EXEC mode (>) instead of Privileged EXEC mode (#) — results in '% Invalid input detected'.

Mistake 2: Assuming 'write memory' saves to a remote server (it saves to local NVRAM).

Mistake 3: Forgetting to save after making changes, then reloading and losing all changes.

write memory vs show running-config

These two commands are often mentioned together because they both involve the running configuration, but they serve very different purposes. 'write memory' persists changes, while 'show running-config' only displays the current state. Confusion arises when engineers forget to save after verifying changes.

Aspectwrite memoryshow running-config
ScopeSaves running config to NVRAM for persistenceDisplays active configuration from DRAM
Configuration modePrivileged EXECPrivileged EXEC
PersistenceSurvives reloadLost on reload
PrecedenceUpdates startup config; overrides previous saved configReads from running memory; no effect on saved config
Typical useAfter making desired changes, to ensure they survive rebootTo verify current config, troubleshoot, or capture output

Use write memory when you are satisfied with the running configuration and want to make it permanent across reloads.

Use show running-config when you need to inspect the current active settings or compare them against a baseline.

Platform Notes

In IOS-XE (e.g., Catalyst 9000 series), 'write memory' behaves identically to classic IOS, but the startup configuration is stored in the 'bootflash:' directory as 'startup-config' rather than in NVRAM. The command is fully supported. In NX-OS (e.g., Nexus switches), the equivalent command is 'copy running-config startup-config' or 'copy run start'.

The 'write memory' command is not available in NX-OS; instead, use 'copy running-config startup-config' or the abbreviated 'copy run start'. On ASA firewalls, the command is 'write memory' (or 'copy running-config startup-config') and works similarly, saving to the startup config in flash. In IOS-XR (e.g., ASR 9000), the command is 'commit' for committing changes to the running configuration, and then 'copy running-config startup-config' to save to the startup config.

'write memory' is not supported in IOS-XR. Across IOS versions (12.x, 15.x, 16.x), the command syntax and behavior are consistent, though in very old versions (e.g., IOS 11.x), the command may be 'write memory' or 'write terminal' for display. Always check the specific platform documentation.

For CCNA/CCNP exams, know that 'write memory' is valid for IOS-based devices, but for NX-OS and IOS-XR, use the appropriate commands.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with practice questions covering all CCNA 200-301 exam domains.

Practice CCNA 200-301 Questions