All of lore.kernel.org
 help / color / mirror / Atom feed
From: Klaus Jensen <its@irrelevant.dk>
To: Ashutosh Sharma <ashutosh.dandora4@gmail.com>
Cc: qemu-devel@nongnu.org, peterx@redhat.com, k.jensen@samsung.com,
	philmd@linaro.org, armbru@redhat.com, mst@redhat.com,
	lukasz.gieryk@linux.intel.com, alex.williamson@redhat.com,
	helgaas@kernel.org, afaria@redhat.com
Subject: Re: Format type of qemu NVMe virtual drive reverted back to its default (512 bytes block size) after performing hot plugout/plugin operation on that drive.
Date: Thu, 3 Aug 2023 11:44:28 +0200	[thread overview]
Message-ID: <ZMt2_L5_f24IsRO7@cormorant.local> (raw)
In-Reply-To: <CADOvtemuUgp322fE6xYrzVp_RNU_jpqOfzd-12ES-jpPoDvBaA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2776 bytes --]

On Jul 25 16:53, Ashutosh Sharma wrote:
> Hi,
> 
> I have a virtual system created using qemu 7.2. In that system, I
> attached/hot plugged a virtual NVMe drive. This drive had a default
> block size of 512 bytes.
> 
> admin@node-3:~$ sudo nvme list
> Node                  SN                   Model
>              Namespace Usage                      Format           FW
> Rev
> --------------------- --------------------
> ---------------------------------------- ---------
> -------------------------- ---------------- --------
> /dev/nvme0n1          ashudev-6f34a1cf_13  QEMU NVMe Ctrl
>              1          34.36  GB /  34.36  GB    512   B +  0 B
> 7.1.92
> 
> After that, I formatted this drive with 4k block size and it formatted
> successfully.
> 
> admin@node-3:~$ sudo nvme format /dev/nvme0n1 -f --lbaf 4
> Success formatting namespace:1
> admin@node-3:~$
> admin@node-3:~$ sudo nvme list
> Node                  SN                   Model
>              Namespace Usage                      Format           FW
> Rev
> --------------------- --------------------
> ---------------------------------------- ---------
> -------------------------- ---------------- --------
> /dev/nvme0n1          ashudev-6f34a1cf_13  QEMU NVMe Ctrl
>              1          34.36  GB /  34.36  GB      4 KiB +  0 B
> 7.1.92
> 
> Then, I just performed the hot plugout and then plugin operation on
> that drive using qmp.execute's device_del and device_add cmd
> respectively.
> 
> But, after that, the default block size of that drive reverted to 512 bytes.
> 
> admin@node-3:~$ sudo nvme list
> Node                  SN                   Model
>              Namespace Usage                      Format           FW
> Rev
> --------------------- --------------------
> ---------------------------------------- ---------
> -------------------------- ---------------- --------
> /dev/nvme0n1          ashudev-6f34a1cf_13  QEMU NVMe Ctrl
>              1          34.36  GB /  34.36  GB    512   B +  0 B
> 7.1.92
> 
> So, I just wanted to know why the NVMe format type reverted back to
> 512 bytes, as I just performed the hot plugout/plugin operations only.
> Drive's block size (format type) should not be changed upon
> removal/insertion, right ? or am I missing something ?
> 
> Regards,
> Ashutosh
> 

The nvme device (or namespaces) does not have any persistent state. The
only way to specify boot-to-boot configuration is through device
parameters. In other words, if you reformat to 4k, then you need to
change logical_block_size on the device/namespace upon reboot.

The format command mostly exists for testing purposes.

I guess it's a caveat we should be more clear about in the
documentation.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2023-08-03  9:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25 11:23 Format type of qemu NVMe virtual drive reverted back to its default (512 bytes block size) after performing hot plugout/plugin operation on that drive Ashutosh Sharma
2023-08-03  9:44 ` Klaus Jensen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZMt2_L5_f24IsRO7@cormorant.local \
    --to=its@irrelevant.dk \
    --cc=afaria@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=armbru@redhat.com \
    --cc=ashutosh.dandora4@gmail.com \
    --cc=helgaas@kernel.org \
    --cc=k.jensen@samsung.com \
    --cc=lukasz.gieryk@linux.intel.com \
    --cc=mst@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.