Deleting Files From Flash
Recently I came across a situation where I wanted to delete selected files from the Flash memory on my router. In order to delete the files, I issued the following command:
delete flash:/file.bin
After doing that I was surprised to see that the files were only marked for deletion in flash, which meant they were also still occupying the storage space I needed for other files. In order to permanently delete the files, the following command needs to be issued:
squeeze flash:
After trying to run the squeeze command, I received an error saying no squeeze logs could be found and the operation failed. After some research I discovered that you need to run squeeze on the flash memory while it is empty (I later found you can do this with just the IOS image in flash). Here is the process I followed.
- Make sure you have a backup copy of the IOS image you want on the router.
- Format flash (Do not reboot the router after this)
erase flash - Reload the IOS image into flash.
copy tftp://xxx.xxx.xxx.xxx/ios_image.bin flash:/ - Run squeeze on flash
squeeze flash:
After all of this is completed, you will be able to mark files for deletion using the delete command and then permanently delete them with the squeeze command.