Need ubuntu-image support 4K sector size

Bug #1942416 reported by Soar Huang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OEM Priority Project
New
High
Soar Huang
Ubuntu Image
Fix Released
Undecided
Łukasz Zemczak

Bug Description

[Impact]
ubuntu-image will generate prebuilt image with 512B sector size only

* https://bugs.launchpad.net/ubuntu-image/+bug/1667313
* https://github.com/CanonicalLtd/ubuntu-image/blob/12fbf84b0ec556f28dac8e4ba56f07e69efc9720/ubuntu_image/common_builder.py#L395
* https://github.com/CanonicalLtd/ubuntu-image/blob/12fbf84b0ec556f28dac8e4ba56f07e69efc9720/ubuntu_image/helpers.py#L269

Unfortunately, the prebuilt image with 512B sector size
cannot work on 4K logical & physical sector size NVMe SSD

ie. Micron_7300_MTFDHBG3T8TDF 4K logical & physical sector size NVMe SSD
(Micron_7300_MTFDHBG3T8TDF_NVMeSSD.jpg)

[Test Plan]
Check if follow steps below, try boot from SSD, and get into Ubuntu Server/Core

* Ubuntu Server 20.04
# Running command below to generate prebuilt image, erase and dd on 4K sector size NVMe SSD
$ UBUNTU_STORE_AUTH_DATA_FILENAME=store.cred TARGET_ARCH=amd64 \
    ubuntu-image classic -d -O out -w work -f cloud-image \
    --hooks-directory hooks -a amd64 gadget/prime

$ sudo fstrim --fstab --verbose
$ sudo blkdiscard /dev/nvme0n1
$ sudo wipefs -a /dev/nvme0n1
$ sudo dd if=US2004-prebuilt.img of=/dev/nvme0n1 status=progress && sync

* Ubuntu Core 20
# Download image, erase and dd on 4K sector size NVMe SSD
# https://cdimage.ubuntu.com/ubuntu-core/20/stable/current/ubuntu-core-20-amd64.img.xz

$ sudo fstrim --fstab --verbose
$ sudo blkdiscard /dev/nvme0n1
$ sudo wipefs -a /dev/nvme0n1
$ xzcat ubuntu-core-20-amd64.img.xz | sudo dd of=/dev/nvme0n1 status=progress && sync

[Where problems could occur]
Flash 512B sector size prebuilt image on 4K sector size NVMe SSD

[Regression potential]
Use advanced format 4K sector size to become more reliable
https://www.seagate.com/as/en/tech-insights/advanced-format-4k-sector-hard-drives-master-ti/

Tags: oem-priority
Revision history for this message
Soar Huang (soarhuang) wrote :
Revision history for this message
Soar Huang (soarhuang) wrote :

Update some investigation

Running commands and check partition table, it doesn't meet our expectations.
We cannot see BIOS boot and EFI system partitions

$ sudo fstrim --fstab --verbose
$ sudo blkdiscard /dev/nvme0n1
$ sudo wipefs -a /dev/nvme0n1
$ xzcat ubuntu-core-20-amd64.img.xz | sudo dd of=/dev/nvme0n1 status=progress && sync
$ sudo fdisk -l /dev/nvme0n1

------
ubuntu-server@ubuntu-server:~$ sudo fdisk -l /dev/nvme0n1
GPT PMBR size mismatch (7577599 != 937684565) will be corrected by write.
Disk /dev/nvme0n1: 3.5 TiB, 3840755982336 bytes, 937684566 sectors
Disk model: Micron_7300_MTFDHBG3T8TDF
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device Boot Start End Sectors Size Id Type
/dev/nvme0n1p1 1 937684565 937684565 3.5T ee GPT

Soar Huang (soarhuang)
description: updated
Changed in oem-priority:
importance: Undecided → High
assignee: nobody → Soar Huang (soarhuang)
description: updated
Soar Huang (soarhuang)
description: updated
Changed in ubuntu-image:
assignee: nobody → Łukasz Zemczak (sil2100)
status: New → In Progress
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

...this is in progress still. Basically changes have been committed and mostly working, but there's still an issue I'm trying to investigate per Soar's feedback.

Changed in ubuntu-image:
milestone: none → 2.1
Revision history for this message
ethan.hsieh (ethan.hsieh) wrote :

The issue is gone with jammy-updates: (2.2+22.04ubuntu3) and latest/stable (2.2+snap10, 321).

Paul Mars (upils)
Changed in ubuntu-image:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.