For making our system safe, I've configured Backup system.
What I did is that use two hard disk, 1 is internal and other is USB hard disk.
1. Mounting each HDD to our system.
Command is,
# mkdir /HDD2
# sudo mount /dev/sdb /HDD2
Making 2 Partitions
# sudo /sbin/fdisk /dev/sdc
Formatting HDD
# sudo mkfs.ext4 /dev/sdc1
# sudo mkfs.ext4 /dev/sdc2
# mkdir /HDD3
# sudo mount /dev/sdc1 /HDD3
after that, I add that in /etc/fatab to mount automatically.
2. Using 'rsync' to make same directory to '/var/www/moodle' and '/var/moodledata'.
Command is,
# rsync -av /var/www/moodle /HDD2/BackUP/backup_moodle
# rsync -av /var/moodledata/ /HDD2/BackUp/backup_moodledata
and using mysqldump to backup database
# sudo mysqldump -h localhost -u root --password=KUelearning -C -Q -e --create-options moodle > /HDD2/BackUp/moodle-database.sql
3. Adding above commands to crontab; scheduling