User avatar
Botspot
Posts: 1774
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Fastest way to get an image from the Internet to your SD card? (benchmarks inside)

Mon Apr 27, 2020 11:10 pm

If you have a Raspberry Pi 4, and you want to download and flash Raspbian Buster Full to an external SD card, what is the fastest way?
I've done some benchmarks with various software to see which one is the fastest. My Pi4 is overclocked to 2Ghz, and has a solid 200Mbps internet connection. The SD card used in the testing is a genuine 32GB SanDisk Extreme.
Benchmarks below: (all measurements are in mm:ss format)
  • Etcher (armhf compiled binary thanks to futurejones):
    • 3:31 to download (using chromium)
    • 7:34 to flash
    • 6:42 to verify
    • Total time: 17:47 (everything added up, including verify time)
    • DL & Write time: 11:05 (not including verify time. This keeps the benchmarks fair)
    • DL & Write speed: 10.98 MB/s
      Formula = (7.3GB/(DL&W time))*16.667) MB/s
  • Official Raspberry Pi Imager (installed with sudo apt install pi-imager):
    • 11:06 to download and flash
    • 5:49 to verify
    • Total time: 16:55
    • DL & Write time: 11:06
    • DL & Write speed: 10.96 MB/s
  • Bzt's USB Image Writer:
    • 3:31 to download (using chromium)
    • 9:26 to flash (no verify)
    • 9:35 to flash, with verify enabled
    • Total time: 13:06
    • DL & Write time: 12:57
    • DL & Write speed: 9.40 MB/s
  • DD (terminal-based dd program - block-size set to 1M):
    • 3:31 to download (using chromium)
    • 6:50 to flash
    • DD cannot verify.
    • Total time: 10:21 (this value would be higher if there was a verify)
    • DL & Write time: 10:21
    • DL & Write speed: 11.76 MB/s
  • Pi Power Tools Flash (This uses a buffered bash pipe to download with wget, extract using unzip, and flash with dd, simultaneously):
    • 6:31 to download + flash + sync
    • PPT doesn't have a verify function yet.
    • Total time: 6:31 (this value would be higher if there was a verify)
    • DL & Write time: 6:31
    • DL & Write speed: 18.67 MB/s
So it looks like Pi Power Tools flasher leaves everybody else in the dust. Installation instructions here.
If your Pi is headless, or if you don't want to install PPT, you can use the same commands PPT uses to flash:

Code: Select all

sudo apt install buffer #this program helps optimize bash pipes and make them run at maximum possible speed
wget -qO- http://downloads.raspberrypi.org/raspbian_full_latest | buffer | busybox unzip - -p | dd ibs=10M obs=10M | dd bs=10M count=1 of=/dev/null #adds first 10 mb to cache, as well as all the binaries.
wget -qO- http://downloads.raspberrypi.org/raspbian_full_latest | buffer | busybox unzip - -p | buffer | sudo dd of=/dev/sdX obs=1M
sync
Have fun everyone! :D If there's any more benchmarks you think I should add, please let me know.
Edit: Added a benchmark for bzt's usb image writer
Edit 2: changed PPT to sync. Benchmark updated to reflect that.
Edit 3: Make benchmarks easier to read, and add DL & Write time parameter.
Edit 4: Properly rounded a couple of numbers I forgot to round
Edit 5: Improve title
Last edited by Botspot on Thu Apr 30, 2020 8:43 pm, edited 9 times in total.
Easily install apps on your Pi with Pi-Apps! Over 500k users.
Includes two Zoom desktop apps, 3 ways to run Minecraft, 10 web browsers, appearance themes, and 105 more.
More info: https://github.com/Botspot/pi-apps

DarkElvenAngel
Posts: 1909
Joined: Tue Mar 20, 2018 9:53 pm

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Tue Apr 28, 2020 1:24 am

You should try out bzt's USB Imager a fellow forum member's project.

Here's the GitLab Repo

User avatar
Botspot
Posts: 1774
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Tue Apr 28, 2020 2:15 am

DarkElvenAngel wrote:
Tue Apr 28, 2020 1:24 am
You should try out bzt's USB Imager
Thanks. I've added the benckmark.
Easily install apps on your Pi with Pi-Apps! Over 500k users.
Includes two Zoom desktop apps, 3 ways to run Minecraft, 10 web browsers, appearance themes, and 105 more.
More info: https://github.com/Botspot/pi-apps

User avatar
B.Goode
Posts: 12973
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Tue Apr 28, 2020 6:49 am

If the tool you are promoting cannot perform verification of the flashed SD card, perhaps a fairer benchmark would be to disable verification in those tools that can...

bzt
Posts: 635
Joined: Sat Oct 14, 2017 9:57 pm

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Tue Apr 28, 2020 9:41 am

Hi,

Also you should add the time of syncing (by running "sync" in a terminal when the tool finished). Without sync, you only measure the time required to update the disk cache in memory. For my USBImager this is not needed because it gives you guarantee that the data is physically written on the SD card (other tools do not give this guarantee).

With dd, you can use "dd conv=dsync" or "time bash -c 'dd && sync'".

Just a sidenote, your benchmark must be incorrect, because Pi Power Tools Flash seemingly runs faster than dd alone, however it includes dd, so this simply can't be. If flashing with dd requires 6:50, then it is not possible to download, uncompress AND flash with dd in 6:27.

There's a problem with your calculation as well: if one tool finished in 16:55 and that means 10.95 MB/s, then the total time of 13:06 can't be less, 9.38 MB/s. If a tool finishes sooner, MB/s should be higher than 10.95. Oh, and 3:31 + 9:26 != 13:06...
Botspot wrote:So it looks like Pi Power Tools flasher leaves everybody else in the dust.
Looks like, but please correct your benchmarks so that we can see the true results. Thanks! Until then we can only say you forged the measurements in favour of your own tool, which is not cool.

Cheers,
bzt

Paul Hutch
Posts: 601
Joined: Fri Aug 25, 2017 2:58 pm
Location: Blackstone River Valley, MA, USA
Contact: Website

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Tue Apr 28, 2020 1:49 pm

bzt wrote:
Tue Apr 28, 2020 9:41 am
Just a sidenote, your benchmark must be incorrect, because Pi Power Tools Flash seemingly runs faster than dd alone, however it includes dd, so this simply can't be. If flashing with dd requires 6:50, then it is not possible to download, uncompress AND flash with dd in 6:27.
That stuck out like a sore thumb to me.

There are so many variables in this multifaceted process that any simple benchmarking is mostly irrelevant. One example, downloading from the internet often varies significantly from one download to the next.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 29603
Joined: Sat Jul 30, 2011 7:41 pm

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Tue Apr 28, 2020 1:56 pm

IIRC, RPI Imager downloads as it writes as well, so that doesn't explain why the numbers vary. I suspect 'sync'ing to storage is not being taken in to account correctly.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

User avatar
Botspot
Posts: 1774
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Tue Apr 28, 2020 2:00 pm

B.Goode wrote:
Tue Apr 28, 2020 6:49 am
If the tool you are promoting cannot perform verification of the flashed SD card, perhaps a fairer benchmark would be to disable verification in those tools that can...
I've tried to make this fair as possible, so I've included the times for each step in the process.
BTW the MB/s rating does not consider verification time (I left it out), and I consider that the fairest way to do it.
bzt wrote: Also you should add the time of syncing (by running "sync" in a terminal when the tool finished). Without sync, you only measure the time required to update the disk cache in memory.
Good idea. I was wondering why the sd card adapter would sometimes flash a few seconds after dd finished. I'll add that to the benchmarks soon.
bzt wrote: Just a sidenote, your benchmark must be incorrect, because Pi Power Tools Flash seemingly runs faster than dd alone, however it includes dd, so this simply can't be. If flashing with dd requires 6:50, then it is not possible to download, uncompress AND flash with dd in 6:27.
Not necessarily. Benchmarks don't lie.
When I coded PPT flasher, I tried over 50 variations of the flash code, and picked out the fastest one. There are several reasons why PPT flasher is consistently faster than a conventional dd one-liner:
  • Normal dd reads 1M of the input img, then writes 1M to the sd card. On the contrary, PPT runs entirely in memory, and can write to the sd card continuously, without having to read from the filesystem.
  • Normal dd is not buffered at all. PPT uses a buffer between every potential bottleneck.
  • PPT preloads 100M of the img & binaries, to have a "jump start" in the memory cache. (Yes this preload step counts towards the benchmark)
bzt wrote: There's a problem with your calculation as well: if one tool finished in 16:55 and that means 10.95 MB/s, then the total time of 13:06 can't be less, 9.38 MB/s. If a tool finishes sooner, MB/s should be higher than 10.95.
Looks like there's some confusion over my numbers. I'll try to explain:
  • MB/s does not consider verify time. This allows us to compare apples to apples.
  • Total time includes verify time.
bzt wrote: Oh, and 3:31 + 9:26 != 13:06...
On your imager, I did two flash tests, one without verify checked, and one with. The second one (9:35) counted towards total time, but the first one (9:26) counted towards MB/s.
Easily install apps on your Pi with Pi-Apps! Over 500k users.
Includes two Zoom desktop apps, 3 ways to run Minecraft, 10 web browsers, appearance themes, and 105 more.
More info: https://github.com/Botspot/pi-apps

HvdW
Posts: 186
Joined: Tue Jun 17, 2014 12:41 pm

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Tue Apr 28, 2020 2:59 pm

Hi @Botspot
Can you include rpi-clone as well in your speed test?
It's straightforward dd, mounting and unmounting is included in the process.
Advantage: all background work. Once set you need not take care anymore.
Who knows knows
Who doesn't doesn't

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 29603
Joined: Sat Jul 30, 2011 7:41 pm

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Tue Apr 28, 2020 3:12 pm

Botspot wrote:
Tue Apr 28, 2020 2:00 pm
Not necessarily. Benchmarks don't lie.
On the contrary, they lie all the time. You can 'game' all sorts of benchmarks.

With regard to this particular case. Something is off somewhere. You seem to have made a process that everyone else does in approximately the same time, and knock many percentage figures off it. All the stuff above, especially DD, has had a lot of work done it buy a lot of people over a lot of years. It seems odd you've been able to suddenly improve it.

Your points above having everything in memory makes no sense to me, probably my aging brain. You need to get the data off storage at some point, that's a fixed cost. Now you can do it in parallel with the write, but Linux should be buffering that for you so I would not expect huge improvements there. Almost everything in this process is IO bound, you are always waiting for something to complete, a read or a write. Reading is generally faster than writing (on SSD, SD cards etc), so you should be entirely write bound - that should be the limitation. The overall write speed of the SD card interface and the SD card itself should be a good indicator.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Applications Team.

User avatar
Botspot
Posts: 1774
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Tue Apr 28, 2020 5:29 pm

jamesh wrote:
Tue Apr 28, 2020 3:12 pm
Botspot wrote:
Tue Apr 28, 2020 2:00 pm
Benchmarks don't lie.
On the contrary, they lie all the time. You can 'game' all sorts of benchmarks.

All the stuff above, especially DD, has had a lot of work done it by a lot of people over a lot of years. It seems odd you've been able to suddenly improve it.

Your points above having everything in memory makes no sense to me, probably my aging brain. You need to get the data off storage at some point, that's a fixed cost.
Other flashers may have to read the img from local storage, but not mine. The whole flash command is one continuous pipe, and 100% in the RAM:

Code: Select all

wget -qO- http://downloads.raspberrypi.org/raspbian_full_latest | buffer | busybox unzip - -p | buffer | sudo dd of=/dev/sdX obs=1M
#     download the img and output it to the pipe              --> buffer -->    unzip it    --> buffer --> now write it to the sd card
That's why it's so fast.
Still don't take my word for it? Then I encourage you to try the commands yourself. (see top post)
Easily install apps on your Pi with Pi-Apps! Over 500k users.
Includes two Zoom desktop apps, 3 ways to run Minecraft, 10 web browsers, appearance themes, and 105 more.
More info: https://github.com/Botspot/pi-apps

bzt
Posts: 635
Joined: Sat Oct 14, 2017 9:57 pm

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Wed Apr 29, 2020 8:26 am

Hi,
Botspot wrote:Normal dd is not buffered at all.
Wrong. Normally dd does use buffering, using two independent buffers, actually. First, there's a buffer for reading (1Mb in your case), and then there's a kernel buffer when writing. You must use the "conv=dsync" or "conv=fdatasync" flag to avoid the kernel write buffer, and "bs=1" to avoid the read buffer. Read man page.
Botspot wrote:PPT preloads 100M of the img & binaries
Then you should use USBImager with 100M buffer too to make it a fair comparition. You also wrote that PPT reads the image 100% into RAM. Raspbian image is bigger than 100Mb, so which one is it?
Botspot wrote:Looks like there's some confusion over my numbers. I'll try to explain
Don't explain, do the math correctly. Let me help you:

If writing your image with 10.95 MB/s took 16:55 (= 1015 s), then you wrote 11114 M in total. If a tool writes that 11G in 13:06 (= 786 s), that's 14.13 MB/s. This is with verification. Without 12:57 (= 777 s), that's 14.30 MB/s, and not 9 dot something!
Botspot wrote:Total time includes verify time.
Not for your tool!
Botspot wrote:Other flashers may have to read the img from local storage, but not mine. The whole flash command is one continuous pipe, and 100% in the RAM
And where is the pipe buffer filled up from? FYI, pipe's buffer is usually 4k by default, and the image is bigger than the total amount of available RAM.
Botspot wrote:Then I encourage you to try the commands yourself.
I did. Writing uncompressed raw images with 1M buffer, dd with sync takes exactly the same time as USBImager. If you use strace on them, you can see that exactly the same syscalls are called, and exactly the same many times. PPT is just a wrapper around dd, so it can't be faster than that. There's nothing new under the Sun :-)
Botspot wrote:Still don't take my word for it?
Definitely no (don't take it personal). Your benchmark is seriously flawed, comparing different total times (some with verification and some without); you sometimes measure cached writes through buffers, sometimes unbuffered; you use different sized read buffers; and your math for speed is off.

Please correct these so that we can take your benchmark seriously.

Cheers,
bzt

pagenotfound
Posts: 127
Joined: Mon Mar 14, 2016 12:44 pm

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Wed Apr 29, 2020 12:09 pm

I suggest that you run these tests with standard clock speeds and also artificially reduce your download connection speed to something more representative of the average user.

In a very narrow sense benchmarks don't lie but they are often skewed by factors like the above and can be difficult to translate to the real world. So jamesh definitely has a point.

Paul Hutch
Posts: 601
Joined: Fri Aug 25, 2017 2:58 pm
Location: Blackstone River Valley, MA, USA
Contact: Website

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Wed Apr 29, 2020 12:34 pm

Paul Hutch wrote:
Tue Apr 28, 2020 1:49 pm
There are so many variables in this multifaceted process that any simple benchmarking is mostly irrelevant. One example, downloading from the internet often varies significantly from one download to the next.
jamesh wrote:
Tue Apr 28, 2020 1:56 pm
IIRC, RPI Imager downloads as it writes as well, so that doesn't explain why the numbers vary. I suspect 'sync'ing to storage is not being taken in to account correctly.
I think you missed my point. The point I was trying to make is that the speed at which a file downloads from the internet is not a constant, and the variation is often not the fault of the program doing the download.

Therefore including it in the benchmark makes the benchmark give variable results. Now if dozens of runs where done in a rotating order of programs then it would be better. However since the longest part of the process is the actual writing to the uSd card using a locally available disk image for the write will yield a better indication of which program is fastest.

User avatar
Botspot
Posts: 1774
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Wed Apr 29, 2020 1:37 pm

bzt wrote:
Wed Apr 29, 2020 8:26 am
Don't explain, do the math correctly. Let me help you:
If writing your image with 10.95 MB/s took 16:55 (= 1015 s), then you wrote 11114 M in total. If a tool writes that 11G in 13:06 (= 786 s), that's 14.13 MB/s. This is with verification. Without 12:57 (= 777 s), that's 14.30 MB/s, and not 9 dot something!
Wow, there's still confusion! :cry:
"Total time" = DL time + flash time + verify time (if applicable) <-- Since not all tools verify, don't use this to compare them!
"DL & Write speed" = DL time + flash time. Does not include verify time! <-- This ignores verify time. Use this one to compare apples to apples.
Therefore:
You cannot derive DL & Write speed from Total time.
Instead, add up DL time + flash time, and use that to verify my math is correct.
bzt wrote:
Wed Apr 29, 2020 8:26 am
Botspot wrote:PPT preloads 100M of the img & binaries
Then you should use USBImager with 100M buffer too to make it a fair comparition. You also wrote that PPT reads the image 100% into RAM. Raspbian image is bigger than 100Mb, so which one is it?
Botspot wrote:Other flashers may have to read the img from local storage, but not mine. The whole flash command is one continuous pipe, and 100% in the RAM
And where is the pipe buffer filled up from? FYI, pipe's buffer is usually 4k by default, and the image is bigger than the total amount of available RAM.
:shock: Have you seen my flash command? Here it is:

Code: Select all

sudo apt install buffer #this program helps optimize bash pipes and make them run at maximum possible speed
wget -qO- http://downloads.raspberrypi.org/raspbian_full_latest | buffer | busybox unzip - -p | dd ibs=10M obs=10M | dd bs=10M count=1 of=/dev/null #adds first 10 mb to cache, as well as all the binaries.
wget -qO- http://downloads.raspberrypi.org/raspbian_full_latest | buffer | busybox unzip - -p | buffer | sudo dd of=/dev/sdX obs=1M
sync
Line three is the actual flash command. Please take a look at it.
The pipe works like this:
  • wget downloads and passes it to the pipe
  • The data passes through a buffer to maximize speed. (skipping this step increases the flash time by ~2 min)
  • Decompress the zip file using busybox unzip. (normal unzip doesn't recognize local file headers and so won't work)
  • Buffer the byte stream again to maximize speed. (skipping this step increases the flash time by ~5 min)
  • Finally write it to the selected SD card with dd.
bzt wrote:
Wed Apr 29, 2020 8:26 am
Please correct these so that we can take your benchmark seriously.
I think I will make the benchmarks easier to understand, and provide the formula for how I get MB/s.
Easily install apps on your Pi with Pi-Apps! Over 500k users.
Includes two Zoom desktop apps, 3 ways to run Minecraft, 10 web browsers, appearance themes, and 105 more.
More info: https://github.com/Botspot/pi-apps

User avatar
scruss
Posts: 4362
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Wed Apr 29, 2020 2:00 pm

An image written without verification isn't an image worth using. Consider the amount of time you'd waste trying to boot a bad image. It far outstrips any download/write time.

Also, benchmarking on overclocked hardware is hard to reproduce. Run it from stock Raspbian for a fair comparison.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

emma1997
Posts: 1646
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Wed Apr 29, 2020 9:54 pm

I agree overclocking is not a good idea since vast majority of users don't and those that do may not be able to get to the same frequency.

Personally I rarely bother to verify except maybe the first time or two. Once things are running they tend to stay like that (for a while anyway). Time is of the essence in my case.

Currently my trick is to use the fastest SD (not A1) and only partition part of the card to speed backups and restores. Turns out creating the image is the main factor there so only saving used bytes, defragmenting, and generally shrinking are key. RonR's utility for saving and dd only for restore works best now. What used to take an hour or two (still does for some people I know) now only few minutes.

I guess we can't blame OP for trying to make his hard work look better even if he does stretch things a bit. Human nature. So apparently consensus is there is may be user advantages (safety, ergonomics, shrinking, etc) but little speed benefit beyond dd?

bzt
Posts: 635
Joined: Sat Oct 14, 2017 9:57 pm

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Wed Apr 29, 2020 10:02 pm

Botspot wrote:Edit 2: changed PPT to sync. Benchmark updated to reflect that.
You did not. Please don't lie and mislead others. PPT's dd command does not use sync.
Botspot wrote:
Wed Apr 29, 2020 1:37 pm
Instead, add up DL time + flash time, and use that to verify my math is correct.
No, it is not. You said the image was 7.3G, but:
7:34 at 10.98Mb/s = 4984.92 Mb
9:26 at 9.40 Mb/s = 5301.60 Mb
6:50 at 11.76 Mb/s = 4821.60 Mb

Either you're writing different images, or your Mb/s values are incorrect. I do hope I don't have to explain that
7.3G != 4.98G != 5.3G != 4.82G.
Botspot wrote:
Wed Apr 29, 2020 1:37 pm
Finally write it to the selected SD card with dd.
Your command writes to the kernel disk cache, and PPT does not write physically to the SD card. Have you read the man page I linked?

Cheers,
bzt

bzt
Posts: 635
Joined: Sat Oct 14, 2017 9:57 pm

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Wed Apr 29, 2020 10:22 pm

emma1997 wrote:
Wed Apr 29, 2020 9:54 pm
but little speed benefit beyond dd?
Considering that dd uses the minimal open+read/write+close system calls, I would argue that one simply can't write a faster implementation. Anybody claiming otherwise is a fraud, or maybe using a specialized I/O hardware for parallelization, unavailable for common folks.

The main difference in the benchmark is because of the different buffer sizes the OP used, and that he "forgot" to physically write to the card with his tool. Writing to RAM will always be faster than writing to any storage (at least until memristor gets manufactured in mass-production).

Cheers,
bzt

User avatar
Botspot
Posts: 1774
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Wed Apr 29, 2020 10:56 pm

bzt wrote:
Wed Apr 29, 2020 10:02 pm
Botspot wrote:Edit 2: changed PPT to sync. Benchmark updated to reflect that.
You did not. Please don't lie and mislead others. PPT's dd command does not use sync.
:o How closely did you look at PPT?
Please check line 523 of PPT's flash script. It's there, and github proves it.
bzt wrote:
Wed Apr 29, 2020 10:02 pm
Botspot wrote:
Wed Apr 29, 2020 1:37 pm
Instead, add up DL time + flash time, and use that to verify my math is correct.
No, it is not. You said the image was 7.3G, but:
7:34 at 10.98Mb/s = 4984.92 Mb
9:26 at 9.40 Mb/s = 5301.60 Mb
6:50 at 11.76 Mb/s = 4821.60 Mb

Either you're writing different images, or your Mb/s values are incorrect. I do hope I don't have to explain that
7.3G != 4.98G != 5.3G != 4.82G.
Again!?? :(
You're still looking at the wrong numbers.
All three of those numbers you have (7:34, 9:26, and 6:50) are the flash times only.
And what did I say the MB/s rating was? You even have it in your quote: DL time + flash time. (DL means download BTW)
To fix your numbers:
3:31 + 7:34 at 10.98MB/s = 7302 MB
3:31 + 9:26 at 9.40 MB/s = 7304 MB
3:31 + 6:50 at 11.76 MB/s = 7302 MB
See, it all adds up.

- Botspot
Easily install apps on your Pi with Pi-Apps! Over 500k users.
Includes two Zoom desktop apps, 3 ways to run Minecraft, 10 web browsers, appearance themes, and 105 more.
More info: https://github.com/Botspot/pi-apps

User avatar
Botspot
Posts: 1774
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Wed Apr 29, 2020 11:14 pm

emma1997 wrote:
Wed Apr 29, 2020 9:54 pm
I agree overclocking is not a good idea since vast majority of users don't and those that do may not be able to get to the same frequency.
When I get a chance, I plan on redoing all the benchmarks on a totally fresh Buster install and see if the results are vastly different. I highly doubt it though, since IO has more worrisome bottlenecks than CPU speed. (and since all the test subjects were given the same advantage)
emma1997 wrote:
Wed Apr 29, 2020 9:54 pm
I guess we can't blame OP for trying to make his hard work look better even if he does stretch things a bit. Human nature.
Honestly, I didn't try to stretch anything. Though in hindsight, I wish I had improved the layout of the benchmarks sooner rather than later. Probably would have vastly reduced the amount of confusion over the numbers.
emma1997 wrote:
Wed Apr 29, 2020 9:54 pm
So apparently consensus is there is may be user advantages (safety, ergonomics, shrinking, etc) but little speed benefit beyond dd?
Look at the benchmark: DD's total time took nearly twice as long as PPT.
How is that possible? With PPT, all the steps are mashed into one. With dd you have to:
  • download the .zip
  • extract it to .img <--speaking of extraction, I can't believe I forgot to include it in the dd, bzt, and Etcher benchmarks! :roll:
  • flash it
Meanwhile PPT cleverly does all three at once (faster), without ever saving the .img to the disk (probably why it's faster than RPi Imager).

I hope that makes sense.
And, you're welcome to do your own benchmarks (on your internet speed, your Pi, your setup), and report back which one is faster for you. :)
Easily install apps on your Pi with Pi-Apps! Over 500k users.
Includes two Zoom desktop apps, 3 ways to run Minecraft, 10 web browsers, appearance themes, and 105 more.
More info: https://github.com/Botspot/pi-apps

emma1997
Posts: 1646
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Wed Apr 29, 2020 11:55 pm

My own results might not be that useful here because AFAIK I'm the only one who only uses part of the card. As mentioned it only takes me 2-3min what many of my buddies take over an hour or two. Necessary because I usually backup at least daily and with new versions make a few copies to have on hand for diagnostics.

One thing I need is a way to test new cards under Linux so, now that I think about it, verify probably does that. It would be nice to see speed displayed too like many of the PC utilities.

BTW I think it was gzip that did download, unzip, flash all at the same time. So IMO those additional steps are not so important. I'm more interested in actual time to flash a card.

In any case thanks for the data. I've been following your project from the start and found your tests here very interesting. As usual, like with most every thread on this forum, learned more Ras-magic tricks. Looking forward to the additional testing.

User avatar
Botspot
Posts: 1774
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Thu Apr 30, 2020 12:12 am

HvdW wrote:
Tue Apr 28, 2020 2:59 pm
Hi @Botspot
Can you include rpi-clone as well in your speed test?
It's straightforward dd, mounting and unmounting is included in the process.
Advantage: all background work. Once set you need not take care anymore.
I have never used rpi-clone, but isn't it meant to work like SD Card Copier? (copy your Pi's running SD card onto a backup) I briefly looked over the command line flags, and didn't see anything that would specify an input image file.
Easily install apps on your Pi with Pi-Apps! Over 500k users.
Includes two Zoom desktop apps, 3 ways to run Minecraft, 10 web browsers, appearance themes, and 105 more.
More info: https://github.com/Botspot/pi-apps

User avatar
jahboater
Posts: 7371
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Thu Apr 30, 2020 1:46 am

bzt wrote:
Wed Apr 29, 2020 10:22 pm
emma1997 wrote:
Wed Apr 29, 2020 9:54 pm
but little speed benefit beyond dd?
Considering that dd uses the minimal open+read/write+close system calls, I would argue that one simply can't write a faster implementation.
The humble "cp" command uses:

posix_fadvise( fd, 0, 0, POSIX_FADV_SEQUENTIAL )

to increase the prefetch. dd does not. Not sure how much benefit that gives.

bzt
Posts: 635
Joined: Sat Oct 14, 2017 9:57 pm

Re: What's the fastest way to flash a SD card? (benchmarks inside)

Thu Apr 30, 2020 8:42 am

Botspot wrote:
Wed Apr 29, 2020 10:56 pm
Please check line 523 of PPT's flash script. It's there, and github proves it.
There's no "conv=dsync" nor "conv=fdatasync" in line 440, and you call "sync" after your progress bar finished, which means you're only measuring the cache write time! Not to mention that users seeing PPT reporting 100% they think it is safe to remove the card when in reality kernel is still busy flushing the actual data to the card.

You said PPT took 6:27, and now you're suggesting with sync that's 6:31? That's just not possible, specially when your other results imply it takes at least 3 additional minutes on your hardware (~6:30 to write to cache, and ~10 min to write to the SD card directly). Your numbers.
Botspot wrote:And what did I say the MB/s rating was? You even have it in your quote: DL time + flash time. (DL means download BTW)
Doesn't matter, because you calculated with a constant time. But obviously it wasn't, so your benchmark is distorted by your network load, the current network traffic and not to mention the server's actual load.

And if you haven't downloaded the image for each measurement, then why did you add DL time in the first place? If you have a1/b1 and a2/b2 then adding a constant like (a1+c)/b1 and (a2+c)/b2 the results will be distorted, that's elementary math. No offense, but children in my country learns about this at the age of 7.
Botspot wrote:Formula = (7.3GB/(DL&W time))*16.667) MB/s
Why did you had to add a 16.667 multiplier to your formula for Etcher, have you ever wondered? There's no such multiplier in calculating Mb/s.

And repeat all tests at least 3 times (but more the better), and give us the average, because I'm pretty sure you haven't considered when was the image file in the kernel cache already and which tool had to actually read it into memory from disk. Either always run "buffer" before each test (to make sure image is in the kernel cache), or always reboot before each test (to make sure the kernel cache is empty).

Please correct your benchmark so that we can take you seriously. There's absolutely no point in comparing cache write time to writing data physically. I'm going to type slowly, so that you can understand: use the same configuration for each tool. Use same buffer size. Either always use a read cache, or never use a read cache, but do not mix. For writing the SD card, never use any write cache, because we're not interested in memory speed!

Cheers,
bzt

Return to “General discussion”