You want to erase files from your router's flash.
To delete all of the files from your router's flash memory, use the erase command:
Router1#erase slot1: Erasing the slot1 filesystem will remove all files! Continue? [confirm] <enter> Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased Erase of slot1: complete Router1#
|
You can remove individual files from the router's flash memory with the delete command:
Router1#delete slot1:c3620-ik9s-mz.122-13.bin Delete filename [c3620-ik9s-mz.122-13.bin]? <enter> Delete slot1:c3620-ik9s-mz.122-13.bin? [confirm] <enter> Router1#
As we have indicated, there are two ways to delete files from flash, depending on the type of router. The difference arose because Cisco routers use three different kinds of filesystems, called Class A, Class B, and Class C. Table 1-2 shows the filesystems that Cisco's most common routers use.
Router type |
Filesystem type |
---|---|
7000(RSP) |
Class A |
7500(RSP2,4, & 8) |
Class A |
12000 |
Class A |
Route Switch Module (RSM) |
Class A |
1600 |
Class B |
2500 |
Class B |
3600[1] |
Class B |
4000 |
Class B |
AS5300 |
Class B |
AS5800 |
Class C |
7100 |
Class C |
7200 |
Class C |
[1] The 3600 traditionally uses the Class B filesystem. However, starting with IOS Version 12.2(4)T, the 3600 also includes Class C filesystem functionality.
Table 1-3 lists some of the different filesystem commands, their meanings, and the filesystems that they work with.
Command |
Filesystem |
Description |
---|---|---|
Delete |
All |
Marks the file as deleted, but does not permanently remove it from flash |
Squeeze |
A |
Permanently removes all files that have been marked as deleted |
Format |
A & C |
Erases the entire flash device |
Verify |
All |
Verifies that the IOS file's checksum matches the value encoded in the image |
Undelete |
A & B |
Recovers deleted files |
Erase |
A & B |
Erases the entire flash device |
The erase command is not available on all router types. On routers that use the Class C filesystem, you can only remove files from the flash with the delete command.
The delete command marks files as deleted, but it does not permanently remove them:
Router1#show slot1: PCMCIA Slot1 flash directory: File Length Name/status 1 11992088 c3620-ik9s-mz.122-13.bin [deleted] [16515072 bytes used, 0 available, 16515072 total] 16384K bytes of processor board PCMCIA Slot1 flash (Read/Write) Router1#
You can permanently remove a file and reclaim the space on the flash device with the squeeze command. Note, however, that only routers with the type A filesystem support this command:
Router1#squeeze slot1: Squeeze operation may take a while. Continue? [confirm] <enter> squeeze in progress... Squeeze of slot1 complete Router1#
The squeeze function can take up to several minutes, so be patient. Once the squeeze command is complete, you can view the flash device to verify that the file is gone:
Router1#show slot1: PCMCIA Slot1 flash directory: No files in PCMCIA Slot1 flash [0 bytes used, 16515072 available, 16515072 total] 16384K bytes of processor board PCMCIA Slot1 flash (Read/Write) Router1#
The file has now been permanently removed and you can no longer recover it with the undelete command. On routers with filesystems that do not support the squeeze command, the only way to permanently remove deleted files is to use the erase command. However, the erase command deletes the entire flash system and will not permit you to delete individual files. In the next recipe, we look at ways to partition flash devices in order to reduce the impact of the erase command.
Top |