Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

PropertyDescription
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 'wipe') - 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.

disk (slot) statistics

Flags

PropertyDescription
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 - mountedMounted partition
F - formattingThe device is currently in the formatting process
p - partitionThe device has a partition
f - raid-member-failedThese 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
titleNotes

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
languageros
[admin@MikroTik] > disk print
Flags: B - BLOCK-DEVICE; M, F - FORMATTING
Columns: SLOT, MODEL, SERIAL, INTERFACE, SIZE, FREE, FS
#    SLOT  
Code Block
languageros
[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

...

Code Block
languageros
[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      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
languageros
[admin@MikroTik] >  /disk format-drive usb1 file-system=ext4 mbr-partition-table=no
           mar/07/2022 14:05:16

2. Formatting the disk, in either of two supported file-systems (ext4 or fat32). 

Code Block
languageros
[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.

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
languageros
[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
Code Block
languageros
[admin@MikroTik] > disk print
 # NAME		LABEL	TYPE	DISK	FREE       SIZE
 0 usb1    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 a known file-system type.

...

Code Block
languageros
[admin@MikroTik] > file print
 # NAME     TYPE    SIZE CREATION-TIME
 0 disk1usb1     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

...

Code Block
languageros
[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.

...

Code Block
languageros
[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 usb1disk1/log                                         directory                             jul/03/2015 12:44:09
 1 usb1disk1/log/syslog.0.txt                            .txt file                         160 jul/03/2015 12:44:11

...