It's for a bash script. Basically, I want to format, or erase a USB (or SD) storage device; with a single command line.
I was going to use
fdisk, but it seems to require user interaction where I want automation.
So then I decided to try zeroing it out with:
dd if=/dev/zero of=/dev/<target disk>;
but it only seems to zero 2.0 GB of vacant, or unused disk space.
root@linux:~# dd if=/dev/zero of=/dev/mmcblk0 dd: writing to '/dev/mmcblk0': No space left on device 3842249+0 records in 3842249+0 records out 1967230976 bytes (2.0 GB, 1.8 GiB) copied, 2.9054 s, 677 MB/s
Ideally, I'm talking about re-formatting a removable storage device, and prepping it to be imaged with an
.iso image file (via
Re-formatting won't always be required, but it also erases data; and clearing the device of any stored data probably ought to be the default behaviour / standard procedure, for this kind of thing anyway.