cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
19259
Views
6
Helpful
11
Replies

cannot delete file and directory in Cisco 2960x

jnd23
Level 1
Level 1

Hi Geeks,

 

I have a crashed 2960x switch and I am trying to upgrade the ios, when transferring file thru console flash is full.

I cannot delete file or directory.

 

below are the errors I got when deleting.

 

switch: rmdir flash:/c2960x-universalk9-mz.150-2a.EX5
Are you sure you want to remove "flash:/c2960x-universalk9-mz.150-2a.EX5" (y/n)?
y
Directory "flash:/c2960x-universalk9-mz.150-2a.EX5" not removed -- directory not
empty

switch: delete /force flash:/c2960x-universalk9-mz.150-2a.EX5
Are you sure you want to delete "/force" (y/n)?y
File "/force" not deleted -- no such device

 

switch: delete /force /recursive flash:/c2960x-universalk9-mz.150-2a.EX5/
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 "/recursive" (y/n)?y
File "/recursive" not deleted -- no such device
Are you sure you want to delete "flash:/c2960x-universalk9-mz.150-2a.EX5/" (y/n)
?y
File "flash:/c2960x-universalk9-mz.150-2a.EX5/" not deleted -- is a directory

 

switch: delete <c2960x-universalk9-mz.150-2a.EX5>
Are you sure you want to delete "<c2960x-universalk9-mz.150-2a.EX5>" (y/n)?y
File "<c2960x-universalk9-mz.150-2a.EX5>" not deleted -- no such device

 

Anyone knows the exact command for this. 

 

Cheers!

 

11 Replies 11

Elohim
Level 1
Level 1

You should be able to delete the file by typing;

 

delete flash:/c2960x-universalk9-mz.150-2a.EX5

 

Does the 'dir' command, when in the flash directory show that your flash is full?

tried it but not to avail
switch: delete flash:/c2960x-universalk9-mz.150-2a.EX5
Are you sure you want to delete "flash:/c2960x-universalk9-mz.150-2a.EX5" (y/n)?
y
File "flash:/c2960x-universalk9-mz.150-2a.EX5" not deleted -- is a directory

Martin L
VIP
VIP

Some switches do put ios inside of a folder on flash.  show boot or show system boot to see ios location.  based on output, u may have something like this:
boot flash:/c2960x-universalk9-mz.150-2a.EX5/c2960x-universalk9-mz.150-2a.EX5.bin
- ios ,bin is inside of a folder , usually same name as ios .bin 


"directory not empty" --this error means u have file or files inside of a directory. u must go to directory first, then delete all files inside, then exit and remove directory.

cd - move u to folder, so cd flash:/c2960x-universalk9-mz.150-2a.EX5
then do dir to see what files are in there, then u can delete them, I think delete *.* should work to remove all files.

 

all those are Linux based commands
cd - moves to folder
pwd - show u current location /directory.

 

Regards, ML
**Please Rate All Helpful Responses **

Hi MartinLo,
Appreciate it but still no to avail


switch: cd flash:/c2960x-universalk9-mz.150-2a.EX5
Unknown cmd: cd

switch: pwd
Unknown cmd: pwd

below are the only available commands, but I cannot successfully use the delete command.
switch: help
? -- 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)
ping -- Send ICMP ECHO_REQUEST packets to a network host
rename -- Rename a file
reset -- Reset the system
rmdir -- Delete empty dir(s)
set -- Set or display environment variables
sleep -- Pause (sleep) for a specified number of seconds
type -- Concatenate (type) file(s)
unset -- Unset one or more environment variables
-- MORE --
version -- Display boot loader version

switch:

sorry did not notice your were in Switch mode (aka Rommon). you could delete files from there (flash_init, delete) or boot switch and then delete.
format flash is last result sort of thing and I would not use it on older models. you cannot replace flash on switches.

we have exact same problem. I tried most of the answers above however still unable to delete it.

 

Delete what?

Leo Laohoo
Hall of Fame
Hall of Fame

@jnd23 wrote:

switch: 


Look at the prompt.  It is a ":" and not a "#".   This means the switch is in ROMMON.  If you want to delete everything in the flash, the command to use is "format flash:".  

If you want to delete a file, in ROMMON, the command is "delete flash:c2960x-universalk9-mz.150-2a.EX5/filename.bin".  

Wildcards are not accepted.  

Appreciated it, formatted the flash and now transferring the new ios via console xmodem.

Cheers!


@jnd23 wrote:
formatted the flash and now transferring the new ios via console xmodem.

How quaint. 

Look at the appliance.  Can you see the USB port?  It is a lot faster to transfer the IOS file from a thumb drive to the appliance via USB. 

The USB port will even allow booting a USB even from ROMMON using the command "boot usb0:filename.bin".

yes it should be unfortunately all my USBs are more than 32gb and device can't read even it's on FAT already.