Exporting split images


#1

Hey,

I would like to export an container to a split image, however I seem to only be able to create a unified tarball. Is there a way to export to a split image or convert the unified tarball to a split image?

According to the “lxc image” description I can simply set target to a directory and it will work… however this didn’t work for me:
" The target MUST be a directory when exporting a split image. If the target is a directory, the image’s name (each part’s name for split images) as found in the database will be used for the exported image."

Thanks in advance!


(Stéphane Graber) #2

There isn’t. Publishing a container always results in a unified image.

It should be possible for us to add code in the publishing code to generate a split image instead, you could file such a feature request at https://github.com/lxc/lxd/issues

Alternatively, you can split the image yourself by making one tarball containing all toplevel files from the unified image with the exception of the rootfs directory and another tarball containing the content of the rootfs directory.

We usually consider unified images to be easier to deal with by our users as it’s just a single tarball and the relationship between the image fingerprint and the tarball is obvious (it’s its hash), whereas split images has you deal with two tarballs and the fingerprint is the hash of the concatenation of the two (meta first).

The comment you saw in the help is about exporting an existing split image in LXD, such as one that’s downloaded by LXD from an image server that uses them. “lxc image export” doesn’t actually create any image, that’s what “lxc publish” does, “lxc image export” just downloads the existing image tarball(s) from the server. If it’s a split image, you get two files (and should therefore point the tool to a directory), if it’a unified image, you get a single tarball.