...
Info |
---|
Note: Starting from RouterOS 7.7 disks will carry names (slots) where they are physically connected |
Info |
---|
ROSE-storage - package adds additional enterprise data center functionality to RouterOS. Current manual page does not include additional features included in ROSE-storage package.
|
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. |
format-drive () | Command to initiate disk formatting process. Contains additional properties of its own. Such as "file-system" and "label".- fileslot - select disk (slot) that should be formatted
- file-system ('fat32', 'ext4' or 'ext4wipe') - Format disk with type FAT32 or EXT4 or securely wipe all data
- interval
- label - Label to be assigned to disk
| monitor-traffic
| - label
- mbr partition table - make mbr partition table
Monitors inbound and outbound disk traffic |
reset-counters
| resets /interface print stats counters |
Examples
Formatting attached storage unit - Simple
1. Disk is attached, and already mounted automatically by the system.
Code Block |
---|
|
[admin@MikroTik] > /disk print
# NAME LABEL TYPE DISK FREE SIZE
0 disk1 usb-flash ext4 00 7.1GiB 7.2GiB |
Code Block |
---|
|
[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.
Code Block |
---|
|
[admin@MikroTik] > /disk eject-drive 0 |
3. Formatting the disk, in either of two supported file-systems (ext4 or fat32).
Code Block |
---|
|
[admin@MikroTik] > /disk format-drive 0 file-system=ext4 label=flashdrive
formatted: 100% |
4. It's done! Drive is formatted and should be automatically mounted after formatting process is finished.
Formatting attached storage unit - Detailed
Let us presume that you have added a 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 a supported file-system and partition record, it will be found in "/files" menu moments after you plugged it in to the host device.
If not, here is what you have to do.
1. Do a quick print of disk menu, to make sure that router sees the attached storage.
Flags
Property | Description |
---|
X - disabled | Disabled device |
E - empty | Empty slot |
B - BLOCK-DEVICE | The "B - BLOCK-DEVICE"- Flag means that this device works using blocks for input/output operations. In the context of RouterOS, its distinction is crucial, as it helps determine whether a device is functioning as a data carrier or simply providing information about the disk layout structure. This difference becomes important when considering the extender with the device behind it. If a device is marked with the letter "B", this indicates its ability to be used as storage or memory. In contrast, devices that do not have a "B" mark are designed primarily to understand the structure of the disk. This allows to quickly recognize the presence of a PCIe or SAS expander, as well as detect the presence of drives in the first expander. In addition, it allows you to estimate the speed of the connection to which each device is connected. However, the most notable benefit of the "B" flag is its ability to instantly indicate whether a device can be formatted or used for RAID purposes. |
M - mounted | Mounted partition |
F - formatting | The device is currently in the formatting process |
p - partition | The device has a partition |
f - raid-member-failed | These options are used with the ROSE package. |
r - raid-member |
c - encrypted |
g - guid-partition-table |
t - nvme-tcp-export |
i - iscsi-export |
s - smb-export |
n - nfs-export |
O - tcg-opal-self-encryption-enabled |
o - tcg-opal-self-encryption-supported |
Settings
Property
| Description |
---|
auto-smb-sharing (yes | no; Default: no) | Enables dynamic SMB shares when new disk/partition item is added in "/disk" |
auto-smb-user (list of strings; Default: ) | Default value for smb-sharing/smb-user setting, when new disk/partition item is added in "/disk" |
auto-media-share (yes | no; Default: no) | Enables media dynamically when new disk/partition item is added in "/disk" |
auto-media-interface (list of strings; Default: ) | Interface that will be used in dynamic instance for ip/media when new disk/partition item is added in "/disk" |
Info |
---|
|
With "auto-smb-sharing=yes" and "/ip smb share enabled=auto" SMB server gets enabled when a storage device is physically plugged in |
Examples
Formatting attached storage unit - Simple
1. Disk is attached, and already mounted automatically by the system.
Code Block |
---|
Code Block |
---|
|
[admin@MikroTik] > disk print
Flags: # NAME LABEL TYPE DISK FREE SIZE
0 disk1B - BLOCK-DEVICE; M, F - FORMATTING
Columns: SLOT, MODEL, SERIAL, INTERFACE, SIZE, FREE, FS
# SLOT MODEL SERIAL NO NAME fat32 00 INTERFACE 6.6GiB 7.2GiB |
We can here see that system sees one storage drive and also that it is formatted with a known file-system type.
When running file menu print-out we also see that is mounted.
Code Block |
---|
|
[admin@MikroTik] > file print
# NAME TYPE SIZE CREATION-TIME
0 disk1 disk FREE FS
0 BM usb1 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 the command that is pasted below. Note that you can use disk "id" or "name" for this task. ID number is usable only after the print command on the specific menu has been issued and presuming that the order or count has not changed, as that would also possibly change the id. OR this disk name identifier which in this example case would be
"NO NAME". Name can be used without issuing print as that is a static value and should not change unless changed manually by you.
In short: using the ID number of the disk is easy, but printout of this menu must be done first.
Code Block |
---|
|
[admin@MikroTik] > disk eject-drive 0 |
In short: using name, quicker if you know the device name. But "" needs to be added if this value contains spaces or some symbols that might confuse console.
Code Block |
---|
|
[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 (ext4 or fat32), we can also assign label to device as I did in this example.
Code Block |
---|
|
[admin@MikroTik] > /disk format-drive 0 file-system=ext4 label=usb-flash
formatted: 100% |
Info |
---|
Note: In printout you can see that there is progress percentage counter in formatting process. For larger storage drives it might take longer for this 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. |
USB Flash Disk FBA0911260071572 USB 2.00 480Mbps 2 004 877 312 1 921 835 008 ext4 |
Code Block |
---|
|
[admin@MikroTik] > /file print
# NAME TYPE SIZE CREATION-TIME
0 skins directory jan/01/1970 03:00:01
1 pub directory feb/04/1970 21:31:40
2 usb1 disk mar/07/2022 14:05:16 |
2. Formatting the disk, in either of two supported file-systems (ext4 or fat32).
Code Block |
---|
|
[admin@MikroTik] > /disk format-drive usb1 file-system=ext4 mbr-partition-table=no
formatted: 100% |
3. It's done! Drive is formatted and should be automatically mounted after formatting process is finished.
Formatting attached storage unit - Detailed
Let us presume that you have added a 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 a supported file-system and partition record, it will be found in "/files" menu moments after you plugged it in to the host device.
If not, here is what you have to do.
1. Do a quick print of disk menu, to make sure that router sees the attached storage.
Code Block |
---|
|
[admin@MikroTik] > disk print
Flags: B - BLOCK-DEVICE; M, F - FORMATTING
Columns: SLOT, MODEL, SERIAL, INTERFACE, SIZE, FREE, FS
# SLOT MODEL SERIAL INTERFACE SIZE FREE FS
0 BM usb1 USB Flash Disk FBA0911260071572 USB 2.00 480Mbps 2 004 877 312 1 921 835 008 ext4 |
We can here see that system sees one storage drive and also that it is formatted with a known file-system type.
When running file menu print-out we also see that is mounted.
Code Block |
---|
|
[admin@MikroTik] > file print
# NAME TYPE SIZE CREATION-TIME
0 usb1 disk mar/07/2022 14:05:16
1 skins directory jan/01/1970 03:00:01
2 pub directory feb/04/1970 21:31:40 |
2. To formatting drive - we issue command with previously know id or name(slot) and with desired file-system (ext4 or fat32), we can also assign label to device as I did in this example and make mbr partition table
Code Block |
---|
|
[admin@MikroTik] > /disk format-drive usb1 file-system=ext4 label=usb-flash mbr-partition-table=yes
formatted: 100% |
Info |
---|
Note: In printout, you can see that there is a progress percentage counter in formatting process. For larger storage drives, it might take longer for this process to finish, so be patient. |
If multiple GPT partitions are needed format drive without partition table and add them manually:
Code Block |
---|
|
[admin@MikroTik] > /disk format-drive usb1 file-system=ext4 label=usb-flash mbr-partition-table=no
formatted: 100% |
Code Block |
---|
|
[admin@MikroTik] > /disk add type=partition parent=usb1 partition-size=200M
[admin@MikroTik] > /disk add type=partition parent=usb1 partition-size=500M
[admin@MikroTik] > /disk add type=partition parent=usb1 slot=usb1-last-partition |
Info |
---|
Note: Slot (partition or disk name) is assumed automatically, but can be overwritten by using slot parameter. If partition size is not used all available space will be used from last partition. To offset partition start "partition-offset" parameter can be used. |
Info |
---|
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
...
Code Block |
---|
|
[admin@MikroTik] > /ip proxy set cache-path=disk3usb1/cache-n-db/proxy/
...
[admin@MikroTik] > /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 disk3usb1 disk jul/03/2015 11:35:05
3 disk3usb1/lost+found directory jul/03/2015 11:34:56
4 disk3usb1/cache-n-db directory jul/03/2015 11:41:54
4 disk3usb1/cache-n-db/proxy web-proxy store jul/03/2015 11:42:09 |
...
Code Block |
---|
|
[admin@MikroTik] > /system logging action set disk disk-file-name=/disk3disk1/log/syslog
...
[admin@MikroTik] > /file print where name~"disk3disk1/log"
# NAME TYPE SIZE CREATION-TIME
0 disk3disk1/log directory jul/03/2015 12:44:09
1 disk3disk1/log/syslog.0.txt .txt file 160 jul/03/2015 12:44:11 |
...