Cisco 1600 series routers: The 1600 series router has a single PC card that contains Flash memory. The 1601 to 1604 run from Flash. If you remove the PC card when the router is running, the router. Mar 31, 2012 Temporarily delete files If you wish to delete file/s from Cisco router flash, you use for example: However the deleted file actually still resides in flash. Permanently delete the files from flash. To permanently clean up the deleted files: The trash is emptied:D. Solved: Hi everybody. I want to delete the first file c2600-i-mz.122-5d in the flash. Not only delete but also reclaim the memory held by deleted file I. I followed a link and i ended up with the c2600-i-mz.122-5d marked as deleted in the flash but.
After setting up a Cisco router, many administrators don't upgrade the IOS or access files on the Flash drive for quite a while. However, that doesn't mean there won't come a time when you need to manipulate the files on the Flash drive.
Working with the files and directories on the Cisco IOS file system (Cisco IFS) involves using the same types of commands as when manipulating files in Windows from the DOS command prompt. These commands include copy, dir, and format.
Here are some of the common uses of these commands:
Let's look at some of the Cisco IFS commands you need to know. By keeping some of the more commonly used commands in mind when upgrading and moving files to and from network devices, you can save time and perhaps even prevent a disaster.
The dir command shows files in a directory, and the default directory is usually the Flash file system. So, entering dir displays the directory of flash:/ by default.
You can also specify which directory you want to view, or you can use the all-filesystemsoption. You can even use the /recursive switch if you want to view files in subdirectories.
Here's an example:
While most people are familiar with the general copy command, it involves a little more than just copying files from one place to another on a router or switch. In fact, this command is critically important to copying files to and from the router.
For example, to upgrade the IOS on a router, you must copy the new IOS from either the network or from a locally attached console port (via something like xmodem). You can also use the copy command to back up the configuration on both the router and over the network, as well as to restore the configuration from the network back to the router.
When using the copy command, you can use standard URL format to identify both the source and destination. Here's an example of what the URL path looks like for a network destination:
Below is an example of what the URL path looks like for a local file system. In this example, the path to the startup-config for the router is nvram:startup-config.
For example, you could back up a startup-configuration to a TFTP server's directory called router1, with an IP address of 1.1.1.1, using this same URL structure. Here's what it would look like:
The show file command displays information about a specified file or file system. I consider this a 'little-known' command because it typically doesn't get a lot of use.
The show file command's most useful options are show file information, which displays information about a specified file, and show file systems, which displays information about the file systems. Here's an example:
The more command shows a text file. This command works just like it does in Linux—it allows you to view a file on a disk. In the case of the Cisco IOS, you can use this command to view a text file, such as your configuration file or a saved backup configuration file. Here's an example:
This command does just as it implies—it deletes files. There's really nothing special about this command, except for one thing: Depending on the type of router, deleting a file may not actually free up the file space the file was using. To reclaim the space the deleted files were using, you may need to use the squeeze command.
Depending on the type of memory you're using, you can use either the erase or format command to wipe out the Flash drive. The erase command is the more common command used.
When copying files, you must be very careful to answer no to the question of whether you want to erase the file system. Here's an example:
If you just press [Enter] and accept the default answer, you'll delete the IOS file when trying to back up your router's configuration to Flash.
You can use the cd command to change directories, which works the same way in DOS and Linux. This command changes the directory to whichever directory you specify. You can use the pwd command to print the working directory, which also works the same way in Linux.
Let's look at an example. Notice that using the dir command displays the new working directory—the nvram file system—instead of the Flash default.
Some routers and switches offer the ability to create and delete directories. You can use the mkdir command to create a directory, and the rmdir command will remove a specified directory. Obviously, you would need to use the cd and pwd commands to change into these directories.
For more information on how to use these commands, check out Cisco's Using the Cisco IOS Integrated File System documentation.
Check out the Cisco Routers and Switches Archive, and catch up on David Davis' most recent columns.
Want to learn more about router and switch management? Automatically sign up for our free Cisco Routers and Switches newsletter, delivered each Friday!
David Davis has worked in the IT industry for 12 years and holds several certifications, including CCIE, MCSE+I, CISSP, CCNA, CCDA, and CCNP. He currently manages a group of systems/network administrators for a privately owned retail company and performs networking/systems consulting on a part-time basis.