Use truncate instead of dd

This commit is contained in:
Eric Helgeson 2021-05-13 12:20:36 -05:00
parent a2a323cdb8
commit c2c0d5cbf7
2 changed files with 2 additions and 2 deletions

View File

@ -221,7 +221,7 @@ function createDrive() {
if [ ! -f $drivePath ]; then
echo "Creating a ${driveSize}MB Drive"
dd if=/dev/zero of=$drivePath bs=1M count=$driveSize
truncate --size ${driveSize}m $drivePath
echo "Formatting drive with HFS"
formatDrive "$drivePath" "$driveName"

View File

@ -17,7 +17,7 @@ def create_new_image(file_name, type, size):
file_name = file_name + "." + type
return subprocess.run(
["dd", "if=/dev/zero", "of=" + base_dir + file_name, "bs=1M", "count=" + size],
["truncate", "--size", f"{size}m", f"{base_dir}{file_name}"],
capture_output=True,
)