Browse Source

Don't truncate output diskimage while writing partitions.

With GPT there should be a backup partition table at the end of the disk. Before this change, mender-convert-package creates the output image file, writes the partition table, and when it writes the first partition data the file is truncated and the backup partition table is gone.

This change should not cause any worse performance, it leaves the backup partition table when using GPT partition scheme, and makes troubleshooting easier when looking at the partition table of the output diskimage.

Also worth noting, if the output diskimage is written to a disk that is larger than the diskimage, the backup partition table will end up in the wrong place. This can be fixed by running 'sgdisk -e <device>'.  The device will still boot without the backup partition table, but it would be good to either document this or make it automatic as part of any "first boot" disk/partition operations.

Changelog: Title

Signed-off-by: Nate Baker <bakern@gmail.com>
2.1.x
Nate Baker 5 years ago
parent
commit
3374f93b1e
  1. 2
      modules/disk.sh

2
modules/disk.sh

@ -96,7 +96,7 @@ disk_align_sectors() {
# $2 - destination file
# $3 - offset in number of 512 sectors
disk_write_at_offset() {
run_and_log_cmd "dd if=${1} of=${2} seek=${3} conv=sparse status=none"
run_and_log_cmd "dd if=${1} of=${2} seek=${3} conv=sparse,notrunc status=none"
}
# Create file system image from directory content

Loading…
Cancel
Save