Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Snippets
  • Sign up now
  • Login
  • Sign in / Register
  • QEMU QEMU
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 740
    • Issues 740
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Insights
    • Issue
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • QEMUQEMU
  • QEMUQEMU
  • Issues
  • #297
Closed
Open
Issue created May 14, 2021 by Philippe Mathieu-Daudé@philmd_rh

SD card size constraint conceptually wrong

This bug has been copied automatically from: https://bugs.launchpad.net/qemu/+bug/1910586
Reported by '-' on 2021-01-07 :

The patch discussed here:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg720833.html
introduces an artificial size constraint for SD cards
that has no relation to reality.

I'm trying to use an _actual_ **physical** SD card,
and qemu tells me its size is "invalid".

Something here appears to be conceptually wrong.

--------------------------------------------------
# fdisk -l /dev/sdg
Disk /dev/sdg: 14.84 GiB, 15931539456 bytes, 31116288 sectors
Disk model: USB  SD Reader
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7a0c8bb0

Device     Boot  Start      End  Sectors  Size Id Type
/dev/sdg1         2048   524287   522240  255M  c W95 FAT32 (LBA)
/dev/sdg2       524288 31116287 30592000 14.6G 83 Linux
# qemu-system-aarch64 -M raspi3 -m 1G -kernel vmlinuz-5.4.79-v8 -dtb
bcm2837-rpi-3-b-plus.dtb -append console=ttyAMA0\ root=/dev/mmcblk0p2\ rw
-nographic -serial mon:stdio -drive file=/dev/sdg,format=raw
qemu-system-aarch64: Invalid SD card size: 14.8 GiB
SD card size has to be a power of 2, e.g. 16 GiB.
You can resize disk images with 'qemu-img resize <imagefile> <new-size>'
(note that this will lose data if you make the image smaller than it
currently is).
--------------------------------------------------

The same invocation with a dump of the actual image
resized to match qemu's odd expectations works fine.


This is on QEMU 5.2.0, as evidenced by the following:
--------------------------------------------------
# qemu-system-aarch64 -version
QEMU emulator version 5.2.0
Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers
--------------------------------------------------

Is there a simple workaround that disables this rather
arbitrary constraint?
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking