A use case of dcfldd

I need to create a heap of USB drives with the exact same content.
I found, that dcfldd will help me a lot during this.
I created one piece with the desired content, then imaged it to a file:
dd if=/dev/sdh of=op_pendrive.img bs=1M status=progress
(Pendrive was in /dev/sdh).
I have put together quickly a script, that writes out the image to 2 pendrives at once.
But before that, I added an udev rule, so that a newly attached USB drive will be writeable without being root.
echo 'KERNEL=="sd*", SUBSYSTEMS=="usb", MODE="0666"' | sudo tee /etc/udev/rules.d/99-usb-storage.rules
So I don’t have to mess with “sudo” enter password, etc.
The script I call with parameters: the image file, and the 2 devices, I need to flash to.
E.g.
pendrive pendrive.img /dev/sdh /dev/sdi
I do the writing to 2 devices at once, because I have 2 USB ports on the front, which I can use comfortably.
Writing the content takes a while, so when it finishes I want it to be well audible, so I don’t need to sit beside the computer and watch it continually…
Before starting, it displays me the USB drives curently attached, so I can doublecheck where the image goes…
And the script (there’s no error checking, just convenience and ‘right, get to it’):

#! /bin/bash
df -Th | grep media
echo "$1 lesz írva ide: $2 és $3"
drivea=$2
driveb=$3
echo "Mehet?"
select yn in "Igen" "Nem"; do
case $yn in
   Igen )
	part1="${drivea}1"
	part2="${driveb}1"
	umount $part1
	umount $part2
	read -p "Még leállhat (ctrl-c), vagy mehetünk tovább... " -n1 -s
        echo "hajrá..."
        dcfldd if=$1 of=$2 of=$3 bs=1M status=on
        mplayer ~/Zenék/cimhez.wav
        exit
 	;;
  Nem )
	exit
	;;
esac
done

So dclfldd is great to clone to multiple drives at once… :smiley:

4 Likes

Wow, the last commit to the dcfldd project seems very recent, in terms of Linux time feel. :wink:

2 Likes

I don’t care even if its from the stone age. As long as it does the job excellent, and dcfldd unquestionably does… It is excellent! :smiley:

1 Like