I’m running nvmet-tcp on a Linux server. I’m trying to pass-thru an nvme device from server to the client. And it’s actually working alright. First, I would load the nvmet and nvmet-tcp on the server
modprobe nvmet
modprobe nvmet-tcp
Then I would create a subsuystem in
cd /sys/kernel/config/nvmet/subsystems
mkdir test
and set all the params. After that, I would go to the namespaces folder in /sys/kernel/config/nvmet/subsystems/test/nvmet
cd test/namespaces
mkdir 1
mkdir 2
mkdir 3
Subsequently, standard config
echo -n /dev/sda1 > 1/device_path
echo -n /dev/sda2 > 2/device_path
echo -n /dev/sda3 > 3/device_path
And enable all of those:
echo -n 1 > 1/enabled
echo -n 1 > 2/enabled
echo -n 1 > 3/enabled
After—activate a port (after proper configuration)
cd /sys/kernel/config/nvmet/ports/1/subsystems/
ln -s ../../../subsystems/test .
That would fire up the port, and it will work just fine. On a host machine, I would connect with:
nvme connect -t tcp -n test -a 10.10.1.42 -s 4420
The only problem is that when I’m listing namespaces I’m getting an extra “-1” namespace.
nvme list
Node SN Model Namespace Usage Format FW Rev
---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1 76b9b4aeef600ece Linux -1 0.00 B / 0.00 B 1 B + 0 B 5.13.0-2
/dev/nvme0n2 76b9b4aeef600ece Linux 1 2.00 GB / 2.00 GB 512 B + 0 B 5.13.0-2
/dev/nvme0n3 76b9b4aeef600ece Linux 2 2.00 GB / 2.00 GB 512 B + 0 B 5.13.0-2
/dev/nvme0n4 76b9b4aeef600ece Linux 3 2.00 GB / 2.00 GB 512 B + 0 B 5.13.0-2
In fact, everything work so great that I’m able to create a new namespace on the fly and the host machine would see it and mount it automatically as a separate disk. But I can’t figure out how to debug/handle the -1 disk that is mounted first in there.
Could anyone please advise?