WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: DD with Progress Bar in terminal  (Read 500 times)

Offline hamak

  • WikiUser
  • *
  • Posts: 26
DD with Progress Bar in terminal
« on: January 10, 2019, 02:32:41 AM »
Is it possible to have dd with progress in CorePure64?
I have made two small scripts to write iso2usb and usb2iso but want to have a progress bar in terminal

I googled a little and there should be possible to use pv or status=progress

Here is the scripts if i only had pv  ::)

Code: [Select]
echo "Usage:  ./iso2usb.sh [/location/ISOfilename]  [USBdrive]"
echo "Example: ./iso2usb  /mnt/sda1/MyFile.iso  sdc"
DrvSize=`du -k $1 | cut -f1`
sudo dd if=$1 of=/dev/$2 bs=64K
# sudo dd if=$1 | pv -s $DrvSize | of=/dev/$2 bs=64K

echo "Usage:  ./usb2iso.sh [USB] [/location/ISOfilename]"
echo "Example: ./usb2iso  sdc  /mnt/sda1/MyFile.ISO"
DrvSize=`blockdev --getsize64 /dev/$1`
sudo dd if=/$1 of=$2 bs=64K
# sudo dd if=/$1 | pv -s $DrvSize | of=$2 bs=64K

or maybe it could be
sudo dd if=/$1 of=$2 bs=64K status=progress

Any tips on how to get this?

Offline polikuo

  • Sr. Member
  • ****
  • Posts: 366
Re: DD with Progress Bar in terminal
« Reply #1 on: January 10, 2019, 03:03:31 AM »
Pipe Viewer is a small program.
You can easily compile it from source.
IIRC, it does not require any dependencies.
Simply install "compiletc.tcz" to build from source, then pack it up with "squashfs-tools.tcz".
FYI, Tiny Core Wiki

sudo dd if=/$1 | pv -s $DrvSize | of=$2 bs=64K
This command is invalid
It should be:
  dd if=$file | pv -s $DrvSize | sudo dd of=$target bs=64K
  pv $file | sudo dd of=$target bs=64K

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 2841
Re: DD with Progress Bar in terminal
« Reply #2 on: January 10, 2019, 10:01:42 AM »
Hi guys. 
Throughout my time with Linux and all the hundreds of tinycore USB thumb drives I've made, I have to say I've never used DD as it has never been proven to be MLC Flash friendly which includes USB thumb drives, SSD's and SD cards.  By "friendly" I'm referring to negatively impacting performance by incorrect usage of erase, partition offset and handling of empty space.
Maybe it's not justified, I know DD has been around for a long time from the days of archaic HDD's.  Frankly I'm not sure if it has ever seen a Nand friendly update.
In addition, While I've never used DD I constantly read of DD having the potential to terminate the process without flushing the write cache which is somewhat disconcerting..  Maybe someone can clarify?

I prefer to "erase" the drive safely if previously used (writing 1111's to the drive is safe, not programming each page with zero's as is common practice with HDD's),  partition and format as required.   Mount both ISO & USB partitions, then use "rsync" or plain old simple and reliable "cp".  Lastly, install the desired boot-loader.   This method has never failed.

This caught my eye:
Code: [Select]
sudo dd if=/$1 | pv -s $DrvSize | of=$2 bs=64K"bs=64K" This is purely a read/write performance option right, so why enforce a limit of only 64K?  Is there a PC today that can't handle 4M for example?
The most performance limiting sizes here are available RAM and possible Flash defaults which are:  1. page size = 4K and 2. Erase Block size = 128K
64K matches none of those..   Maybe I missed something, but am just wondering what are the benefits and where this came from?

This script seems really interesting.  Am still reviewing the script to see how and if it needs adapting for TC use

« Last Edit: January 10, 2019, 10:26:06 AM by coreplayer2 »

Offline hamak

  • WikiUser
  • *
  • Posts: 26
Re: DD with Progress Bar in terminal
« Reply #3 on: January 10, 2019, 01:51:51 PM »
Thank you very much both of you polikuo and coreplayer2 :)
Nice short code-line polikuo 8)  and I will try to compile pipe viewer as you said thank you

I will also test the bootiso as coreplayer2 talked about in a very informing post, Thank you :)

As I said before I am new to this but I am learning and this forum is the best ever.

Thanks to everyone :)