Skip to content

Expand root filesystem to use full storage device capacity #31

@mihai-chiorean

Description

@mihai-chiorean

Description

The current image does not automatically expand to use the full capacity of the storage device it's flashed to. We need the root filesystem to expand and utilize all available space on the SD card or storage device.

Current Behavior

  • Image uses only the defined partition size from the WIC file
  • Remaining space on the storage device is unused
  • Users cannot utilize the full capacity of their SD cards

Desired Behavior

  • On first boot, automatically expand the root partition to fill available space
  • Filesystem should be resized to match the expanded partition

Suggested Implementation

  1. Option A: First-boot systemd service

    • Create a systemd service that runs on first boot
    • Use parted or fdisk to expand the partition
    • Use resize2fs to expand the filesystem
    • Service disables itself after successful expansion
  2. Option B: Use grow-fs feature

    • Configure systemd-growfs or similar solution
    • Add growfs to IMAGE_FEATURES
  3. Option C: Initramfs expansion

    • Handle expansion in initramfs before root mount

Technical Requirements

  • Should expand the active root partition
  • Must be safe and not corrupt data
  • Should provide feedback in system logs

Acceptance Criteria

  • Root filesystem automatically expands on first boot
  • Expansion works with various SD card sizes or m2 / nvme / ssd
  • Process is logged for debugging
  • No manual intervention required
  • Compatible with Mender A/B partition scheme

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions