NVMe over TCP
CLI reference:/disk/disk/format
This feature requires the rose-storage package; see Storage.
NVMe over TCP allows accessing storage over the network as an NVMe block device on the initiator (client) side. On the target (host) side the device can be an HDD/SSD/NVMe drive, a file, or a RAID array.
On the target, nvme-tcp-server-port (default 4420) sets the TCP port, and nvme-tcp-server-nqn shows the NQN of the export, by default nqn.2000-02.com.mikrotik:<slot>. On the client, nvme-tcp-address, nvme-tcp-port and nvme-tcp-nqn select the export. The remote disk appears on a RouterOS client as nvme-tcp1, nvme-tcp2 and so on, with state="live" when it is connected.
Examples
Mount a disk
In this example, one RouterOS device is used as a storage server (Host) and another RouterOS device mounts the storage over the network (Client).
-
On the Host, export the disk:
/disk/set disk1 nvme-tcp-export=yes -
On the Client, add the remote disk.
/disk/nvme-discover 192.168.1.1lists the NQNs that the host exports:/disk/add type=nvme-tcp nvme-tcp-address=192.168.1.1 \nvme-tcp-nqn=nqn.2000-02.com.mikrotik:disk1 -
The Client now has a disk,
nvme-tcp1, that is mounted over the network using NVMe over TCP.
Linux client
Use these commands to set up NVMe over TCP on a Linux Client (nvme-cli).
-
Load the kernel module:
modprobe nvme_tcp -
Discover the exports of the host. In this output, the host exports a file disk called
file2:nvme discover -t tcp -a 192.168.1.1 -s 4420Discovery Log Number of Records 1, Generation counter 5=====Discovery Log Entry 0======trtype: tcpadrfam: ipv4subtype: nvme subsystemtreq: not specified, sq flow control disable supportedportid: 4420trsvcid: 4420subnqn: nqn.2000-02.com.mikrotik:file2traddr: 10.0.2.15eflags: nonesectype: none -
Connect to an export:
nvme connect -t tcp -a 192.168.1.1 -s 4420 -n nqn.2000-02.com.mikrotik:disk1 -
A new NVMe block device is now available, for example
/dev/nvme0n1; the number depends on the NVMe devices that the client already has:ls /dev/nvme* -
You can now use the block device like any other block device on your Linux Client.
To disconnect the block device:
nvme disconnect -n nqn.2000-02.com.mikrotik:disk1
Mount a file as a block device
In this example, one RouterOS device is used as a storage server (Host) and another RouterOS device mounts the storage over the network (Client).
A file lets you give the Client a part of a disk instead of the whole disk. Mounting a file has lower performance than mounting a disk (or partition) using NVMe over TCP.
-
On the Host, create a file that is used as a block device, and export it:
/disk/add type=file file-path=disk1/BIGFILE.img file-size=10G \slot=blockdevice1/disk/set blockdevice1 nvme-tcp-export=yes -
On the Client, add the remote disk and format it:
/disk/nvme-discover 192.168.1.1/disk/add type=nvme-tcp nvme-tcp-address=192.168.1.1 \nvme-tcp-nqn=nqn.2000-02.com.mikrotik:blockdevice1/disk/format nvme-tcp1 file-system=ext4 -
The Client now has a new disk,
nvme-tcp1, even though on the Host the storage device is a file.
To mount the block device on a Linux Client, see the Linux client section.
Mount a RAID array
In this example, the Host exports a RAID array, so the Client gets a single disk with data redundancy.
-
Set up a RAID array on the Host and export it, for example:
/disk/add type=raid slot=RAID6_array raid-type=6 raid-device-count=8/disk/set disk1 raid-master=RAID6_array raid-role=0/disk/set disk2 raid-master=RAID6_array raid-role=1/disk/set disk3 raid-master=RAID6_array raid-role=2/disk/set disk4 raid-master=RAID6_array raid-role=3/disk/set disk5 raid-master=RAID6_array raid-role=4/disk/set disk6 raid-master=RAID6_array raid-role=5/disk/set disk7 raid-master=RAID6_array raid-role=6/disk/set disk8 raid-master=RAID6_array raid-role=7/disk/set RAID6_array nvme-tcp-export=yes -
On the Client, add the remote disk:
/disk/add type=nvme-tcp nvme-tcp-address=192.168.1.1 \nvme-tcp-nqn=nqn.2000-02.com.mikrotik:RAID6_array -
The Client now sees a single disk that is a RAID array on the Host.
To mount the block device on a Linux Client, see the Linux client section.
Do not mount multiple disks from different RouterOS devices on a Linux Client and put them into a software RAID configuration (for example, mdadm). While this type of configuration does provide some redundancy, you can expect abnormal latency issues or even timeouts. Create a RAID array on your RouterOS device instead and export the RAID array as a block device to your Linux Client.
Limit access to an export
nvme-tcp-server-allow-host-name on the exported disk limits it to clients with that host name. A client sends its host name in nvme-tcp-host-name, by default MikroTik:
# On the host:
/disk/set disk1 nvme-tcp-server-allow-host-name=-client
# On the client:
/disk/set nvme-tcp1 nvme-tcp-host-name=-client
A client with another host name cannot use the disk; its state shows I/O error. For authentication with a secret, see nvme-tcp-server-password and nvme-tcp-server-secret in the /disk reference.