Jan
21
2013
report dd status via kill

I am doing a rather large dd and its being a long time (over 30minutes) so far.

How can i find the status of dd ?

at hsgr someone is telling me: KILL KILL KILL

searching through dd manual page, i came up with:

Sending a USR1 signal to a running ‘dd’ process makes it print I/O statistics to standard error and then resume copying.

eg.

# kill -USR1 5579

on the dd terminal:

7626752+0 records in
7626752+0 records out
3904897024 bytes (3,9 GB) copied, 2442,27 s, 1,6 MB/s

for more info

man 7 signal
Tag(s): dd, kill
Aug
28
2012
Shrink your backup images

I am using LVM for storage to virtual machines.
One simply way to make backups (even if the machine is online) is through dd.

(but if you are using a database, online is out of question).

dd will backup the entire partition to a raw image.

Lets make an example:

# time dd if=/dev/vg01/winxp of=winxp.img bs=1024 
5242880+0 records in
5242880+0 records out
5368709120 bytes (5,4 GB) copied, 111,164 s, 48,3 MB/s

So we have a 5Gb backup raw image with sparse files into.
If only there was a way to remove sparse files to reduce the size!

Wait … it does exist: virt-sparsify

# virt-sparsify winxp.img winxp.img.spars
...
Sparsify operation completed with no errors.  Before deleting the old 
disk, carefully check that the target disk boots and works correctly.

# ls -ltr

-rw-r--r-- 1 root root 5368709120 Αύγ  28 11:55 winxp.img
-rw-r--r-- 1 root root 5368709120 Αύγ  28 11:59 winxp.img.spars

# du -h * 
5,1G	winxp.img
3,1G	winxp.img.spars

2gb sparse files have just removed !

Now you can compress the backup image to reduce the size even more:

# du -h winxp.img*

5,1G	winxp.img
3,1G	winxp.img.spars
1,4G	winxp.img.spars.lrz

We can now remove winxp.img & winxp.img.spars (8.2Gb) from our backup storage.