Shadow Copies with Snapshots

From SambaWiki
Revision as of 08:14, 8 January 2007 by Cs (talk | contribs)

The base Samba-Configuration is quiet simple, therefore you can easily follow the instructions of the Official HowTo. The tricky part is the management of the snapshots.

But before you read on, a little warning:
Some people have the idea that the could have snapshots for the last 30 days and four different volumes and maybe twice a day, all in all 240 snapshots. Thats not possible - you shouldn't have more than 15 snapshots at a time (and thats quiet a lot, actually I think there is a bug in lvm2 reproted and numbers above 16 snapshots may mess up your volumes).
You have to check the changerate of your data before you plan your snapshots, otherwise your volumegroups may be quickly out of space. Also keep in mind, that your disks have more work to do the more snapshots they have to care about.
The environments, I wrote this script for, have one volume, size about 20GB and a changerate of 100MB per day and maybe 500MB in two weeks.

Now to the subject:
After planing how many snapshots of which volumes you need, all you have to do is to place this Shadow Copies with Snapshots Script in a usefull place (e.g. /usr/local/sbin/), place some entrys in your crontab and create a configuration file (if you use an other place than /etc/samba/smbsnap.conf you have to cange the path in the script).
Before this script is ready to work, the kernel-module dm_snapshot has to be loaded and if your volumes are loades at boot time (i.e. /etc/fstab), this has to be done in your initrd.
Read the head of the script for more detailed documentation and a configuration example.