Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create sparse images #722

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ygerlach
Copy link

External Contributor Checklist

🚨 Please review the guidelines for contributing to this repository.

  • Make sure that all commits follow the conventional commit specification for the Mender project.

  • Make sure that all commits are signed with git --signoff. Also note that the signoff author must match the author of the commit.

Description

Instead of allocating the whole image on the disk, only allocate the parts that actually contain data. This reduces the required disk space to store or create images. The image does appear to have the normal size but if inspected with du or ls -lsh the difference becomes apparent.

Example with the image i build:

$ ls -lsh
total 244G
234G -rw-r--r-- 1 root root 235G Nov 20 17:30 image-x86_64-mender_old.img
 11G -rw-r--r-- 2 root root 235G Nov 20 17:54 image-x86_64-mender_sparse.img

This is done by the conv=sparse flag of dd. Alternatively a file can made sparse with fallocate -d <file>. But this may only collapse a file, not reduce its footprint while it is created. This may also improve read and write performance of those files in the empty areas, but i did not observe a big speed-up during the image creation.

@mender-test-bot
Copy link
Contributor

Merging these commits will result in the following changelog entries:

Changelogs

mender-convert (sparsesImage)

New changes in mender-convert since master:

Features
  • create sparse images

Instead of allocating the whole image on the disk, only allocate the parts that actually contain data. This reduces the required disk space to store or create images.

Changelog: Title
Ticket: None
Signed-off-by: Yannis Gerlach <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants