Manage file systems and the Swap Drive

Overview

Changes to the primary file system in Cisco IOS XE 17.10.1

Starting with Cisco IOS XE 17.10.1, the flash file system on IE switches serves as the primary file system for booting an IE switch, whether or not 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 attempts to find one in sdflash, copies the configuration and IOS XE image to flash, and then boots from flash.

After version 17.10.1, the sync command only works in one direction: from flash to sdflash. Syncing from sdflash to flash occurs automatically.

Swap drive

he Swap Drive feature lets you use an 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 insert it into a new IE switch. When the new IE switch (without a startup configuration in flash) is powered on, it first checks flash for a configuration file. If the file is not found, it checks sdflash for a configuration file. If it finds a configuration file in sdflash, the switch then:

  • 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 this order:

  1. The switch boots from the Cisco IOS-XE image specified in the boot path.

  2. The switch boots from the Cisco IOS-XE image on the SD card.

  3. The switch boots 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 displays this message:

    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 locked, the switch can read data on the card and boot from it. However, it cannot write updates or files 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

This 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 initiates automatic installation. The software copies the first available image from removable media to flash.

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 uses a bootable image, which can be a .conf or .bin file, located in sdflash.

  5. Bundle boot uses a bootable image, which can be a .conf or .bin file, located in 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. It then 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 indicating that the SD card has been removed.

If syslog is enabled, the system also sends a message when you insert or remove the SD card.

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


Note


When a type-6 password is configured, the sync command status shows the configuration as out of sync with the message that type-6 passwords are not synced.


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 send messages 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 such as:

 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 such as:

 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.

Enable an SD card

Enable an SD card on a Cisco IOS XE switch to provide additional storage capacity and file management capabilities for the device.

SD cards can be enabled on Cisco IOS XE switches to provide additional storage for files, logs, and configurations. You can enable the SD card using ROMMON mode or switch CLI mode, depending on your access level and requirements.

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> enable
Switch# config terminal
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 monitor the SD card files, 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 


Disable an SD card

Disable an SD card on a Cisco IOS XE switch to prevent the system from recognizing or accessing the SD card storage.

You can disable an SD card on a Cisco IOS XE switch using two different methods: ROMMON mode or switch CLI mode.

Procedure


Step 1

To disable an SD card on a Cisco IOS XE switch, choose one of these 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 on the switch using the command in configuration mode.
Switch(config)# no sdflash 

Step 2

(Optional) After logging in to the switch, the SD card does 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)


Configure auto sync from internal flash to SD card

Configure the auto sync service to automatically synchronize files from the internal flash to the SD card at scheduled times.

To configure auto sync from internal flash to an SD card, use this procedure.

Procedure


Step 1

Use configure terminal command to enter global configuration mode.

Example:

Switch# configure terminal

Step 2

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(config)# auto sync enable

Note

 

auto sync is disabled by default. Unless you enable it, you cannot use other options for the feature.

Step 3

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

Switch(config)# auto sync run time 02:00:00

Step 4

(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(config)# auto sync config sdflash: restore-bundle

Step 5

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

Switch(config)# auto sync config sdflash: skip ios-image

Step 6

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

Switch(config)# auto sync config sdflash: skip config

Step 7

(Optional) Use auto sync config sdflash: IOS-image image_name command to sync the specified image file and replace the existing image.

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

Format the SD card to load Cisco IOx

Format the SD card in EXT4 format to run Cisco IOx applications on the switch, or create both FAT32 and EXT4 partitions to run both Cisco IOS-XE and Cisco IOx applications.

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 a minimum of 1 GB of space.

  • The second partition is the EXT4 partition for Cisco IOx and requires a minimum of 2.5 GB of 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. The table presents information about these partitions.

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 there is inadequate space specified, the system displays a warning and the partitioning process 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.