Use um arquivo para emular o dispositivo nvme

2

Posso usar um arquivo para emular um dispositivo NVMe? Eu não quero usar o qemu, é muito lento na minha máquina.

    
por Nargesoo 10.01.2017 / 18:09

1 resposta

2

Sim, você pode, mas precisa de suporte ao alvo do NVME.

  1. Verifique se você tem módulos do kernel: nvme_loop , nvmet , nvme_fabrics
  2. Configurar o dispositivo de loop no arquivo: losetup /dev/loop0 /tmp/mynvmefile
  3. Obtenha o CLI de destino do NVME e verifique se você tem as dependências.
    1. configshell-fb é o dep principal e não foi declarado corretamente em setup.py
  4. Edite o examples/loop.json do nvmetcli:
    1. Altere o device do backup para o exemplo em /dev/loop0 (o valor padrão é /dev/nvme0n1 ).
  5. Configure o destino: sudo ./nvmetcli restore examples/loop-modified.json
    1. O log do kernel deve obter uma única linha: nvmet: adding nsid 1 to subsystem testnqn
  6. Conecte-se ao destino usando a ferramenta nvme-cli: nvme connect -t loop -n testnqn -q hostnqn
  7. Lucro!

Exemplo de saída dmesg depois de criar & conectando

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"

Informação 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

O resultado é executado neste dispositivo falso (com suporte de memória, não arquivo-no-disco):

# 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%
    
por 19.10.2017 / 22:25

Tags