Which directories to exclude in an entire vps backup? and other backup questions

Started by ezhabchik, Jun 30, 2022, 07:46 AM

Previous topic - Next topic

ezhabchikTopic starter

I'm planning to use hashbackup to backup the entire vps offline (and also on physical usb) to a remote storage.

1. What directories should I exclude?
Most backup procedures seem to exclude --exclude=
{"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"}

But are there some run pid's that need to be backup'd?

2. The hashbackup developer mentioned that some files (like those that configure the vps ip address) and some that do need to be saved, but tar'd up beforehand. And then separately restored back.

If I have a situation where the vps is corrupt and I want to keep the same IP address/plan, then what considerations are needed?

If I have a situation where I want to move the vps to a new IP address/plan, then what considerations are needed in this case?
  •  

span4bob

We recommend you to check the most important Directories through the list below. What's more, maybe you have some files/settings that are not used at all, so it is unnecessary to take back up from the mentioned items.
/etc
/home
/root
/var
/opt
To get the IP configuration file, you can refer to the following directory:
/etc/netplan/
  •  

davidkeller

One of the most well-known types of backups is file-level backups. This type of backup uses the usual file system copy tools to transfer any data to a remote device.

cp command
The easiest way to create a backup is with the cp command. It copies files from one location to another. You could mount a removable drive on the local computer and copy all the necessary files to it:

mount /dev/sdc /mnt/my-backup
cp -a /etc/* /mnt/my-backup
umount /dev/sdc

rsync command
Instead of cp, it is better to use the rsync command, which could create flexible local backups. With rsync, you can perform the operations described above:

mount /dev/sdc /mnt/my-backup
rsync -azvP /etc/* /mnt/my-backup
umount /dev/sdc

nevertheless, storing bulky backups on the local file system is quite problematic. To prevent data loss, it is recommended that you store it on a physical backup drive or on a network.

The rsync command can create remote backups. There is a different syntax for that. This will work on any host that you can SSH into. In this case, the rsync command must be installed on both machines.

rsync -azvP /etc/* username@remote_host:/backup/
This command will create a remote copy of the /etc directory and move it from the local machine to the /backup directory on the remote_host.
  •