* 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.
@ 2023-07-25 11:23 Ashutosh Sharma
2023-08-03 9:44 ` Klaus Jensen
0 siblings, 1 reply; 2+ messages in thread
From: Ashutosh Sharma @ 2023-07-25 11:23 UTC (permalink / raw)
To: qemu-devel
Cc: peterx, k.jensen, philmd, armbru, mst, lukasz.gieryk,
alex.williamson, helgaas, afaria
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* 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.
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
0 siblings, 0 replies; 2+ messages in thread
From: Klaus Jensen @ 2023-08-03 9:44 UTC (permalink / raw)
To: Ashutosh Sharma
Cc: qemu-devel, peterx, k.jensen, philmd, armbru, mst, lukasz.gieryk,
alex.williamson, helgaas, afaria
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-03 9:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).