Used truncate instead of dd to create wic image for the following reasons: - truncate syntax is much more clear - dd requires additional calculations of the image size in blocks - the way dd was used in the code is not entirely correct. It was still writing one block to the file, which made it not 100% sparse.
Signed-off-by: Ed Bartosh <[email protected]> --- scripts/lib/wic/utils/fs_related.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/scripts/lib/wic/utils/fs_related.py b/scripts/lib/wic/utils/fs_related.py index 2e74461..2658dcf 100644 --- a/scripts/lib/wic/utils/fs_related.py +++ b/scripts/lib/wic/utils/fs_related.py @@ -71,14 +71,8 @@ class DiskImage(Disk): def create(self): if self.device is not None: return - - blocks = self.size / 1024 - if self.size - blocks * 1024: - blocks += 1 - - # create disk image - dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=1" % \ - (self.image_file, blocks) - exec_cmd(dd_cmd) + # create sparse disk image + cmd = "truncate %s -s %s" % (self.image_file, self.size) + exec_cmd(cmd) self.device = self.image_file -- 2.1.4 -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
