Configuring SD Swap Drive

Overview

Starting from IOS XE 17.10.1, the flash: file system on the IE switches is now the primary file system to boot the switch, regardless of an SD Card is present or not. The sync command only works in one direction from flash: to sdflash: as there is no reason to sync from sdflash: to flash: and also because the sdflash: is not the primary file system. Additionally, the primary file system can no longer be configured starting from 17.10.1. Primary file system is fixed as flash:.

Prior to IOS XE 17.10.1, the sdflash: file system could be used as primary file system. if an SD Card was present, and it contained IOS XE bin or install file, and the startup configuration it was used as the default. IE Switches running IOS XE older than 17.10.1 can still use either sdflash: or flash: as primary file system, which the user can configure.

Even with the above changes, the SD card can still be used as part of Swap Drive feature. sdflash: is always the backup for startup configuration and IOS XE bin or install file. The SD Card swap drive feature allows users to remove SD Card from one IE Switch and install into a new IE switch. The new IE switch (with no startup configuration on the flash: because its new), will copy the startup configuration file and IOS XE file(s) from sdflash: to flash: and then reboot. Upon reboot, the new IE switch uses the copied files so it boots with configuration enabling to replace the IE switch for which the SD Card was previously installed.

When an SD card is formatted on the switch, the card is formatted with the Disk Operating System Filing System (DosFs), a platform-independent industry-standard file system that is supported on various Cisco switches and routers.

The switch does not support third-party SD cards or SD High Capacity (SDHC) cards. Attempting to operate the switch with a nonsupported card causes the following message to be 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, but updates and files cannot be written to the card.

Inserting and Removing the Flash Memory (SD) Card

To insert an SD card into a switch, make sure that the card is oriented properly, and press it into the SD card slot on the switch until the card is seated. To remove the card, press it to release it, and then pull it out of the slot.

The SD card is hot-swappable, but it should not be removed from the switch during the boot process or while sdflash write is in progress.

When an SD card is inserted, a syslog message similar to the following is logged:

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

When an SD card is removed, a syslog message similar to the following is logged:

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

Boot Loader Operation

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

  • boot—Load and boot an executable Cisco IOS image

  • cat—Concatenate (type) a file or files

  • copy—Copy a file

  • delete—Delete a file of files

  • 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

Prior to IOS XE 17.10.1, the switch can be booted from its internal flash memory or from an SD card. The SD card takes precedence over internal flash memory. If an SD card is installed in the switch, the switch attempts the boot precedence prior to IOS XE 17.10.1 in the following order:

  1. From the Cisco IOS image that is specified in the SD card system boot path.

  2. From the first Cisco IOS image in the SD card.

  3. From the Cisco IOS image that is specified in the internal flash memory system boot path.

  4. From the first Cisco IOS image in the internal flash.

Cisco IOS XE Operation

You can insert or remove an SD card while Cisco IOS is running. If you insert a supported Cisco SD card while Cisco IOS 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 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.

Starting from IOS XE 17.10.1, romvars and configurations are always stored and retrieved from flash. If flash is empty, IOS-XE software triggers the auto install by copying the first available image to flash from removable media. Starting from IOS XE 17.10.1, the boot precedence is as follows:

  • Boot using image path set in VAR.

  • Install boot using packages.conf file from flash.

  • Bundle boot using first bootable file from flash.

  • Bundle boot with first bootfable file from sdflash.

  • Bundle boot with first bootable file from usbflash.


Note


You can sync only one way to external media from flash. You cannot sync contents from removable media to flash.


Prior to IOS XE 17.10.1, the following Cisco IOS commands operate as described, when an SD card is installed in a switch:

  • write command—Saves the running configuration. If the system boots from an SD card and you run a write command, the system saves the running configuration to the SD card if the card is still installed. If the SD card has been removed, the system saves the running configuration to the internal flash memory and displays this message:
    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. 

    If the system boots from the internal flash memory and you then insert an SD card and run the write command, the system saves the running configuration to the internal flash memory.

  • boot command—Lets you change the system boot parameters.

    If the system boots from an SD card and you run a boot command, the following behavior applies:

    • If the SD card is installed and the system boot path or configuration file path points to the SD card, the system boot path or configuration file path is saved to the SD card.

    • If the SD card is installed and the system boot path or configuration file path points to the internal flash memory, the system boot path or configuration file path is saved to the internal flash memory.

    • If the SD card has been removed and the system boot path or configuration file path points to the SD card, the system boot path or configuration file path is not saved and the following message is displayed:
      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.

    If the system boots from the internal flash memory and you then insert an SD card and run the boot command, the following behaviors occur:

    • If the system boot path or configuration file path points to the internal flash memory, the system boot path or configuration file path is saved to the internal flash memory.

    • If the system boot path or configuration file path points to the SD card, the system boot path or configuration file path is saved to the SD card and the following message is displayed:
      :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.
    • If the SD card has been removed and the system boot path or configuration file path points to the SD card, the system boot path or configuration file path is not saved and the following message is displayed:
      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.
  • sync command—Copies the Cisco IOS image directory (which includes the Cisco IOS image file, FPGA image files, Device Manager files, and Profinet/CIP configuration files), the config.text Cisco IOS configuration file, the vlan.dat VLAN configuration file, and Cisco IOS boot parameters from the internal flash memory to the SD card or from the SD card to the internal flash memory. This command verifies that the Cisco IOS image is appropriate for the switch model and that enough destination flash memory is present, and aborts the sync process if a potential problem is detected. The sync command obtains the source Cisco IOS image directory path and source Cisco IOS configuration file path from the Cisco IOS boot parameters on the source flash device that is specified in the sync command. By default, this command overwrites the destination Cisco IOS image directory and Cisco IOS configuration files. The option to save old files can be used to override this default behavior. If the running configuration has not been saved and you run the sync command, the switch provides the option for you to save the running configuration before the command is run.

    The sync command options are:

    • Switch# sync flash: sdflash:—Synchronizes the Cisco IOS image directory, configuration files, and boot parameters from internal flash memory to the SD card.

    • Switch# sync sdflash: flash:—Synchronizes the Cisco IOS image directory, configuration files, and boot parameters from the SD card to internal flash memory.

    • Switch# sync flash: sdflash: ios-image-name —Synchronizes the boot Cisco IOS image from Flash to SDFlash.

    • Switch# sync sdflash: flash: ios-image-name —Synchronizes the Cisco IOS image from SDFlash to Flash.

    • Switch# sync sdflash: flash: skip [config|env-variable|ios-image] —Synchronizes either the Cisco IOS configuration, the environment variables, or the Cisco IOS image directory from the SD card to internal flash memory.

  • SD card alarms: You can enable the SD card alarms. By default, the alarms are disabled. To activate alarms use the alarm facility sd-card global configuration commands to associate the alarm with the relay. You can also configure alarms and traps that are associated with the SD card alarm to be sent to syslog and the SNMP server.

    • enable—enables the alarm.

    • notifies—enable notification sent to the server.

    • relay—enables relay setting.

    • syslog—enables system logger.

    Example

    Switch(config)# alarm facility sd-card enable

    Switch(config)# alarm facility sd-card notifies

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

    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..


Formatting the SD Card to Load Cisco IOx

If you plan to run Cisco IOx applications on the switch, an 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 must be a minimum of 1 GB.

  • The second partition is the EXT4 partition for Cisco IOx, and must be a minimum of 2.5 GB.


Note


When the image is loaded from sdflash, formatting of the SD card is not allowed. You must first copy the image to flash and then boot from flash. After this, you can partition the SD card.


Procedure


Step 1

To create the Cisco IOx partition, enter the following command:

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

After executing this command, the SD card is split into two partitions.

  • If the SD card size is 4 GB or greater and no size is specified:

    • Partition 1 (FAT32) is reduced to 34 percent of the total SD card size and mounted to /flash11.

    • Partition 2 (EXT4) is 66 percent of the total SD card size and mounted to /flash12.

  • If SD card size is less than 4 GB:

    • Specify the partition space so that there is at least 1 GB for the Cisco IOS XE partition and a minimum of 2.5 GB for the Cisco IOx partition.

      If the partition space is inadequate, a warning is displayed and the partitioning is not applied.

Caution

 

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

Step 2

To dedicate the entire SD flash to Cisco IOx or Cisco IOS XE, enter the following command:

format sdflash <filesystem format> 

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

  • FAT2 — Cisco IOS XE

  • EXT4— Cisco IOx

Note

 

Standard SD card formatting is FAT32.


Auto Restore of Switch Configurations with SD Swap Drive

The purpose of this task is to automatically restore the switch using the swap drive feature with an SD card. Use the sync command to copy the startup configuration and IOS-XE images to an external SD card (SDflash in the IOS CLI) while installing a new switch or replacing an old one. Insert the SD card into the switch and turn it on, the switch restores automatically.

When a new IE switch is up and running, IOS-XE checks the internal flash file system for a startup configuration. If present, it loads into memory. If there is no startup configuration, the switch looks for an SD card containing a recovery image and startup configuration files. The switch then copies these to its internal flash, restoring the original switch.


Note


  • You cannot use the packages from the sdflash to load or boot the IE3x00 devices. Do not execute the command boot sdflash:packages.conf 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 command:
    sync sdflash: restore-bundle
  • If you want to load the device in bundle mode using the boot file as an image, (e.g., <image-name>, SPA.bin), sync the swap drive feature with the command sync sdflash: restore-bundle to restore the switch.

  • To restore or recover a switch to factory default with no startup configuration, use the bundle mode.


Procedure


Step 1

Run the write memory command on the switch before taking the swap drive. Run the sync command to synchronize from internal flash to SD flash.This saves the startup configuration in to the SD flash.

Step 2

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

Step 3

Power on the new switch.

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

Emergency Recovery for IOS Image

The emergency recovery process for the Cisco IOS image restores the switch to a functional state. When a switch or SD flash 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 follow the emergency recovery steps, see Emergency Recovery Installation fo IE3x00 and IE3400 Heavy Duty Switches .

Disabling an inserted SD Card on Cisco IOS-XE

To disable an inserted SD card on a Cisco IOS XE switch, use one of the suggested methods below:

  • ROMMON mode: Set the SD card related ROMMON variable to yes to disable.

    For example, to disable an SD card, set the value of the ROMOMON variable "DISABLE_SD_FLASH” to True. Use the below command after entering the switch rommon mode:

    switch: set var DISABLE_SD_FLASH=yes

  • Switch CLI mode: You can disable an SD card from the switch CLI in the Config mode using the command:

    Switch(config)# no sdflash

To enable the SD card again, do the following:
  • From ROMMON mode of the switch set the "DISABLE_SD_FLASH" variable to "no". For example, switch:set var DISABLE_SD_FLASH=no

  • From the switch config CLI set as "sdflash". For example, Switch(config)#sdflash

To verify if an SD card is disabled, perform the steps below:

Procedure


Step 1

After logging in to the switch, there will be no SD card displayed under the filesystems. To verify, 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: 
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

Step 2

After step 1, perform the following:

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: >>> unlike previous instance, sdflash is not part of the output
- - opaque ro xmodem:
- - opaque ro ymodem:
- - opaque rw null:
- - opaque ro tar:
- - network rw tftp:
33554432 33492400 nvram rw nvram:
- - opaque wo syslog:
Switch#dir sdflash:
%Error opening flash:/sdflash (No such file or directory)