Linux Debian How To Backup System and Data

Command of the Day :: You want to backup a remote machine (server) from a local (desktop) onto the local; type on local/desktop:

sudo rsync -azv -e "ssh -i /home/username/.ssh/id_rsa" username@server.seleads.com:/home/username/ /home/username/server_backup_on_local_desktop

username@server.seleads.com:/home/username/ (this is the server login and directory being backed up)
-i /home/username/.ssh/id_rsa (if you do not want to use password authentication – key is on local/desktop)

——————–

For Debian you only need to back up your data and configuration files as follows

Backup state:

dpkg --get-selections > dpkg_selections
sudo debconf-get-selections > debconf_selections

Backup data:

sudo rsync -azv /home/ /media
sudo rsync -azv /etc /media
sudo rsync -azv /var /media

Restore as follows:

sudo debconf-set-selections < debconf_selections
dpkg --set-selections < dpkg_selections
apt-get dselect-upgrade
sudo rsync -azv /media/home/ /home
sudo rsync -azv /media/etc/ /etc
sudo rsync -azv /media/var/ /var

You may also like...