Cisco error deleting is a directory

Иногда требуется удалить директорию с файлами из флеш памяти коммутатора или маршрутизатора Cisco. Например, нужно выполнить обновление io...

Иногда требуется удалить директорию с файлами из флеш памяти коммутатора
или маршрутизатора Cisco. Например, нужно выполнить обновление ios.
При этом не хотелось бы удалять старый ios не убедившись, что с новым
все работает нормально. Но свободного места под новый ios на
недостаточно. Надо как-то освободить флеш. Можно стереть html старого
ios. Если просто выполнить команду ‘delete html’, получим сообщение об ошибке. Вот как это выглядит:

Просматриваем содержание флеши.

test_switch#sh flash

Directory of flash:/
………………
    3  -rwx        2456   Mar 1 1993 02:46:21 +01:00  vlan.dat
    5  -rwx        4292   Feb 8 2010 05:56:22 +01:00  config.text
    6  drwx         192   Mar 1 1993 01:06:14 +01:00  old_image
……………
test_switch#

переходим в каталог old_image

test_switch#
test_switch#cd old_image
test_switch#
test_switch#dir
Directory of flash:/old_image/

    7  drwx        4480   Mar 1 1993 01:04:50 +01:00  html
  619  -rwx     4670535   Mar 1 1993 01:06:14 +01:00  old_image.bin
  620  -rwx         457   Mar 1 1993 01:06:14 +01:00  info
………………
test_switch#


Пытаемся удалить папку html

test_switch#
test_switch#
test_switch#delete html
Delete filename [/old_image/html]?
Delete flash:/old_image/html? [confirm]
%Error deleting flash:/old_image/html (Is a directory)
test_switch#


Таким образом, обычной командой ‘delete удалить каталог не удается.
Надо использовать команду ‘delete’ с ключем ‘/recursive’. В этом случае дтректория будет удалена вместе со всеми вложенными поддиректориями и файлами.
Для того, чтобы не подтверждать удаление каждого файла можно использовать ключ ‘/force’.

test_switch#delete /force /recursive flash:/old_image/html
test_switch#
test_switch#dir
Directory of flash:/old_image/

  619  -rwx     4670535   Mar 1 1993 01:06:14 +01:00  old_image.bin
  620  -rwx         457   Mar 1 1993 01:06:14 +01:00  info
………………
test_switch#


В итоге папка html успешно удалена.

В примере использовалось железо cisco WS-C2960-24TC-L с Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(52)SE, RELEASE SOFTWARE (fc3)

Ok, so I have looked into almost every possible command and can not seem to find this.

switch: rmdir force flash:dc_profile_dir
Are you sure you want to remove «force» (y/n)?
Directory «force» not removed
Are you sure you want to remove «flash:dc_profile_dir» (y/n)?y
Directory «flash:dc_profile_dir» not removed — directory not empty

switch:

switch: delete /force /recursive flash:dc_profile_dir
Are you sure you want to delete «/force» (y/n)?
File «/force» not deleted
Are you sure you want to delete «/recursive» (y/n)?y
File «/recursive» not deleted — no such device
Are you sure you want to delete «flash:dc_profile_dir» (y/n)?
File «flash:dc_profile_dir» not deleted

switch: File «flash:dc_profile_dir» not deleted

switch: del force flash:/dc_profile_dir
Are you sure you want to delete «force» (y/n)?
File «force» not deleted
Are you sure you want to delete «flash:/dc_profile_dir» (y/n)?y
File «flash:/dc_profile_dir» not deleted — is a directory

switch:

switch: delete force flash:dc_profile_dir
Are you sure you want to delete «force» (y/n)?
File «force» not deleted
Are you sure you want to delete «flash:dc_profile_dir» (y/n)?y
File «flash:dc_profile_dir» not deleted — is a directory

switch:

switch: delete /f /r flash:dc_profile_dir
Are you sure you want to delete «/f» (y/n)?
File «/f» not deleted
Are you sure you want to delete «/r» (y/n)?y
File «/r» not deleted — no such device
Are you sure you want to delete «flash:dc_profile_dir» (y/n)?
File «flash:dc_profile_dir» not deleted

switch: delete /force /recursive flash:dir_dc_profile_dir
Are you sure you want to delete «/force» (y/n)?
File «/force» not deleted
Are you sure you want to delete «/recursive» (y/n)?y
File «/recursive» not deleted — no such device
Are you sure you want to delete «flash:dir_dc_profile_dir» (y/n)?
File «flash:dir_dc_profile_dir» not deleted

switch: delete /recursive /force flash:/dc_profile_dir
Are you sure you want to delete «/recursive» (y/n)?
File «/recursive» not deleted
Are you sure you want to delete «/force» (y/n)?y
File «/force» not deleted — no such device
Are you sure you want to delete «flash:/dc_profile_dir» (y/n)?
File «flash:/dc_profile_dir» not deleted

switch: dir flash:
Directory of flash:/

    5 drwx 512     <date>             c3750e-universalk9-mz.152-4.E5
  588 -rwx 4120     <date>             multiple-fs
  589 drwx 512     <date>             dc_profile_dir

26356736 bytes available (31314944 bytes used)

switch:

switch: delete /recursive force flash:/dc_profile_dir
Are you sure you want to delete «/recursive» (y/n)?
File «/recursive» not deleted
Are you sure you want to delete «force» (y/n)?y
File «force» not deleted — no such device
Are you sure you want to delete «flash:/dc_profile_dir» (y/n)?
File «flash:/dc_profile_dir» not deleted

switch: del flash:dc_profile_dir
Are you sure you want to delete «flash:dc_profile_dir» (y/n)?
File «flash:dc_profile_dir» not deleted

switch: delete force flash:dc_profile_dir
Are you sure you want to delete «force» (y/n)?
File «force» not deleted
Are you sure you want to delete «flash:dc_profile_dir» (y/n)?y
File «flash:dc_profile_dir» not deleted — is a directory

switch:

switch: flash
Initializing Flash…
…The flash is already initialized.

switch:

switch: delete flash:dc_profile_dir
Are you sure you want to delete «flash:dc_profile_dir» (y/n)?
File «flash:dc_profile_dir» not deleted

switch: ?
          ? — Present list of available commands
        boot — Load and boot an executable image
        cat — Concatenate (type) file(s)
        copy — Copy a file
      delete — Delete file(s)
        dir — List files in directories
  flash_init — Initialize flash filesystem(s)
      format — Format a filesystem
        fsck — Check filesystem consistency
        help — Present list of available commands
      memory — Present memory heap utilization information
      mkdir — Create dir(s)
        more — Concatenate (display) file(s)
      rename — Rename a file
      reset — Reset the system
      rmdir — Delete empty dir(s)
        set — Set or display environment variables
      set_bs — Set attributes on a boot sector filesystem
  set_param — Set system parameters in flash
      sleep — Pause (sleep) for a specified number of seconds
        type — Concatenate (type) file(s)
— MORE —
      unset — Unset one or more environment variables
    version — Display boot loader version

switch: rmdir force flash:dc_profile_dir
Are you sure you want to remove «force» (y/n)?
Directory «force» not removed
Are you sure you want to remove «flash:dc_profile_dir» (y/n)?y
Directory «flash:dc_profile_dir» not removed — directory not empty

switch:

switch: rmdir dc_profile_dir
Are you sure you want to remove «dc_profile_dir» (y/n)?
Directory «dc_profile_dir» not removed

switch: rmdir force dc_profile_dir
Are you sure you want to remove «force» (y/n)?
Directory «force» not removed
Are you sure you want to remove «dc_profile_dir» (y/n)?y
Directory «dc_profile_dir» not removed — no such device

switch:

switch: «dc_profile_dir» not removed — no such device

and yet the Majestic Un-deleteable, «no such device» directory is still there. (isnt that wonderful hahaha)

I truly appreciate any help that is given. I make you a cheesecake if you can help me. 

How do I delete a dir in flash: in a C3750X switch?

Ok, so I have looked into almost every possible command and can not seem to find this.

I need to delete a dir in flash: but I keep getting:

switch: rmdir force flash:dc_profile_dir
Are you sure you want to remove «force» (y/n)?
Directory «force» not removed
Are you sure you want to remove «flash:dc_profile_dir» (y/n)?y
Directory «flash:dc_profile_dir» not removed — directory not empty

switch: delete /force /recursive flash:dc_profile_dir
Are you sure you want to delete «/force» (y/n)?
File «/force» not deleted
Are you sure you want to delete «/recursive» (y/n)?y
File «/recursive» not deleted — no such device
Are you sure you want to delete «flash:dc_profile_dir» (y/n)?
File «flash:dc_profile_dir» not deleted

switch: File «flash:dc_profile_dir» not deleted

switch: del force flash:/dc_profile_dir
Are you sure you want to delete «force» (y/n)?
File «force» not deleted
Are you sure you want to delete «flash:/dc_profile_dir» (y/n)?y
File «flash:/dc_profile_dir» not deleted — is a directory

switch: delete force flash:dc_profile_dir
Are you sure you want to delete «force» (y/n)?
File «force» not deleted
Are you sure you want to delete «flash:dc_profile_dir» (y/n)?y
File «flash:dc_profile_dir» not deleted — is a directory

switch: delete /f /r flash:dc_profile_dir
Are you sure you want to delete «/f» (y/n)?
File «/f» not deleted
Are you sure you want to delete «/r» (y/n)?y
File «/r» not deleted — no such device
Are you sure you want to delete «flash:dc_profile_dir» (y/n)?
File «flash:dc_profile_dir» not deleted

switch: delete /force /recursive flash:dir_dc_profile_dir
Are you sure you want to delete «/force» (y/n)?
File «/force» not deleted
Are you sure you want to delete «/recursive» (y/n)?y
File «/recursive» not deleted — no such device
Are you sure you want to delete «flash:dir_dc_profile_dir» (y/n)?
File «flash:dir_dc_profile_dir» not deleted

switch: delete /recursive /force flash:/dc_profile_dir
Are you sure you want to delete «/recursive» (y/n)?
File «/recursive» not deleted
Are you sure you want to delete «/force» (y/n)?y
File «/force» not deleted — no such device
Are you sure you want to delete «flash:/dc_profile_dir» (y/n)?
File «flash:/dc_profile_dir» not deleted

switch: dir flash:
Directory of flash:/

5 drwx 512 c3750e-universalk9-mz.152-4.E5
588 -rwx 4120 multiple-fs
589 drwx 512 dc_profile_dir

26356736 bytes available (31314944 bytes used)

switch: delete /recursive force flash:/dc_profile_dir
Are you sure you want to delete «/recursive» (y/n)?
File «/recursive» not deleted
Are you sure you want to delete «force» (y/n)?y
File «force» not deleted — no such device
Are you sure you want to delete «flash:/dc_profile_dir» (y/n)?
File «flash:/dc_profile_dir» not deleted

switch: del flash:dc_profile_dir
Are you sure you want to delete «flash:dc_profile_dir» (y/n)?
File «flash:dc_profile_dir» not deleted

switch: delete force flash:dc_profile_dir
Are you sure you want to delete «force» (y/n)?
File «force» not deleted
Are you sure you want to delete «flash:dc_profile_dir» (y/n)?y
File «flash:dc_profile_dir» not deleted — is a directory

switch: flash
Initializing Flash.
. The flash is already initialized.

switch: delete flash:dc_profile_dir
Are you sure you want to delete «flash:dc_profile_dir» (y/n)?
File «flash:dc_profile_dir» not deleted

switch: ?
? — Present list of available commands
boot — Load and boot an executable image
cat — Concatenate (type) file(s)
copy — Copy a file
delete — Delete file(s)
dir — List files in directories
flash_init — Initialize flash filesystem(s)
format — Format a filesystem
fsck — Check filesystem consistency
help — Present list of available commands
memory — Present memory heap utilization information
mkdir — Create dir(s)
more — Concatenate (display) file(s)
rename — Rename a file
reset — Reset the system
rmdir — Delete empty dir(s)
set — Set or display environment variables
set_bs — Set attributes on a boot sector filesystem
set_param — Set system parameters in flash
sleep — Pause (sleep) for a specified number of seconds
type — Concatenate (type) file(s)
— MORE —
unset — Unset one or more environment variables
version — Display boot loader version

switch: rmdir force flash:dc_profile_dir
Are you sure you want to remove «force» (y/n)?
Directory «force» not removed
Are you sure you want to remove «flash:dc_profile_dir» (y/n)?y
Directory «flash:dc_profile_dir» not removed — directory not empty

switch: rmdir dc_profile_dir
Are you sure you want to remove «dc_profile_dir» (y/n)?
Directory «dc_profile_dir» not removed

switch: rmdir force dc_profile_dir
Are you sure you want to remove «force» (y/n)?
Directory «force» not removed
Are you sure you want to remove «dc_profile_dir» (y/n)?y
Directory «dc_profile_dir» not removed — no such device

switch: «dc_profile_dir» not removed — no such device

and yet the Majestic Un-deleteable, «no such device» directory is still there. (isnt that wonderful hahaha)

switch: dir flash:
Directory of flash:/

5 drwx 512 c3750e-universalk9-mz.152-4.E5
588 -rwx 4120 multiple-fs
589 drwx 512 dc_profile_dir

26356736 bytes available (31314944 bytes used)

I need it gone Please, can someone help

I truly appreciate any help that is given. I make you a cheesecake if you can help me.

  • local_offer Tagged Items
  • IT-Witch
  • CCNA

Источник

Cisco error deleting flash

Иногда требуется удалить директорию с файлами из флеш памяти коммутатора или маршрутизатора Cisco. Например, нужно выполнить обновление ios. При этом не хотелось бы удалять старый ios не убедившись, что с новым все работает нормально. Но свободного места под новый ios на недостаточно. Надо как-то освободить флеш. Можно стереть html старого ios. Если просто выполнить команду ‘delete html’, получим сообщение об ошибке. Вот как это выглядит:

Просматриваем содержание флеши.

переходим в каталог old_image

Пытаемся удалить папку html

Таким образом, обычной командой ‘delete удалить каталог не удается.
Надо использовать команду ‘delete’ с ключем ‘/recursive’. В этом случае дтректория будет удалена вместе со всеми вложенными поддиректориями и файлами. Для того, чтобы не подтверждать удаление каждого файла можно использовать ключ ‘/force’.

В итоге папка html успешно удалена.

В примере использовалось железо cisco WS-C2960-24TC-L с Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(52)SE, RELEASE SOFTWARE (fc3)

Как скопировать много файлов или директорию из флеш памяти коммутатора или маршрутизатора Cisco на tftp сервер?

Предположим, требуется скопировать директорию из флеш памяти коммутатора или маршрутизатора Cisco на tftp сервер. Предположим, директория содержит несколько сотен файлов и вложенных директорий с файлами. Как все это скопировать одним махом?
Ответ: использовать команду ‘archive tar /create’.

Посмотрим, как это выглядит в деле на коммутаторе cisco WS-C2960-24TT-L.
Просматриваем содержание флеши:

Мы хотим скопировать дирикторию html. Убедмися, что она действительно есть на флеши и содержит много вложенных папок и файлов.

С помощью команды ‘archive tar /create’ выполним копирование. Будем копировать на сервер с адресом 192.168.18.1, в файл html.tar .

В итоге получаем файл html.tar на tftp сервере.
Таким образом, мы легко и быстро скопировали паку содержащую более 600 файлов.

В примере использовалось железо cisco WS-C2960-24TT-L с Cisco IOS Software, C2960 Software (C2960-LANBASE-M), Version 12.2 (25)SEE2, RELEASE SOFTWARE (fc1)

Источник

Recover Catalyst Fixed Configuration Switches from a Corrupted Image

Available Languages

Download Options

Bias-Free Language

The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.

Contents

Introduction

This document describes how to recover Cisco Catalyst fixed configuration switches from a corrupt system image or an incorrectly set boot variable.

Prerequisites

Requirements

If you have not already done so, connect a PC to the console port of the switch. For information on how to connect a terminal to a Catalyst fixed configuration switch, refer to Connecting a Terminal to the Console Port on Catalyst Switches. Use a terminal emulation program such as Microsoft Windows HyperTerminal in order to establish the console session.

These are the settings:

Bits per second: 9600

Flow control: None

Port Settings

Components Used

The Catalyst fixed configuration switches that this document describes include the 2940, 2950/2955, 2970, 3550, 3560, 3750 and the 3750 Metro series switches.

The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, ensure that you understand the potential impact of any command.

Conventions

Refer to Cisco Technical Tips Conventions for more information on document conventions.

Problem

When Catalyst fixed configuration switches experience boot errors, these conditions can apply:

The switch is in a continuous reboot.

The switch displays the switch: prompt.

The error loading flash: message appears.

Switch Displays the Switch: Prompt or «Error Loading Flash:»

The switch: prompt indicates that the switch has not booted completely and requires the user to complete the boot process.

The error loading flash: message indicates that the switch failed to load an image because of a corrupt or lost image.

The corrupt or lost image can be the result of a failed download. In this case, the image has a bad checksum or a failed software upgrade, and the upgrade procedure was not followed properly. There is the possibility that the user deleted the image but did not replace the image. A boot variable can have been set incorrectly.

With a console session open, you see an error message that is similar to this:

Normally, the switch attempts to automatically boot the next valid image in the Flash file system. Here is an example:

If there is no valid backup image from which to boot, the boot process fails completely. Here is an example:

Solution

Step-by-Step Recovery Procedure

Note: A PC must be attached to the console port of the switch.

Step 1. If the switch is in a continuous reboot, complete one of the procedures in this step, which depends on your switch model.

Note: If the switch is not in a continuous reboot, but is already at the switch: prompt, proceed directly to Step 2.

  • Catalyst 2940 and 2950 series switches

STAT and MODE

a. Unplug the power cord.

b. Hold down the MODE button while you reconnect the power cable to the switch.

The MODE button is on the left side of the front panel.

c. Release the MODE button after the STAT LED goes out.

Note: The LED position can vary slightly, which depends on the model.

d. You are now at the switch: prompt. Proceed to Step 2.

  • Catalyst 2970, 3550, 3560 and 3750 series switches

Port 1x LED

a. Unplug the power cord.

b. Hold down the MODE button while you reconnect the power cable to the switch.

The MODE button is on the left side of the front panel.

c. Release the MODE button after the previous LED Port 1x goes out.

Note: The LED position can vary slightly, which depends on the model.

d. You are now at the switch: prompt. Proceed to Step 2.

  • Catalyst 2955 series switches

a. Issue a break sequence from the keyboard in order to break into switch: mode.

The terminal application and operating system that you use determine the break sequence to use. HyperTerminal that runs on Windows 2000 uses Ctrl-Break. For more information, refer to Standard Break Key Sequence Combinations During Password Recovery.

This example uses HyperTerminal to break into switch: mode on a 2955:

b. Proceed to Step 2.

Step 2. Issue the flash_init command and the load_helper command.

If the Flash has already initialized, you see this:

If the Flash has not initialized, you see this:

Issue the load_helper command in order to load any boot helper images. Here is an example:

Step 3. Issue the dir flash: command in order to view the contents of the Flash file system.

Determine if there are any Cisco IOS® image files or image directories in flash:. The Cisco IOS image files are .bin files, and the image directories are named with the image filename, excluding the .bin extension. If no Cisco IOS image files or image directories exist, you see this:

If your Flash directory looks like this, proceed directly to Step 5. Step 5 recovers the switch with an Xmodem file transfer.

If there is still an image in Flash, issue the boot command (Step 4) in order to try to recover the switch. Before you issue the boot command, verify where the Cisco IOS image is stored in the Flash directory. The location in which the image is stored can differ, which depends on your switch model.

Catalyst 2940, 2950, and 2955 Flash file system

The Cisco IOS image file (.bin file) always resides in the flash: directory on Catalyst 2940, 2950 and 2955 series switches. Here is an example:

Catalyst 2970, 3550, 3560, and 3750 Flash file system

The organization of the Flash file system on a Catalyst 2970, 3550, 3560, and 3750 is a little different. You can store the Cisco IOS image file in the flash: directory. However, if you use the Cluster Management Suite (CMS) image in order to manage switches with a web interface, you can store the Cisco IOS image file in its own directory. Issue the dir flash:directory command in order to display the image file in this case.

Attempt to Boot the Image

Step 4. After you have verified where the Cisco IOS image file resides, try to boot the image. Issue either the boot flash: command or the boot flash: command.

If you issue the boot command and the result is in a successful bootup, either the default switch> prompt or the hostname> prompt displays.

Be sure to verify that you have configured the correct boot statement on the switch. See the Verification section.

If you issue the boot command and the command does not result in a successful bootup, either the switch: prompt displays or you are stuck in a continuous reboot again. The only option to recover the switch is an Xmodem file transfer. Step 5 covers this file transfer.

Step 5. If the boot command has failed or there is no valid image from which to boot in Flash, perform an Xmodem file transfer.

A typical Xmodem file transfer can take up to 2 hours, which depends on the image size.

Download the Cisco IOS image (.bin file) to which you want to upgrade from the Cisco Software Center (Downloads).

Note: All of the tools mentioned in this article can only be accessed by Cisco registered clients.

Note: Do not use a CMS image (.tar file). This image is a larger image and takes longer to transfer.

Issue the dir flash: command in order to compare the size of the image in bytes to the free space that remains in Flash. Here is an example:

If necessary, issue the delete command in order to delete any corrupt images that remain. Here is an example:

The next example shows an Xmodem procedure on a 2955 with the use of HyperTerminal. The procedure is the same for any of the Catalyst fixed configuration switches that this document covers.

Issue the copy xmodem: flash: command on the switch.

Here is an example:

Send File

c. Choose the Xmodem protocol in the Send File dialog box and click Browse in order to select the Cisco IOS image (.bin file) that you downloaded previously.

d. Click Send in order to begin the Xmodem transfer.

Send Xmodem

The Xmodem file transfer begins. This transfer can take up to 2 hours, which depends on the size of the image.

Step 6. Boot the new image that you just copied over with the Xmodem procedure.

Issue the boot flash: command, as this example shows:

Be sure to verify that your boot statements are set correctly.

How to Speed Up Xmodem Recovery

When a user tries to recover the switch from a corrupted or lost Cisco IOS, the copy xmodem: flash:[IOS filename] command is not displayed under the switch: prompt. The copy command is displayed under the switch: prompt, but the copy xmodem: command is not.

Complete these steps in order to speed up the Xmodem recovery:

Set the baud rate to 115200 on the switch: prompt.

Under COM PORT properties, select the bits per second as 115200. The switch: prompt is displayed.

Start the Xmodem recovery.

After the Xmodem recovery, set the BAUD rate back to 9600. If the set BAUD 9600 command does not bring the baud rate to 9600, issue the unset BAUD command in order to bring the baud rate to a default value of 9600 bps.

Verification

Complete these steps:

Issue the show version command in order to verify the current version of software that you run.

Here is an example:

Issue the dir flash: command in order to display the Cisco IOS image (.bin file) on a Catalyst 2940, 2950 or 2955.

If you run a CMS image on a Catalyst 2970, 3550, 3560, or 3750, you can store the Cisco IOS image in an image directory:

You need to issue the dir flash: command on a Catalyst 3550 to display the Cisco IOS image (.bin file):

Issue the show boot command in order to verify that the boot statement is set correctly:

Issue the show boot command in order to display boot statements. If no boot statement is set or if the boot statement points to an old or lost version of software, configure the correct boot statement. Issue the boot system flash: command.

If you use a CMS image on a Catalyst 2970, 3550, 3560, or 3750, you can store the Cisco IOS image (.bin file) in its own image directory. Issue the boot system flash:directory/filename command:

Источник

I got a 2950 off ebay and it was not completely reset. I want to clear the VLAN settings to factory default. Below is what I have on it now.

Switch#show vlan brief

VLAN Name Status Ports
—-




1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
2 VLAN0002 active
3 VLAN0003 active
10 Sales active
20 Marketing active
30 ASE active
40 ASR active
50 Managers active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active

I got the following command from the Cisco website (delete flash:vlan.dat) to reset the VLAN. It did not work, I got the below error. What did I do wrong? I want this box like I just got it new. I also ran the «write erase«command with no issues.

Switch#delete flash:vlan.dat
Delete filename [vlan.dat]? y
Delete flash:y? [confirm]
%Error deleting flash:y (No such file or directory)

2019 Goals: 70-698, CCENT, MCSA 2016
Certifications: A+, Network+, Security+, CIW Foundations and MTA OS Fundamentals
Cisco Lab :3x Cisco 2811 Routers, 3x Cisco 3750 Switches and Cisco 2620 Router with NM-32A module
Windows Lab: Dual CPU Hyper-V server with 12 Cores/24 Threads, 96GB RAM and 2TB HDD.
CANCER SURVIVOR! In Remission Since September 2016!

Before you can remove a directory on Cisco devices the directory must be empty, the below steps will show you how to delete all of the files and folders the directory contains.

Cisco switches often store their IOS in a folder due to them being bundled with HTML files. So this may come in useful when you want to remove your current IOS pre/post an update.

If you are new to Cisco or just want to improve your skills I recommend this course from Udemy at the time of writing for just $20 for lifetime access! I’m also a really big fan of Pluralsight

Steps

  • Connect to you device and enter enable mode.
  • Display the contents of your flash using the command dir flash: and make a note of the folder you want to delete
  • Issue the command delete /recursive /force flash:/c3750-ipbase-mz.122-52.SE where “c3750-ipbase-mz.122-52.SE” is the name of the folder you want to delete.
    • Be carful when using the /force switch as you will not get any “are you sure” messages
  •  This should also remove the directory, if not once the folder is empty you can use the command rm flash:/c3750-ipbase-mz.122-52.SE to remove the now empty folder

Note: If you switch is part of a stack you may need to do the same on the other members flash (flash1:/   flash2:/   flash3:/    etc)

Learning more

If you are new to Cisco or would just like to learn more. Pluralsight has some great courses, I have personally been through their CCNA/CCNP content.

You can get a Pluralsight 10 day free trial with this link

I’m new in BASH and I’m trying to make a simple script.
I would like to run the script from a different directory, and then the script should delete all my files in my current directory. (ONLY FILES)
So the function is:

eraseAllFiles()
{   
    rm * 
    echo "Files deleted!"
    sleep 1.3
}

So the command rm * delete all my files but then I get this error:

cannot remove 'XXXXX': is a directory.

My question is how can I avoid this error?

DGS's user avatar

DGS

6,0151 gold badge20 silver badges37 bronze badges

asked Aug 14, 2015 at 9:38

user3075653's user avatar

Instead of rm use find -type f to delete only files:

eraseAllFiles() {   
    find . -maxdepth 1 -type f -delete 
    echo "Files deleted!"
    sleep 1.3
}

answered Aug 14, 2015 at 9:43

anubhava's user avatar

anubhavaanubhava

748k64 gold badges550 silver badges622 bronze badges

2

Try this:

eraseAllFiles()
{   
    rm * 2>/dev/null
    echo "Files deleted!"
    sleep 1.3
}

The 2>/dev/null part sends the standard error output to /dev/null which effectively means that it’s not displayed.

answered Aug 14, 2015 at 9:41

geckon's user avatar

geckongeckon

8,1863 gold badges34 silver badges59 bronze badges

If you need to delete both files and directory use

rm -r *

answered Aug 14, 2015 at 10:03

Mahesh Kharvi's user avatar

Понравилась статья? Поделить с друзьями:
  • Cisco channel misconfig error
  • Cisco authentication failed как исправить
  • Cisco asr error overrun
  • Cisco anyconnect ошибка подключения
  • Cisco 3750 error loading flash