Managing File Systems and the Swap Drive

Overview

Changes to the Primary File System in Cisco IOS XE 17.10.1

From Cisco IOS XE 17.10.1, the flash file system on IE switches is the primary file system for booting an IE switch, regardless of whether an SD card is present. The primary file system can no longer be configured. If the IE switch cannot find a configuration in flash, it will attempt to find one in sdflash, then copy the configuration and IOS XE image to flash, and boot from flash as described in the following section.

The sync command after 17.10.1 works only in on direction - from flash to sdflash - as the sync from sdflash to flash is an automated process.

Swap Drive

The Swap Drive feature allows you to use SD card as a backup for the startup configuration and the IOS XE .bin or install file. You can remove the SD card from one IE switch and install into a new IE switch. When the new IE switch (without a startup configuration in flash) is powered on, it checks flash for a configuration file. If the file is not found, the switch looks for a configuration file in the sdflash. If found, it:

  • automatically copies the startup configuration and IOS XE files from sdflash to flash

  • automatically reboots, and

  • boots with the copied files from the previous IE switch.

Booting the Switch from Flash or an SD Card

Prior to Cisco IOS XE 17.10.1, the switch could boot from either its internal flash memory or an SD card, with the SD card taking precedence. If an SD card was installed, the switch attempted to boot in the following order:

  1. From the Cisco IOS-XE image that is specified in the boot path.

  2. From the Cisco IOS-XE image in the SD card.

  3. From the Cisco IOS-XE image in the internal flash.

SD Card Support, Formatting Options, and Usage Considerations

  • The switch does not support third-party SD cards or SD High Capacity (SDHC) cards. Attempting to use a non-supported card results in the following message being displayed:

    WARNING: Non-IT SD flash detected.
    Use of this card during normal operation can impact and
    severely degrade performance of the system.
    Please use supported SD flash cards only. 
  • If the write-protect switch on the SD card is in the lock position, the switch can read data on the card and boot from the card. However, updates and files cannot be written to the card.


Note


After running the write erase command and reloading the device, the message "% failed to initialize nvram" may appear during bootup. This is a harmless message and does not indicate a functional issue.


ROM Monitor Variables and Configuration Handling

The following table explains the ROM Monitor variables and configurations.

Table 1. ROM Monitor Variables and Configuration Handling

Configuration Set

Description

Storage Location

ROM variables (romvars) and configurations are always stored and retrieved from flash.

Auto Install Condition

If flash is empty, the Cisco IOS-XE software triggers auto install by copying the first available image to flash from removable media.

Boot Precedence

  1. Boot using image path set in VAR.

  2. Install boot using packages.conf file from flash.

  3. Bundle boot using bootable image from flash.

  4. Bundle boot using bootable image (can be .conf or .bin) located in the sdflash.

  5. Bundle boot using bootable image (can be .conf or .bin) located in the usbflash.

SD Card Operation

You can insert or remove an SD card while Cisco IOS-XE is running. If you insert a supported Cisco SD card while Cisco IOS-XE is running, the switch validates the Cisco-embedded string in the Product Name (PNM) field and displays the product number and the flash capacity of the SD card. If you remove an SD card while Cisco IOS-XE is running, the switch displays a warning message to alert you that the SD card has been removed.

If syslog is enabled, the system also sends a message when the SD card is inserted or removed.

Boot Loader Commands

The following boot loader commands can be executed on an SD card:

  • boot—Load and boot an executable Cisco IOS XE image

  • cat—Concatenate (type) a file or files

  • copy—Copy a file

  • dir—List files in directories

  • fsck—Check file system consistency

  • format—Format a file system

  • mkdir—Create directories

  • more—Concatenate (display) file

  • rename—Rename a file

  • rmdir—Delete empty directories

  • sd_init—Initialize SD flash file systems

How Commands Work with SD Cards

When an SD card is installed in the switch, the write, boot, and sync commands behave as described below.

write Command

The write command saves the running configuration. See the table below for command behavior details.

Table 2. write command behavior from 17.10.1
Command Boot Source SD Card Status Behavior
write SD card Present Saves running configuration to internal flash
write SD card Removed Saves running configuration to internal flash
write Internal flash Present Saves running configuration to internal flash
Table 3. write command behavior before 17.10.1
Command Boot Source SD Card Status Behavior Message Displayed
write SD card Present Saves running configuration to SD card None
write SD card Removed Saves running configuration to internal flash

WARNING: The SD flash is not present. The running-config is saved to the on-board flash.

NOTE: This warning message is displayed only once.

write Internal flash Present Saves running configuration to internal flash None

boot Command

The boot command lets you change the system boot parameters. See the table below for command behavior details.

Table 4. boot Command (SD Card Boot Behavior from 17.10.1)
Command Boot Source SD Card Status Behavior
boot SD card Present
  • If the path points to SD card: saved to SD card

  • If the path points to flash: saved to flash

boot SD card Removed
  • If the path points to SD card: an error is displayed stating that SD card is not available.

  • If the path points to flash: saved to flash

boot Internal flash Inserted
  • If the path points to flash: saved to flash

  • If the path points to SD card: saved to SD card

Table 5. boot Command (SD Card Boot Behavior Prior to 17.10.1)
Command Boot Source SD Card Status Behavior Message Displayed
boot SD card Present
  • If the path points to SD card: saved to SD card

  • If the path points to flash: saved to flash

None
boot SD card Removed Boot/config path not saved; system attempts to boot from flash if image is available

WARNING: The BOOT/config file path points to the SD flash card and the SD flash card is not present. The environment variable(s) is not saved.

NOTE: This warning message is displayed only once.

boot Internal flash Inserted
  • If the path points to flash: saved to flash

  • If the path points to SD card: saved to SD card

None
Table 6. boot Command (Internal Flash Boot Behavior with SD Card Inserted from 17.10.1)
Command Boot Source SD Card Status Behavior
boot Internal flash Present
  • If the boot path points to internal flash, system boot path is set to flash

  • If the boot path points to SD card, system boot path is set to SD card

Note

 

The configuration path cannot be set manually, as it is always stored in internal flash memory.

Table 7. boot Command (Internal Flash Boot Behavior with SD Card Inserted prior to 17.10.1)
Command Boot Source SD Card Status Behavior Message Displayed
boot Internal flash Present If the boot or config path points to internal flash, the system boot path or config file is saved to internal flash None
boot Internal flash Removed If the boot or config path points to SD card, the system boot path or config file is saved to SD card

WARNING: The BOOT/config file path points to the SD flash card. The environment variable(s) is saved onto the SD flash card.

NOTE: This warning message is displayed only once.

sync Command

The sync command copies the Cisco IOS-XE image directory, configuration files, and boot parameters from the internal flash memory to the SD card. Prior to 17.10.1, you could copy from the SD card to the internal flash memory as well.

Table 8. Components and Files Copied by sync Command

Component

Included Files

Cisco IOS XE Image Directory

  • Cisco IOS XE image file (.bin)

  • Device Manager files

  • Profinet/CIP configuration files

Configuration Files

  • NVRAM config files

  • VLAN configuration file (vlan.dat)

  • DLR, PNP, and CIP config files

Boot Parameters

Cisco IOS XE boot parameters

Prior to 17.10.1

After copying the files, the sync command verifies whether the Cisco IOS-XE image is appropriate for the switch model and that sufficient destination flash memory is available. If a potential issue is detected, the sync process is aborted.

When the verification is successful, the sync command retrieves the files from the SD card and overwrites the destination Cisco IOS-XE image directory and configuration files. By default, the sync command overwrites the destination files. However, there is an option to save the old files, overriding this default behavior.


Note


If the running configuration has not been saved before running the sync command, the switch prompts you to save the running configuration before proceeding.


Table 9. sync Command Options
Command Purpose

Examples

sync sdflash

Synchronizes the Cisco IOS-XE image directory, configuration files, and boot parameters from internal flash memory to the SD card and restores the IE switch in install mode by default.

Switch# sync sdflash

sync sdflash: ios-image <ios-image-name>

Synchronizes the Cisco IOS-XE image directory from internal flash memory to the SD card.

Switch# sync sdflash: ios-image ie3x00-universalk9.17.10.01.SPA.bin

sync sdflash: restore-bundle

Synchronizes the Cisco IOS-XE image directory from internal flash memory to the SD card to restore the IE switch in bundle mode.

Switch# sync sdflash: restore-bundle

sync sdflash: skip [all|config|ios-image]

Synchronizes either the Cisco IOS-XE configuration or the Cisco IOS-XE image directory flash memory to the SD card.

Switch# sync sdflash: skip ios-image

SD Card Alarms

The SD card alarms notify users of potential issues related to the SD card. See the table below for alarm details.

By default, the SD card alarms are disabled. To activate the alarms, use the options of the alarm facility sd-card global configuration command. Additionally, you can configure the alarms and associated traps to be sent to syslog and the SNMP server.

Table 10. SD card alarm facility command options
Command Purpose

Examples

enable Enables the SD card alarm feature

Switch(config)# alarm facility sd-card enable

notifies Enables notifications to the server

Switch(config)# alarm facility sd-card notifies

relay Enables relay setting

Switch(config)# alarm facility sd-card relay major

syslog Enables system logging

Switch(config)# alarm facility sd-card syslog


Note


To disable the alarm, use the following commands:

no alarm facility sd-card enable— disables the alarm facility enabled for the SD card.

clear facility-alarm—clears the alarm warning state for the alarms configured on the switch.


Inserting and Removing the SD Card

Inserting an SD Card into the Switch

  1. Ensure the SD card is oriented correctly.

  2. Gently press the SD card into the SD card slot on the switch until it clicks into place.

When an SD card is inserted, the system logs a syslog message similar to:

 Mar 30 01:38:51.965: %FLASH-6-DEVICE_INSERTED: Flash device inserted 

Removing an SD Card from the Switch

  1. Press the SD card inward slightly to release it.

  2. Once it ejects, pull the card straight out of the slot.

When an SD card is removed, the system logs a syslog message similar to:

 Mar 30 01:39:12.467: %FLASH-1-DEVICE_REMOVED: Flash device removed 

Hot-Swappable Behavior

  • The SD card is hot-swappable—it can be inserted or removed while Cisco IOS XE is running.

  • Do not remove the SD card during the boot process or when a write operation to sdflash is in progress.

Enabling an SD Card

Procedure


Step 1

To enable an SD card on a Cisco IOS XE switch, use one of the following options:

  • ROMMON mode: Set the SD card related ROMMON variable to no.
Switch# set var DISABLE_SD_FLASH=no 
  • Switch CLI mode: Enable the SD card from the switch using the command in the configuration mode.
Switch(config)# sdflash 

Step 2

(Optional) To confirm whether the SD card is enabled, use the show file systems command.

Switch# show file systems 

File Systems:

Size(b) Free(b) Type Flags Prefixes
- - opaque rw system:
- - opaque rw tmpsys:
518885376 474765312 disk rw crashinfo:
* 1697755136 1133522944 disk rw flash: bootflash:
3967811584 3962859520 disk rw sdflash:
1711341568 1645002752 disk ro webui:
- - opaque ro xmodem:
- - opaque ro ymodem:
- - opaque rw null:
- - opaque ro tar:
- - network rw tftp:
33554432 33492400 nvram rw nvram: 

Step 3

(Optional) To confirm that the SD card has been enabled, use the dir sdflash: command.

Switch# dir sdflash:

Directory of sdflash:/

5 drwx 4096 Nov 4 2024 12:25:50 +00:00 System Volume Information
8 drwx 4096 Nov 4 2024 07:11:22 +00:00 ProfinetGSD
7 drwx 8192 Nov 4 2024 07:10:50 +00:00 EDScisco
6 drwx 4096 Jun 17 2014 23:49:52 +00:00 moncfg 


Disabling an SD Card

To disable an SD card on a Cisco IOS XE switch, use one of the methods given in the procedure below:

Procedure


Step 1

To disable an SD card on a Cisco IOS XE switch, use one of the following options:

  • ROMMON mode: Set the SD card related ROMMON variable to yes.
Switch# set var DISABLE_SD_FLASH=yes 
  • Switch CLI mode: Disable the SD card from the switch using the command in the configuration mode.
Switch(config)# no sdflash 

Step 2

(Optional) After logging in to the switch, the SD card will not appear in the list of file systems. To confirm, use the show file systems command.

Switch# show file systems 

File Systems:
Size(b) Free(b) Type Flags Prefixes
- - opaque rw system:
- - opaque rw tmpsys:
518885376 474765312 disk rw crashinfo:
* 1697755136 1133522944 disk rw flash: bootflash:
1711341568 1645002752 disk ro webui: 
- - opaque ro xmodem:
- - opaque ro ymodem:
- - opaque rw null:
- - opaque ro tar:
- - network rw tftp:
33554432 33492400 nvram rw nvram:
- - opaque wo syslog:

 

Step 3

(Optional) To confirm that the SD card has been disabled, use the dir sdflash: command.

Switch# dir sdflash:

%Error opening flash:/sdflash (No such file or directory)


Configuring Auto Sync from Internal Flash to SD Card

Use the procedure given here to configure the auto sync from internal flash to an SD card.

Procedure


Step 1

Use the auto sync enable command to enable the auto sync service, allowing the system to automatically synchronize files from the internal flash to the SD card.

Switch# auto sync enable

Step 2

Use the auto sync run time hh:mm:ss command to configure the time of day when the auto sync service should run.

Switch# auto sync run time 02:00:00

Step 3

(Optional) Use the auto sync config sdflash: restore-bundle command to set up auto sync for restoring configurations and image files using bundle mode.

Switch# auto sync config sdflash: restore-bundle

Step 4

(Optional) Use the auto sync config sdflash: skip ios-image command to configure the auto sync to exclude IOS image files, syncing only the configuration files.

Switch# auto sync config sdflash: skip ios-image

Step 5

(Optional) Use the auto sync config sdflash: skip config command to skip configuration files and sync only the IOS image.

Switch# auto sync config sdflash: skip config

Step 6

(Optional) Use auto sync config sdflash: ios-image image_name command to replace the existing image with the name of the image file you wish to sync.

Switch# auto sync config sdflash: ios-image ie3x00-universalk9.17.10.01.SPA.bin

Auto Restore of Switch Configurations with SD Swap Drive

This task shows how to automatically restore a switch using the Swap Drive feature with an SD card.


Note


  • You cannot use the packages from the SD card to load or boot the IE3x00 devices. Do not run the boot sdflash:packages.conf command at the switch prompt.

  • If you are operating in install mode and the IE switch is loading package files (*.pkg) using the file packages.conf, do not use the sync sdflash: restore-bundle command:

  • To load the device in bundle mode using the boot file as an image (for example, ie3k_iosxe.17.17.01.SPA.bin), use the sync sdflash:restore-bundle command to sync the image and restore the switch. After recovery, the switch will come up in bundle mode.


Procedure


Step 1

Run the write memory command on the switch before inserting the SD card.

Step 2

Run the sync sdflash: command to synchronize from internal flash to SD card. This saves the startup configuration and Cisco IOS-XE bundle images on the switch to the SD card.

Step 3

Insert the SD card with the startup configuration and the Cisco IOS-XE bundle images into the new switch.

Step 4

Power on the new switch.

The switch automatically restores and loads the startup configuration and Cisco IOS-XE bundle image from the SD card to the switch.

Formatting the SD Card to Load Cisco IOx

If you plan to run Cisco IOx applications on the switch, the SD card needs to be formatted in EXT4 format.

If you plan to run both Cisco IOS-XE and Cisco IOx applications, use the partition sdflash command to create both FAT32 and EXT4 partitions on the SD card:

  • The first partition is the FAT32 partition for Cisco IOS XE, and requires minimum of 1 GB space..

  • The second partition is the EXT4 partition for Cisco IOx, and requires minimum of 2.5 GB space.


Note


Prior to Cisco IOS-XE 17.10, when the image was loaded from sdflash:, formatting the SD card was not allowed. You had to first copy the image to flash, boot from flash, and then partition the SD card.


Procedure


Step 1

To create the Cisco IOx partition, use the partition sdflash command.

partition sdflash <create iox partition [size (MB or percentage)]>

After running this command, the SD card is split into two partitions. See the table below for partition information.

SD Card Size

Partition 1 (FAT32)

Partition 2 (EXT4)

Notes

4 GB or greater

34% of total SD card size, mounted to /flash11

66% of total SD card size, mounted to /flash12

Auto-partitioned by default

Less than 4 GB

Must be manually specified

Must be manually specified

At least 1 GB for IOS-XE partition and 2.5 GB for IOx required

If inadequate space is specified, a warning is shown and partitioning fails.

Caution

 

When the partition sdflash command is used, any data present before the partition is lost.

Step 2

To dedicate the entire SD card to Cisco IOx or Cisco IOS-XE, use the format sdflash command.

format sdflash <filesystem format> 

This command deletes all the existing partitions and replaces them with a single partition of the specified filesystem format:

  • FAT32 — Cisco IOS-XE

  • EXT4— Cisco IOx

Note

 

The standard SD card format is FAT32.


Emergency Recovery for Cisco IOS-XE Image

The emergency recovery process for the Cisco IOS-XE image restores the switch to a functional state. When a switch or SD card has a corrupted image and configuration file, or if the switch is stuck in ROMMON mode at the switch: prompt , perform the emergency recovery procedure using a valid image in the emgy0 storage directory.

At the switch: prompt , boot the image from the emgy0 partition. Ensure you have a connection to the switch console. After fixing the issue, the switch boots with factory default settings. To information on the emergency recovery steps, see Emergency Recovery Installation for Cisco Catalyst IE3x00 Rugged and IE3400 Heavy Duty Switches.