containerd / accelerated-container-image

A production-ready remote container image format (overlaybd) and snapshotter based on block-device.
Apache License 2.0
411 stars 76 forks source link

Image conversion fails on large image (48GB) #223

Closed tianouya-db closed 10 months ago

tianouya-db commented 1 year ago

What happened in your environment?

While converting a large image,

/opt/overlaybd/snapshotter/ctr obdconv large-image:0.1 large-image:0.1_obd

It consistently fails with an error no space left on device:

filesystem type: ext4
ctr: failed to apply layer in snapshot overlaybd-conv-198042690-5dtr: mount callback failed on /tmp/containerd-mount3021852082: write /tmp/containerd-mount3021852082/root/.cache/pip/http/8/7/4/7/1/87471198cb7fc632cfcd6811310d8da1de7f956b049844a9c0ba89ec: no space left on device

Running fdisk -l gets:

Disk /dev/sda: 64 GiB, 68719476736 bytes, 134217728 sectors
Disk model: TCMU device
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

My root disk has enough space (2TB), but the TCMU virtual device has a size of 64GB which might be limiting the conversion.

What did you expect to happen?

The conversion should succeed for large images.

How can we reproduce it?

Convert an image with large size, 48G+.

What is the version of your Accelerated Container Image?

0.6.7

What is your OS environment?

Ubuntu 20.04

Are you willing to submit PRs to fix it?

yuchen0cc commented 1 year ago

https://github.com/containerd/accelerated-container-image/blob/ddba7a33cbd9198cfe7004b9a8c13a7f85106479/pkg/snapshot/storage.go#L654C1-L661C2

func (o *snapshotter) prepareWritableOverlaybd(ctx context.Context, snID string) error {
    // TODO(fuweid): 256GB can be configurable?
    args := []string{"64"}
    if o.writableLayerType == "sparse" {
        args = append(args, "-s")
    }
    return utils.Create(ctx, o.blockPath(snID), args...)
}

"64" (64GB) is default size, you can modify it for POC.

yuchen0cc commented 10 months ago

An option --vsize is added to /opt/overlaybd/snapshotter/ctr obdconv to custamize overlaybd virtual block device size.