Files

File menu shows all userspace files on the router. It is possible to see and edit file content or delete file. File creation is possible starting from RouterOS 7.9beta2.  If RouterOS ".npk" package is uploaded, the file menu will also show package-specific information, for example, architecture, build date and time, etc.

[admin@MikroTik] > file print detail 
 0 name="routeros-mipsbe-6.45.7.npk" type="package" size=11.5MiB creation-time=oct/29/2019 11:36:15 
   package-name="routeros-mipsbe" package-version="6.45.7" package-build-time=oct/24/2019 08:44:35 
   package-architecture="mips" 

 1 name="flash" type="directory" creation-time=jan/01/1970 02:00:03 

 2 name="flash/skins" type="directory" creation-time=jan/01/1970 02:00:04 

 3 name="flash/rw" type="directory" creation-time=sep/06/2019 14:01:16 

 4 name="flash/rw/pckg" type="directory" creation-time=sep/06/2019 14:01:16 

To create new file (command added in RouterOS 7.9beta2):

[admin@MikroTik] > file add name=lala

If the device has a directory named "flash" in its file list, then files which you want to be kept after the system reboot/power cycle must be stored within it. As anything outside of it is kept within a RAM disk and will be lost upon reboot. This does not include .npk upgrade files as they will be applied by the upgrade process before the system discards the RAM drive content.

For multi core devices with a NAND flash memory (e.g. CCR series routers, RB4011iGS), RouterOS uses a write-back that will cache file changes into RAM memory instead of writing them straight away into flash media. The file changes will be stored on the flash when it is absolutely necessary, the writing can be delayed by up to 40 seconds. This helps to reduce CPU cycles which results in better performance. However, this can cause empty or zero-length files when a device experiences a sudden power loss, because files were not fully saved on a flash.

Properties

PropertyDescription
contents (string; Default: )The actual content of the file
creation-time (time)A time when the file was created
name (string)Name of the file
package-architecture (string)Architecture that package is built for. Applies only to RouterOS ".npk" files
package-built-time (string)A time when the package was built. Applies only to RouterOS ".npk" files
package-name (string)Name of the installable package that. Applies only to RouterOS ".npk" files
package-version (string)A version of the installable package that. Applies only to RouterOS ".npk" files
size (integer)File size in bytes
file type (string)Type of the file. For folders, the file type is the directory

Backups

RouterOS backup feature allows you to save the current device's configuration, which then can be re-applied on the same or a different identical model. This is very useful since it allows you to effortlessly restore the device's configurations or to re-apply the same configuration on a backup device. The system's backup file also contains the device's MAC addresses, which are also restored when the backup file is loaded. 

If The Dude and user-manager are installed on the router, then the system backup will not contain configuration from these services. Therefore additional care should be taken to save a configuration from these services, for example, configuration export.

System's backups contain sensitive information about your device and its configuration, always consider encrypting the backup file and keeping the backup file in a safe place. 

To save a backup configure the following:

[admin@MikroTik] >  system backup save name=/flash/backup1 password=StrongPass encryption=aes-sha256
Saving system configuration
Configuration backup saved

Note that we use "/flash/ "before the actual backup name on the devices with flash memory. As stated above, backups saved outside the flash folder will be deleted after a reboot or power cycle:

[admin@MikroTik] > system backup save name=backup2 password=StrongPass encryption=aes-sha256         
Saving system configuration
Configuration backup saved
[admin@MikroTik] > file print detail 
 0 name="flash" type="directory" creation-time=jan/01/1970 02:00:03 

 1 name="flash/skins" type="directory" creation-time=jan/01/1970 02:00:04 

 2 name="flash/rw" type="directory" creation-time=sep/06/2019 14:01:16 

 3 name="flash/rw/pckg" type="directory" creation-time=sep/06/2019 14:01:16 

 4 name="backup2.backup" type="backup" size=22.4KiB creation-time=oct/29/2019 11:40:33 

 5 name="flash/backup1.backup" type="backup" size=22.4KiB creation-time=oct/29/2019 11:40:11 

To load a backup, simply configure the following:

[admin@MikroTik] > system backup load name=/flash/backup1 password=StrongPass
Restore and reboot? [y/N]: 
Y
  • No labels