I am not sure if this maybe is what you are looking for but this may be the easiest route..
Setup a 2nd Server for Archiving, a clone of the 1st server, so Apache, MySQL.
After you get the second server running you can use a couple of commands to stream the data "moodledata" "database" from the main server for archiving.
For purposes of this write-up let's say you send your MySQL Backups to /opt/mysql/backups on the 1st server, you would need to setup SSH properly for this to work, and you have setup the same directory on the 2nd server.
Server 1 Crontab :
/usr/bin/mysqldump --user=root --password=yourpassword databasename | gzip -9 > /opt/mysql/backups/backup_`date +\%Y\%m\%d\%H\%M\%S`.sql.gz
/usr/bin/rsync -avz /opt/mysql/backups root@ipaddressofServer2:/opt/mysql/backups
The above commands are going to take a MySQL backup and then at regular intervals copy them to your second server.
Now since the "moodle" application only changes when you upgrade it does not need to be archived so on the 1st server we can add another command to crontab to copy "moodledata" at regular intervals
/usr/bin/rsync -avz --exclude 'cache' --exclude 'codecoverage' --exclude 'sessions' --exclude 'temp' --exclude 'trashdir' /var/www/moodledata root@ipaddressofServer2:/var/www
The above command if you notice does not have the --del option which would mirror server 1 and since we want to "archive" we want to keep all the data on the 2nd server. You can have this in crontab run every 5min if you want, up to you. The 1st tie it runs it might take a while so you can do the 1st copy manually then add the entry to crontab since the rest will be incremental changes.
That is basically it, now if you want to go a step further you can create "virtual hosts" in Apache on the second server for each "term" the users are enrolled and name them according like term1.domain.com points to its own moodle install location with its own database restored on the second server. You can set this up for each term. Now each virtual host must have its own moodle folder but all of them can share the same "moodledata" folder. You would though however need to manually restore a new database for each term on the 2nd server and point each "config.php" to its individual database but all off them would point to the same moodledata folder.
You would now be able to keep the live server up to date and delete whatever you need to, if you need to go in and see past data you would just logon to one of the 2nd server virtual hosts and pull that data. This would also make it a snap to restore data to the live system.
Thanks,
JASON