Manual:Store - after v6.20 release

From MikroTik Wiki
Jump to: navigation, search

Content to be added! ~

Version.png

Applies to RouterOS: v6.20 < v6.xx

Summary

Sub-menu: /disk


Since v6.20 release attached storage are now managed in "/disk" sub-menu, instead of previous "/store disk" menu.

  • This menu will list all attached storage devices, presuming that they are supported and in working condition.
  • As a note, Webproxy and User manager stores as now shown as directories in "/files menu". When configuring webproxy cache or usermanager database you will now be asked to write in path of directory where you want these stores to be created.
  • Since this change Dude database storage is broken and The Dude package can no longer be used since this release, till any further notice.

This is especially useful for RouterBOARD devices with SD/CF/USB slots and x86 systems with additional dedicated storage drives - as the built-in storage is quite small, an external drive comes in very handy when you want a big User Manager database, proxy cache or possibly SMB shares on your router.

You can add as many external or secondary drives as you want, and select any number of them for each of the mentioned feature use. For example User Manager could be used on 3 disks, one of them would be the active database, and the rest would be backups. You can then add a fourth disk, copy the active data to it - unmount - unplug it - and move to another server, to keep using the actual database. This means migration and backup made easy!

Icon-note.png

Note: If you are still running older release than v6.20 please check this article: article for more info on Stores in v6.19 and older releases.



Examples

Formatting attached storage unit - Simple

1. Disk is attached, and already mounted automatically by system.

[admin@MikroTik]  > /disk print
 # NAME  LABEL   	 TYPE	DISK 	FREE 	   SIZE
 0 disk1 usb-flash 	 ext3   00     7.1GiB     7.2GiB
[admin@MikroTik] > /file print
 # NAME                        TYPE          SIZE CREATION-TIME
 2 skins                       directory          jan/01/1970 03:00:01
 3 pub                         directory          feb/04/1970 21:31:40
 4 disk1                       disk               apr/20/2015 14:05:16

2. Unmounting storage drive in order to format it.

[admin@MikroTik] > /disk eject-drive 0

3. Formating the disk, in either of two supported file-systems (ext3 or fat32).

[admin@MikroTik] > /disk format-drive 0 file-system=ext3 label=flashdrive
  formatted: 100%

4. It's done! Drive is formatted and should be automatically mounted after formatting process was finished.

Formatting attached storage unit - Detailed

Lets presume that you have added storage device to your device that is running RouterOS. System will try to automatically mount it, and in such case if storage is formatted in supported file-system and partition record it will be found in "/files" menu moments after you plugged it in host device.

If not here's what you have to do.

1. Do a quick print of disk menu, to make sure that router sees the attached storage.

[admin@MikroTik] > disk print
 # NAME		LABEL	TYPE	DISK	FREE       SIZE
 0 disk1        NO NAME fat32   00     6.6GiB     7.2GiB

We can here see that system sees one storage drive and also that it is formatted with known file-system type.

When running file menu printout we also see that is mounted.

[admin@MikroTik] > file print
 # NAME     TYPE    SIZE CREATION-TIME
 0 disk1    disk         apr/20/2015 13:44:11
 1 skins    directory    jan/01/1970 03:00:01
 2 pub      directory    feb/04/1970 21:31:40


2. Now to format it we must first unmount it. To do that we need to issue following command that is pasted below. Note that you can use disk "id" or "name" for this task. ID number is usable only after print command on specific menu has been issued and presuming that order or count has not changed, as that would also possibly change the id. OR this disk name identifier which in example case would be
"NO NAME". Name can be used without issuing print as that is static value and should not change if not changed manually by you.


In short: using ID of disk easy, but printout of this menu must fist be done.

[admin@MikroTik] > disk eject-drive 0

In short: using name, quicker if you know the device name. But "" need to be added if this value contains spaces or some symbols that might confuse console.

[admin@MikroTik] > disk eject-drive "NO NAME"


3. Formatting drive now that it is unmounted. We issue command with previously know id or name and with desired file-system (ext3 or fat32), we can also assign label to device as I did in this example.

[admin@MikroTik] > /disk format-drive 0 file-system=ext3 label=usb-flash
  formatted: 100%
Icon-note.png

Note: In printout you can see that there is progress percentage counter in formatting process. For larger storage drivers it might take longer for this to process to finish so be patient. For this 8GB flash that I used it took about half a minute to finish formatting it on RB2011 router model. On some other devices with different cpu model it might take shorter or longer time to finish this process.


Icon-note.png

Note: For really large storage drives we recommend (if possible) to use some pc in order to format them prior to attaching them to your RouterOS based device.


Web-Proxy cache configuration example

Enter proxy cache path under IP -> Proxy menu and web proxy store is automatically created in files menu. If non-existent directory path is used additional sub-directory is also created automatically.


[admin@MirkoTik] >  /ip proxy set cache-path=disk3/cache-n-db/proxy/

...

[admin@MirkoTik] >  /file print
 # NAME                                              TYPE                             SIZE CREATION-TIME       
 0 skins                                             directory                             mar/02/2015 18:56:23
 1 sys-note.txt                                      .txt file                        23   jul/03/2015 11:40:48
 2 disk3                                             disk                                  jul/03/2015 11:35:05
 3 disk3/lost+found                                  directory                             jul/03/2015 11:34:56
 4 disk3/cache-n-db                                  directory                             jul/03/2015 11:41:54
 4 disk3/cache-n-db/proxy                            web-proxy store                       jul/03/2015 11:42:09

User manager database path configuration example

Example is made presuming that rest of configuration is in place and you are just changing/setting user-man database path. If non-existent directory path is used additional sub-directory is also created automatically.



[admin@MirkoTik] >  /tool user-manager database set db-path=disk3/cache-n-db/user-manager/

...

[admin@MirkoTik] >  /file print where name~"user-manager"
 #  NAME                                              TYPE                             SIZE CREATION-TIME       
 0 disk3/cache-n-db/user-manager/                     directory                             jul/03/2015 12:17:38
 1 disk3/cache-n-db/user-manager/sqldb                file                         367.0KiB jul/03/2015 12:17:38
 2 disk3/cache-n-db/user-manager/logsqldb             file                          29.0KiB jul/03/2015 11:00:42


Log on disk configuration example

When configuring logging on disk make sure that you create directories in which you want to store the log files manually, as non-existent directories will NOT be automatically created in this case.


[admin@MirkoTik] >  /system logging action set disk disk-file-name=/disk3/log/syslog

...

[admin@MirkoTik] >  /file print where name~"disk3/log"
 # NAME                                              TYPE                             SIZE CREATION-TIME       
 0 disk3/log                                         directory                             jul/03/2015 12:44:09
 1 disk3/log/syslog.0.txt                            .txt file                         160 jul/03/2015 12:44:11

Icon-note.png

Note: Logging topics like firewall, web-proxy and some other that tend to save large amount rapid printing logs on system nand disk might cause it to wear out faster, so using some attached storage or remote logging is recommened in this case.



Properties

Property Description
eject-drive (Integer; Default: ) Safely unmounts (ejects) drive of your selection by using drive ID or NAME that is assigned to it. After issuing this command it can be removed from host device. If drive is sata/etc on x86 device must be previously also shut down or hot-plug for sata interfaces must be enabled in bios is such feature is supported.
format-drive (; Default: ) Command to initiate disk formatting process. Contains additional properties of it's own. Like "file-system" and "label".
file-system (String; Default: fat32 | ext3) Command to initiate disk formatting process. Contains additional properties of it's own. Like "file-system" and "label".
label (String) Label to assign to disk that you did did or will format.
Icon-note.png

Note: additional properties yet to be added to wiki!