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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ disk_get_part_nums() {
# $3 - size (in 512 blocks)
# $4 - path to output file
disk_extract_part() {
run_and_log_cmd "dd if=$1 of=$4 skip=${2}b bs=1M count=${3}b status=none iflag=count_bytes,skip_bytes"
run_and_log_cmd "dd if=$1 of=$4 skip=${2}b bs=1M count=${3}b status=none conv=sparse iflag=count_bytes,skip_bytes"
}

# Convert MiB to number of 512 sectors
Expand Down Expand Up @@ -98,7 +98,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=notrunc status=none"
run_and_log_cmd "dd if=${1} of=${2} seek=${3} bs=512 conv=notrunc,sparse status=none"
}

# Create file system image from directory content
Expand Down