carlopmart wrote:
Hi all,
I need to build a NFS CentOS 5.1 based server with LVM and snaphosts
for disaster recovering to serve storage to three ESX servers for a
development dept. I have 500 GB for storage. Data that I need to store
on this server is 150 GB and can grow to 210 GB to the end of year ...
My questions are:
- Is it possible to do some type of scripting to do data snapshots
every day and then copy to a remote server?? Some example, please??
Yes of course. I would suggest to use rsync for that, see the example below.
I have experimented in the past with multiple snapshots a day over a
week for users home space. The snapshots gave users a way to quickly
retrieve lost data. Drawback is that snapshots tend to slow down the
file server (it freezes temporarily to update the snaphot). A temporary
snapshot during backup works OK.
- How can I restore snapshot data on the production server if I need
to recover it??
Most easy way would be to make a snapshot and make this snapshot the
active disk. If you need to revert, just remove the snapshot and create
a new one from the original unmodified data. But since you want to use
NFS, you will have to reboot to free up the snapshot which is not so
nice. The other way around is also possible. Just rsync the source NFS
disk from the snapshot.
Again I would only make a snapshot temporarily and use it to make a copy
(or sync) to a second file system. This second file system can than be
setup with multiple snapshots over time. This prevents the slowdown of
the "main" file server. If you need to revert you can use rsync again.
(rsync works incrementally so it safes a lot of time if most data is
still the same)
Example script to run with crontab to synchronize multiple volumes to a
backup server:
date +"$0 started: %x %T"
PATH=$PATH:/usr/sbin
volumes="vola volb volc vold"
for i in $volumes
do
# Create a new snapshot
# Maximum snapshot size 7G
DATE=$(date +%a_%y%m%d_%H%M)
lvcreate --size 10G -n ${i}_${DATE} --permission r --snapshot
/dev/VolGroup00/$i
# Mount the snapshot
mkdir -p /snapshot/${DATE}/$i
mount -o ro /dev/VolGroup00/${i}_${DATE} /snapshot/${DATE}/$i
rsync -aq --delete /snapshot/${DATE}/$i/ remote_host:/mnt/$i/
umount /snapshot/${DATE}/$i
rmdir /snapshot/${DATE}/$i
rmdir /snapshot/${DATE}
lvremove -f /dev/VolGroup00/${i}_${DATE}
done
date +"$0 finished: %x %T"
You could create daily snapshots on the remote server as well. I use
(incremental) dump and restore for that.
Cheers,
Theo
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos