Rsnapshot From One OMV Host to Another OMV Host Using Command Line
This little tutorial describes how to use rsnapshot on an OMV host (hereby referred to as "Backup Host") to directly do snapshot backups of data residing on another OMV host (hereby referred to as "Main Host").
In other words, you will not need to rsnapshot onto "Main Host" first and then transfer the snapshots to "Backup Host" via rsync (or any other method).
This can be useful for those who prefer to keep snapshots and the data on separate hosts due to various reasons (mine was the lack of HDD space and SATA ports in any of the hosts) and if the remoteshare plugin does not work (which is fixed in OMV 3).
- Two OMV Hosts (preferably fully updated, same OMV versions)
- Both connected in a LAN
- Being willing and able to work with command line (e.g. PUTTY)
- Keep in mind that rsnapshot is a pull-based design; the "Backup Host" running it will pull the data from the "Main Host" (see links 1 and 2). You can't push data from the "Main Host" in other words.
- In "Main Host", use OMV GUI to create SMB share of the data you want snapshots of (You may also use other network sharing protocols like NFS but I have yet to try this)
- (Optional) In "Backup Host", use OMV GUI to create SMB share to contain the snapshots (You may also use other network sharing protocols like NFS but I have yet to try this)
- In both hosts, install the Rsnapshot plugin using the OMV GUI
- In both hosts, enable SSH using the SSH plugin in the OMV GUI
- Open two command line windows, one for the "Backup Host" and another for the "Main Host"
- In both hosts, execute "sudo apt-get install cifs-utils" or equivalent for the network protocol used (see link 3)
- In "Backup Host", make a mount point (e.g. sudo mkdir /media/samba) (see link 4)
- In "Backup Host", open /etc/fstab with your text editor (e.g. sudo nano /etc/fstab/)
- Add the share of the "Main Host" in the last line of fstab (e.g. //192.168.1.21/test /media/samba cifs defaults,credentials=/etc/samba/credentials 0 0) (see link 4)
- In "Backup Host", create /etc/samba/credentials with your text editor (e.g. sudo nano /etc/samba/credentials)
- Add the credentials of the share like this into /etc/samba/credentials and save: username=[your username]password=[your password]
- In "Backup Host", make the file owned by root and ro by root (e.g. sudo chown root.root /etc/samba/credentials && sudo chmod 400 /etc/samba/credentials) (see link 4)
- In "Backup Host", execute "mount -a" to mount the share of "Main Host" (or you may restart "Backup Host")
- In "Backup Host", open /etc/rsnapshot.conf with your text editor (e.g. sudo nano /etc/rsnapshot.conf)
- Edit snapshot_root to where in "Backup Host" you want to save the snapshots to
- Edit the backup points to point to the share of "Main Host" (e.g. /media/samba/ test/)
- Edit any other parts as you see fit
- Save rsnapshot.conf
- In "Backup Host", execute "rsnapshot configtest" and "rsnapshot -t hourly" to test
- Finally, execute "rsnapshot hourly" to perform the actual snapshot! (Or you may even cron this as you see fit)