From 7e366a5ed302f15ee376826e18ab4da50281e6f6 Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Fri, 8 Oct 2010 10:35:10 +0800 Subject: [PATCH] crosutils: refine image_to_usb progress output and performance Adding "-B 4m" to balance pipe (+10% speed on some SD) and -b to make progress more readable. Since the size report from pv (k=1024) and dd(k=1000) are different, we also disable dd's summary report to prevent confusion. BUG=none TEST=executed: ./image_to_usb.sh --from=... --to=/dev/sdX (ok) Change-Id: I184c4ce2d9a8274079ddb26f0420ccf8f2a674dd Review URL: http://codereview.chromium.org/3608013 --- image_to_usb.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/image_to_usb.sh b/image_to_usb.sh index 8248c393de..19eefb1f63 100755 --- a/image_to_usb.sh +++ b/image_to_usb.sh @@ -237,7 +237,10 @@ then if [ ${FLAGS_install} -ne ${FLAGS_TRUE} ]; then echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..." if type pv >/dev/null 2>&1; then - sudo pv -ptre "${SRC_IMAGE}" | sudo dd of="${FLAGS_to}" bs=4M oflag=sync + # pv displays file size in k=1024 while dd uses k=1000. + # To prevent confusion, we suppress the summary report from dd. + sudo pv -ptreb -B 4m "${SRC_IMAGE}" | + sudo dd of="${FLAGS_to}" bs=4M oflag=sync status=noxfer else sudo dd if="${SRC_IMAGE}" of="${FLAGS_to}" bs=4M oflag=sync fi