Tuesday, July 11, 2017

DD BACKUP EXAMPLE

I always use bs=512 because the hardware abstraction layer uses this block size. You can, of course, use the physical block size. Backing up a 64 GB SanDisk Ultra card over USB 3.0 still takes a considerable amount of time. If staring at a blank line that looks hung gives you rapid onset Tourette's syndrome like me, there's a trick buried in dd's man page that helps: send signal USR1 to the running process and it'll output its status. The rest of the info you need is in the man pages of top and kill though; I'll save you the trouble of all that scrolling...

If you popped the card in a laptop with sda hard drive then it'll most likely be sdb. Double check and make sure it wasn't automounted -- umount /dev/sdb1 and sdb2 if needed. Then change to your backup dir and:

sudo dd bs=512 if=/dev/sdb of=pi2_2017-07-11.img

Now open a SECOND TERMINAL window and run top. Hit the q key when dd shows up. First column is the process number:

 PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1840 root 20 0 7332 764 696 D 52.9 0.0 3:10.28 dd
1772 root 20 0 0 0 0 D 5.9 0.0 0:08.24 usb-storage


You can now send the dd process the USR1 signal with the kill command. Don't worry, you won't actually kill anything.

sudo kill -s USR1 1840


On the FIRST TERMINAL window you'll see dd output something like:

68451041+0 records in
68451040+0 records out
35046932480 bytes (35 GB, 33 GiB) copied, 479.181 s, 73.1 MB/s


Plenty of time to go get another cup of coffee.

No comments:

Post a Comment