now we will create a script file,which can restore the .rrd files in .rrd.xml files:

>vi /var/lib/cacti/rrd2xml
insert follows to the file:

                        #!/bin/bash
                        #dump rrd 2 xml
                        cactipath='/var/lib/cacti'
                        xmlpath='/var/lib/cacti/xml'
                        files=$(ls $cactipath | grep .rrd | cut -d "." -f 1 )
                        for i in $files; do
                            rrdtool dump "$cactipath/$i.rrd" > "$xmlpath/$i.rrd.xml"
                            echo "$i.rrd dumped to $xmlpath/$i.rrd.xml"
                        done

write and quit the file.

>cd /var/lib/cacti/
>chkmod +x rrd2xml
>./rrd2xml