WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline hamak

  • Newbie
  • *
  • Posts: 26
DD with Progress Bar in terminal
« on: January 10, 2019, 05: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]
#!/bin/bash
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

  • Hero Member
  • *****
  • Posts: 714
Re: DD with Progress Bar in terminal
« Reply #1 on: January 10, 2019, 06: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

P.S.
Quote
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
or:
  pv $file | sudo dd of=$target bs=64K

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: DD with Progress Bar in terminal
« Reply #2 on: January 10, 2019, 01:01:42 PM »
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
https://github.com/jsamr/bootiso

:)
 
« Last Edit: January 10, 2019, 01:26:06 PM by coreplayer2 »

Offline hamak

  • Newbie
  • *
  • Posts: 26
Re: DD with Progress Bar in terminal
« Reply #3 on: January 10, 2019, 04: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 :)