This is an old revision of the document!
Table of Contents
Backup with Date and Time
Following is a guide on how to save a backup or encrypted backup with the date and time. When it gets to 5, or the number you select, each time a new backup is created, the oldest is deleted.
The date and time is in the order year, month, day, then hours, minutes and seconds. This keeps the backup files in order.
Open a text editor, and paste the following.
# Save a copy of mydata.tgz or mydata.tgz.bfe with the date and time. #!/bin/sh PART=sda1 # If not sda1, change this to the correct partition. DATE=$(date +"%Y.%m.%d-%H.%M.%S") DATABACK=Data-$DATE.tgz CRYPTBACK=Data-$DATE.tgz.bfe cd /mnt/$PART/tce/ cp mydata.tgz $DATABACK cp mydata.tgz.bfe $CRYPTBACK # Delete the oldest if there are more than 5 (or the number you select). NUMBACK=$(ls Data-* | wc -l) while [ $NUMBACK -gt 5 ] # Change 5 to the number of backups you want to keep. do ls -1t /mnt/$PART/tce/Data-*tg* | tail -1 | xargs /bin/rm -f NUMBACK=$(ls Data-* | wc -l) done
If you are not using sda1, change it to the correct partition.
Save this as backdate.sh in /opt.
Open the terminal and type
sudo chmod 775 /opt/backdate.sh
To create a backup file with the date every time you turn the computer off, add the following to /opt/shutdown.sh.
/opt/backdate.sh
You need to be using backup or encrypted backup.
Manual Backup
Add the following line to /opt/bootlocal.sh
sudo cp /opt/backdate.sh /usr/sbin
Restart the computer.
To run backup, use
filetool.sh -b
To create a backup file with the date and time, use
backdate.sh
Restore a Previous Backup
To restore a previous backup, remove mydata.tgz, and rename the backup you want to restore mydata.tgz.
If using encrypted backup, remove mydata.tgz.bfe, and rename the backup you want to restore mydata.tgz.bfe.
Restart the computer for it to be loaded.
Extract a Backup File
You normally access a backup by starting the computer, and accessing it.
Here is a guide on extracting backup files manually.
Backup files are normally saved in the tce directory, which may be somewhere like /mnt/sda1/tce.
To access the contents of a backup, create a new directory and copy the backup file to it. Open the terminal and type
cd directory tar -xvf backup-name
This cannot be done with encrypted backups. You access them by restoring them when you start the computer.