Last active
July 14, 2022 13:37
-
-
Save tenox7/96139e6c65e219e9ccb91d74275356ce to your computer and use it in GitHub Desktop.
fast macOS dd with progress bar, umount and erase dst disk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
src="${1?:No src/file specified}" | |
dst="${2?:No dst/disk specified}" | |
bs=1m | |
diskutil unmountDisk "${dst}" | |
diskutil zeroDisk short "${dst}" | |
if [[ "${src}" == *.lz ]] | |
then | |
lzip -dcvv "${src}" | dd of="${dst}" bs=$bs | |
elif [[ "${src}" == *.xz ]] | |
then | |
xz -dcvv "${src}" | dd of="${dst}" bs=$bs | |
else | |
dd if="${src}" bs=1m | pv "${src}" | dd of="${dst}" bs=$bs | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
use
/dev/rdskXXX
for destination