BACKUPS;
Backups is the most important strategy for system reliablility. There is many method and software to help you in that task. I present my receipt using linux server system yours to adapt. There is three type of backup principles. Full backups , incremental backups and a variance of it call snapshots. I use ghost for linux (G4l) to fully backup the disk drive every 6 month. (G4L full backup link ). And I use dirvish (Dirvish web site link.) as a snapshot utility that provide me with the flexibility of incremental daily backup with the convenience of a snapshot where you select the date and the content to restore.
G4L is a hard disk and partition imaging and cloning tool. The created images are optionally compressed and transferred to an FTP server or cloned locally. CIFS(Windows), SSHFS and NFS support included, and udpcast and fsarchiver options.
Installation: by downloading the iso dvd of the program. Its usage is simple, start your machine under DVD with the disc. Type G4L and it will offer a series of options.
Usage: I use an external usb drive connected to the machine for backup . Its a menu driven application .
1- Insert the CD and start the machine with It as boot device and select the latest linux boot system .
2- Say ok to all default screen presentation and at the end type g4l on this screen :
3- Select a raw backup on this screen .
4- Select the A menu and be carefull to select the proper drive to store the backup image.
5- Now select menu B and enter the file name . You can look at existing drive content to make sure you have selected the good drive in A (usb external drive in my case) . Be smart for the naming , say “ machineA.1T-westernDigital.180211.lzop “ where lzop is file compression.
6- D menu show LZOP as default file compression for the backup image file.
7- Select E to select drive to backup again make sure you have the good one selected .
The following picture show that PARTITION sda1 Is selected. THIS IS NOT MY CHOICE.
In order to backup the whole drive to create a backup image of the completed drive select sda.
After selecting the drive you say ok to the main menue and you should see a warning sign that summarize your choices. Selecting ok there will get you going with the following screen .
Its a long process that will take about 25% of the data size on the usb backup drive to store the image. If that is too much space, there is a menu option to clean the original drive before backup. Its also a long process.
Restore: a faulty drive make sure your image is reinstall using G4l on the SAME hard drive size as original. The menu is the same (A, B, D ) up to selecting F instead of E in the following screen. Next screen will present you what it intend to do ok will confirm proceeding. Make very sure that you have selected the proper DRIVES cause FROM will completly erradicate TO.
___________________________________________________________________________________
DIRVISH: is the kind of backup that you install and forget. Its very reliable for the long time I have use it since ubuntu 8.04 I use a second disc drive for backup. Its attached by editing /etc/fstab
Here is my fstab file.
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# .....other drive configuration ......
#
# backup drive configuration
UUID=f357ebea-9127-43cc-9886-3db7febe9978 /mnt/back ext4 errors=remount-ro 0 1
Installation: I download and install dirvish with the Synaptic Package Manager you can also use the terminal command sudo apt-get install dirvish . I use only one configured backup with the complete hard drive tree to back up. There is two files to edit for backup configuration. First the master.conf file that you will find after installation in /etc/master.conf . The default is ok as is except for the following:
bank:
/mnt/back <<this is the attach point you have define in /etc/fstab
exclude: << the exclusion are the directory file pattern to exclude from backups found by experience.
lost+found/
*~
.nfs*
The rest is ok for that file. Then there is the bank configuration. Its the configuration that tell what this bank of backups will content. My bank is linux its a directory /mnt/back/linux . In that directory you need to create a subdirectory call dirvish /mnt/back/dirvish . That directory contain one file default.conf . Mine is as follow:
client: salonStationU16 << machine name ( the bash prompt after the @ )
xdev: 0 << include only main drive
tree: / << the tree of that machine
index: gzip << gzip use for the image compression
image-default: %Y%m%d << image name include date
exclude: << exclude list base on experience for ubuntu.
var/cache/
tmp
var/tmp
/media/
/mnt/
/proc/
*.gvfs
*/gvfs
/sys
*.vdi
Once config is out of the way. Make an initial backup manually. With the following command sudo dirvish --vault linux --init . It will take a while to do. If done without error you all set . If you have error check if you can add exclusion as its possible that some files are inaccessible when backup is done. The backup is done daily at 22:00 by default, make sure the time set is a time where not much happen on your machine. This run time is set in master.conf with Runall: linux 22:00
Restore: can take two forms . You can navigate to the file you need at the time you want them in the backup and simply copy them back to the location of your choice. You can also restore the whole of the drive tree with the following command . Before that either start the machine with a DVD drive and attach the hard drive to be restored or which I have use successfully too make sure you stop mysql with bash command sudo service mysql stop . Then move to the linux backup directory you want to restore from and create an exclusion file that include same list as the exclusion portion in default.conf.
This exclude file would look like this for me :
var/cache/
tmp
var/tmp
/media/
/mnt/
/proc/
*.gvfs
*/gvfs
/sys
*.vdi
Then you go with a no run test of the following command :
sudo rsync -vrltH --delete --numeric-ids -pgo -D --stats --exclude-from=exclude -n / /tree
If you get what you want you can terminate the command by removing the -n option. Restart the machine and come back in time to the backup selected.
Hope it helps
GiMiSa 18-02-18