ファイルを使用したnvmeデバイスのシミュレーション

ファイルを使用したnvmeデバイスのシミュレーション

ファイルを使用してNVMeデバイスをエミュレートできますか?私はqemuを使用したくありません。私のコンピュータでは本当に遅いです。

ベストアンサー1

はい、可能です。しかし、NVMEターゲットサポートが必要です。

  1. カーネルモジュールがあることを確認してください:nvme_loop、、、nvmetnvme_fabrics
  2. ファイルにループデバイスを設定します。losetup /dev/loop0 /tmp/mynvmefile
  3. 得るNVMEターゲットCLI、依存関係があることを確認してください。
    1. configshell-fb基本部門であり、正しく宣言されていません。setup.py
  4. examples/loop.jsonnvmetcliで編集:
    1. device例の背景を/dev/loop0(デフォルトは/dev/nvme0n1)に変更します。
  5. 目標を設定する:sudo ./nvmetcli restore examples/loop-modified.json
    1. カーネルログには1行だけが必要です。nvmet: adding nsid 1 to subsystem testnqn
  6. nvme-cli ツールを使用してターゲットに接続します。nvme connect -t loop -n testnqn -q hostnqn
  7. 利益!

作成および接続後のdmesg出力の例

nvmet: adding nsid 1 to subsystem testnqn
nvmet: creating controller 1 for subsystem testnqn for NQN hostnqn.
nvme nvme0: creating 8 I/O queues.
nvmet: adding queue 1 to ctrl 1.
nvmet: adding queue 2 to ctrl 1.
nvmet: adding queue 3 to ctrl 1.
nvmet: adding queue 4 to ctrl 1.
nvmet: adding queue 5 to ctrl 1.
nvmet: adding queue 6 to ctrl 1.
nvmet: adding queue 7 to ctrl 1.
nvmet: adding queue 8 to ctrl 1.
nvme nvme0: new ctrl: "testnqn"

NVME情報:

# nvme  list
Node             SN                   Model                                    Namespace Usage                      Format           FW Rev  
---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1     191b474c759f6b80     Linux                                    1         134.22  MB / 134.22  MB      4 KiB +  0 B   4.14.0-r

fioはこの偽のデバイス(ディスク上のファイルではなくメモリとしてサポートされています)で実行されます。

# fio --filename=/dev/nvme0n1  --rw=write --bs=4k --numjobs=1 \
--iodepth=1 --runtime=60 --time_based --group_reporting \
--name=journal-test
journal-test: (g=0): rw=write, bs=4K-4K/4K-4K/4K-4K, ioengine=psync, iodepth=1
fio-2.16
Starting 1 process
Jobs: 1 (f=1): [W(1)] [100.0% done] [0KB/951.4MB/0KB /s] [0/244K/0 iops] [eta 00m:00s]
journal-test: (groupid=0, jobs=1): err= 0: pid=13352: Thu Oct 19 13:26:18 2017
  write: io=110476MB, bw=1840.5MB/s, iops=471152, runt= 60027msec
    clat (usec): min=0, max=85222, avg= 1.78, stdev=190.60
     lat (usec): min=0, max=85222, avg= 1.84, stdev=190.60
    clat percentiles (usec):
     |  1.00th=[    0],  5.00th=[    0], 10.00th=[    1], 20.00th=[    1],
     | 30.00th=[    1], 40.00th=[    1], 50.00th=[    1], 60.00th=[    1],
     | 70.00th=[    1], 80.00th=[    1], 90.00th=[    2], 95.00th=[    2],
     | 99.00th=[    2], 99.50th=[    3], 99.90th=[    9], 99.95th=[    9],
     | 99.99th=[   21]
    lat (usec) : 2=88.18%, 4=11.50%, 10=0.27%, 20=0.03%, 50=0.01%
    lat (usec) : 100=0.01%, 250=0.01%, 500=0.01%, 750=0.01%
    lat (msec) : 2=0.01%, 4=0.01%, 10=0.01%, 20=0.01%, 50=0.01%
    lat (msec) : 100=0.01%
  cpu          : usr=26.90%, sys=39.40%, ctx=3488, majf=0, minf=11
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued    : total=r=0/w=28281845/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
  WRITE: io=110476MB, aggrb=1840.5MB/s, minb=1840.5MB/s, maxb=1840.5MB/s, mint=60027msec, maxt=60027msec

Disk stats (read/write):
  nvme0n1: ios=0/12044, merge=0/3027439, ticks=0/347358, in_queue=318011, util=46.10%

おすすめ記事