Here is my method for maintaining a simple backup of my Kubuntu /home and /etc folders. It is one way to be able to recover when things have gone badly wrong.
This method does not back up files from other operating systems.
Need to recover a deleted file? Lost your operating system and need to re-install from scratch? This method is your friend.
I am not a computer expert, so although this method does work - there might very well be better ways to achieve the same goal.
Any comments, suggestions, corrections, are very welcome.
This is a medium level set of instructions, it assumes that you have a separate hard drive, that it has a partition table and space for a backup partition.
It also assumes your familiarity with use of the terminal and your ability to edit system files like /etc/fstab and /etc/crontab
1. set up and format a partition, on a separate drive, about double the volume of the files you will back up
2. create a folder /mnt/backup:
make yourself owner of the file (substitute your user name for 'username') :
3. create an entry for /mnt/backup in /etc/fstab so that the partition will be mounted:
find the UUID of your backup partition using:
then:
first save fstab as /etc/fstab.bkup
then add this line to your fstab:
in format type put the formatting for your partition, ext3,ext4,btrfs etc
save your fstab as /etc/fstab, making sure there is a blank empty line at the end of the fstab text and close
4. put a sub-folder in /mnt/backup - call it /mnt/backup/info
5. write some scripts and save them into the /mnt/backup/info folder
(edit the include and exclude folders according to your needs)
(save the above as /mnt/backup/info/backup.include)
(save the above as /mnt/backup/info/backup.exclude)
(save the above as /mnt/backup/info/local-backup)
6. make local-backup executable
(do not put any kind of file extension on 'local-backup' - that would prevent it from working)
7. download and install the backup program, rdiff-backup
8. place a copy of local-backup in /etc/cron.hourly to get hourly backups
9. edit /etc/crontab so that backups are on the hour
as always backup up your crontab - save as /etc/crontab.backup
then edit the hourly line to read:
save as /etc/crontab
10. wait until the hour has past and check that everything is running smoothly by running this code:
which will will report on backups made
11. use the following code to activate backup at shut-down & reboot (this WILL cause a slow-up at shut-down while files are saved)
12. NEVER manually edit the files in /mnt/backup/store it will cause a system malfunction
Enjoy a more secure system and check out rdiff-backup on the net to discover how to recover files
If you have suggestions for improvements then please comment here. How was it for you? Feedback is always welcome.
The scripts can be edited to personalize inclusions and exclusions, backups can be retained for a longer or shorter period to suite the user.
This method does not back up files from other operating systems.
Need to recover a deleted file? Lost your operating system and need to re-install from scratch? This method is your friend.
I am not a computer expert, so although this method does work - there might very well be better ways to achieve the same goal.
Any comments, suggestions, corrections, are very welcome.
This is a medium level set of instructions, it assumes that you have a separate hard drive, that it has a partition table and space for a backup partition.
It also assumes your familiarity with use of the terminal and your ability to edit system files like /etc/fstab and /etc/crontab
Warning: make mistakes in some of these operations and your computer could stop functioning correctly
1. set up and format a partition, on a separate drive, about double the volume of the files you will back up
2. create a folder /mnt/backup:
Code:
sudo mkdir /mnt/backup
Code:
sudo chown -R username:username /mnt/backup
3. create an entry for /mnt/backup in /etc/fstab so that the partition will be mounted:
find the UUID of your backup partition using:
Code:
sudo blkid
Code:
kdesudo kate /etc/fstab
then add this line to your fstab:
Code:
UUID=(uuid of your backup partition) /mnt/backup (format type here) defaults 0 2
save your fstab as /etc/fstab, making sure there is a blank empty line at the end of the fstab text and close
4. put a sub-folder in /mnt/backup - call it /mnt/backup/info
Code:
mkdir /mnt/backup/info
5. write some scripts and save them into the /mnt/backup/info folder
(edit the include and exclude folders according to your needs)
Code:
/home/ /etc/
Code:
/home/bob/.adobe/ /home/bob/.dbus/ /home/bob/.macromedia/ /home/bob/.thumbnails/ **.iso
Code:
#!/bin/bash # # local-backup v1.0 # script by bob # published on kubuntu forums # purpose - to make simple (hourly) backups to a dedicated partition # # backup partition is /mnt/backup/ # data files are in /mnt/backup/info # backups will appear in /mnt/backup/store # # This method is offered in the hope that it may be useful # No liability is accepted for any consequences arising from its use # /usr/bin/rdiff-backup --exclude-globbing-filelist /mnt/backup/info/backup.exclude \ --include-globbing-filelist /mnt/backup/info/backup.include \ --exclude / / /mnt/backup/store/ # The following line removes restores which have been current for over [2] days /usr/bin/rdiff-backup --remove-older-than 2D --force /mnt/backup/store/
6. make local-backup executable
Code:
chmod +x /mnt/backup/info/local-backup
7. download and install the backup program, rdiff-backup
Code:
sudo apt-get install rdiff-backup
8. place a copy of local-backup in /etc/cron.hourly to get hourly backups
Code:
sudo cp /mnt/backup/info/local-backup /etc/cron.hourly
9. edit /etc/crontab so that backups are on the hour
as always backup up your crontab - save as /etc/crontab.backup
Code:
kdesudo kate /etc/crontab
Code:
0 * * * * root cd / && run-parts --report /etc/cron.hourly
10. wait until the hour has past and check that everything is running smoothly by running this code:
Code:
sudo rdiff-backup -l /mnt/backup/store
11. use the following code to activate backup at shut-down & reboot (this WILL cause a slow-up at shut-down while files are saved)
Code:
sudo cp /mnt/backup/info/local-backup /etc/init.d sudo ln -s /etc/init.d/local-backup /etc/rc0.d/K10local-backup sudo ln -s /etc/init.d/local-backup /etc/rc6.d/K10local-backup
12. NEVER manually edit the files in /mnt/backup/store it will cause a system malfunction
Enjoy a more secure system and check out rdiff-backup on the net to discover how to recover files
If you have suggestions for improvements then please comment here. How was it for you? Feedback is always welcome.
The scripts can be edited to personalize inclusions and exclusions, backups can be retained for a longer or shorter period to suite the user.
Comment