Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
wiki:backup_date [2011/05/24 05:58] – [Restore a Previous Backup] Guy | wiki:backup_date [2011/05/26 16:50] (current) – [Backup with Date and Time] Guy | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Backup with Date and Time ====== | ====== Backup with Date and Time ====== | ||
- | Following is a guide on how to save backup or encrypted backup with the date and time. When it gets to 5, or the number | + | Following is a guide on how to save a backup or encrypted backup with the date and time. You need to be using backup |
The date and time is in the order year, month, day, then hours, minutes and seconds. This keeps the backup files in order. | The date and time is in the order year, month, day, then hours, minutes and seconds. This keeps the backup files in order. | ||
Line 7: | Line 7: | ||
Open a text editor, and paste the following. | Open a text editor, and paste the following. | ||
- | < | + | < |
- | #!/bin/sh | + | # This saves a copy of backup or encrypted backup with the date and time. |
- | PART=hda1 # If not sda1, change this to the correct partition. | + | |
+ | PART=$(cat /opt/.backup_device) | ||
+ | MYDAT=$(cat / | ||
DATE=$(date +" | DATE=$(date +" | ||
- | DATABACK=Data-$DATE.tgz | + | DATABACK=$MYDAT-$DATE.tgz |
- | CRYPTBACK=Data-$DATE.tgz.bfe | + | CRYPTBACK=$MYDAT-$DATE.tgz.bfe |
- | cd /mnt/$PART/tce/ | + | cd / |
- | cp mydata.tgz $DATABACK | + | cp $MYDAT.tgz $DATABACK |
- | cp mydata.tgz.bfe $CRYPTBACK | + | cp $MYDAT.tgz.bfe $CRYPTBACK |
- | # Delete | + | # This deletes |
- | NUMBACK=$(ls | + | NUMBACK=$(ls |
while [ $NUMBACK -gt 5 ] # Change 5 to the number of backups you want to keep. | while [ $NUMBACK -gt 5 ] # Change 5 to the number of backups you want to keep. | ||
do | do | ||
- | ls -1t /mnt/$PART/ | + | ls -1t $MYDAT-2*tg* | tail -1 | xargs /bin/rm -f |
- | NUMBACK=$(ls | + | NUMBACK=$(ls |
done | done | ||
</ | </ | ||
- | If you are not using sda1, change it to the correct partition. | + | Save this file as backdate.sh in /opt. |
- | + | ||
- | Save this as backdate.sh in /opt. | + | |
Open the terminal and type | Open the terminal and type | ||
Line 39: | Line 39: | ||
< | < | ||
- | |||
- | You need to be using backup or encrypted backup. | ||
==== Manual Backup ===== | ==== Manual Backup ===== | ||
Line 57: | Line 55: | ||
< | < | ||
- | |||
- | ==== Access a Backup ==== | ||
- | |||
- | Backup files are normally saved in the tce directory, which may be somewhere like / | ||
- | |||
- | To access the contents of a backup, create a new directory and copy the backup file to it. Open the terminal and type | ||
- | |||
- | < | ||
- | tar -xvf backup-name</ | ||
==== Restore a Previous Backup ==== | ==== Restore a Previous Backup ==== | ||
- | To restore a previous backup, remove mydata.tgz, and rename the backup you want to restore mydata.tgz. | + | To restore a previous backup, remove mydata.tgz, and rename the backup you want to restore |
- | If using encrypted backup, remove mydata.tgz.bfe, | + | If using encrypted backup, remove mydata.tgz.bfe, |
Restart the computer for it to be loaded. | Restart the computer for it to be loaded. | ||
+ | |||