Because of buffering and usually two hard drives involved, the speed of copying onto a hard drive is not straightforward to obtain.
Here’s how it can be measured for the easiest task - sustained writing.
Select a large file, say, 6 GB. If you do not have one, create with cat. The files involved shall not be effectively zippable, since the hard drive will compress the data before writing, and you will not get the “true” writing speed. While one may deal with easy-to-zip files, most of large files in practice are unzippable (meaning zipping them does not decrease the size noticeably), and it is more informative to measure writing speed for those files.
So, start with unzippable files a, b, c, d, my*.dat, or use /dev/urandom:
dd if=/dev/urandom of=./ra.dat bs=1M count=500
cat a b c d > e
cat ra.dat e my.dat my2.dat ..... > f
zip -r g.zip f
Achieve size of g.zip about 80% or your RAM. Let us say you have 8 GB of RAM, so let g.zip be 6 GB.
Next step is to load the file into RAM to exclude the source drive from affecting speed measurement.
Create a RAM partition:
mount -t tmpfs none /mnt -o size=6.5g
Copy the file into /mnt:
cp g.zip /mnt/
Now we are ready to measure the writing speed. To the time the cp takes, we must add file’s buffer flushing time, because it is again part of data moving operation. We start with a sync to flush all other buffers.
sync
time cp /mnt/g.zip /external/; time sync
Add up the two times to get the copying time.
When finished, don’t forget to unmount the /mnt to free the RAM.
It is much more difficult to do the measurement for smaller-size files. Better use a specialized application. The problem with application is, one doesn’t generally know how it works.