This can be tested by creating a block device with 4K sectorsize using the following QEMU args: -device virtio-blk,drive=testdrive4k,logical_block_size=4096,physical_block_size=4096 -drive file=/path/to/4k-testdisk.img,if=none,id=testdrive4k
The 4k-testdisk.img was created with: qemu-img create -f qcow2 /path/to/4k-testdisk.img 16G Signed-off-by: Christoph Heiss <c.he...@proxmox.com> --- proxmox-tui-installer/src/setup.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/proxmox-tui-installer/src/setup.rs b/proxmox-tui-installer/src/setup.rs index e51bb4d..c071b80 100644 --- a/proxmox-tui-installer/src/setup.rs +++ b/proxmox-tui-installer/src/setup.rs @@ -283,7 +283,10 @@ where .map( |(index, device, size_mb, model, logical_bsize, _syspath)| Disk { index: index.to_string(), - size: (size_mb * logical_bsize as f64) / 1024. / 1024. / 1024., + // Linux always reports the size of block devices in sectors, where one sector is + // defined as being 2^9 = 512 bytes in size. + // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/blk_types.h?h=v6.4#n30 + size: (size_mb * 512.) / 1024. / 1024. / 1024., block_size: logical_bsize, path: device, model: (!model.is_empty()).then_some(model), -- 2.41.0 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel