I plan on using hashbackup to perform an offline backup of my entire VPS, as well as storing a copy on a physical USB drive and a remote storage location.
I need to determine which directories to exclude from the backup process; most procedures exclude specific directories such as "/dev/*," "/proc/*," "/sys/*," "/tmp/*," "/run/*," "/mnt/*," "/media/*," and "/lost+found." However, I'm unsure if any run PIDs require backup.
The hashbackup developer advised that certain files, such as those configuring the VPS IP address, must be saved and tar'd up before being restored separately. If my VPS is corrupted, and I wish to keep the same IP address and plan, what precautions must I take? What considerations should I make if I want to relocate my VPS to a different IP address or plan?
We suggest that you review the crucial directories listed below. Additionally, there may be files or settings that are obsolete and thus do not require backup from the aforementioned items.
- /etc
- /home
- /root
- /var
- /opt
To locate the IP configuration file, you can refer to the directory below:
- /etc/netplan/
One of the most widely used backup methods is file-level backups. This approach employs conventional file system copy tools to transfer data to a remote device.
The cp command is the simplest way to produce a backup. It duplicates files from one location to another. To do this, attach a removable drive to the local computer and copy all necessary files to it using the following commands:
mount /dev/sdc /mnt/my-backup
cp -a /etc/* /mnt/my-backup
umount /dev/sdc
Instead of cp, it's preferable to use the rsync command, which allows for versatile local backups. You may execute the operations described previously using rsync, as shown here:
mount /dev/sdc /mnt/my-backup
rsync -azvP /etc/* /mnt/my-backup
umount /dev/sdc
However, storing massive backups on the local file system poses difficulties. Therefore, it's recommended to store them on a physical backup drive or network to avoid data loss.
The rsync command is capable of creating remote backups using a distinct syntax. This method operates on any host that supports SSH access, and both machines must have the rsync command installed.
rsync -azvP /etc/* username@remote_host:/backup/
This command creates a remote copy of the /etc directory and transfers it from the local machine to the /backup directory on the remote_host.
When performing an offline backup using hashbackup, it is recommended to exclude specific directories such as "/dev/*," "/proc/*," "/sys/*," "/tmp/*," "/run/*," "/mnt/*," "/media/*," and "/lost+found." These directories generally contain temporary or system-specific files that do not need to be backed up.
In terms of run PIDs, it depends on the specific processes running on your VPS. If you are unsure which processes require backup, it is generally safe to exclude them from the backup process since they can usually be restored or reinstalled separately.
To save specific files configuring the VPS IP address, you should identify those files and back them up separately. This will ensure that you can restore the necessary IP address configurations if your VPS gets corrupted. You can typically find these configuration files in directories like "/etc/network/" or "/etc/sysconfig/network-scripts/."
If you wish to keep the same IP address and plan after restoring your backup, you should ensure that you have a record of your current network settings, including the IP address, subnet mask, gateway, DNS servers, etc. Once you have restored the backup, you can then reapply these network settings to maintain the same IP address.
On the other hand, if you want to relocate your VPS to a different IP address or plan, you would need to update the necessary network settings accordingly. This may involve modifying the network configuration files, updating DNS records, and configuring any firewall rules or port forwarding settings associated with the new IP address.
It is important to note that the exact steps required for preserving or changing IP addresses and plans may vary depending on the specific VPS provider and operating system you are using. Therefore, it is always advisable to consult the dоcumentation provided by your VPS provider or seek assistance from their support team to ensure a smooth transition.
If you want to ensure a smooth transition when relocating your VPS to a different IP address or plan, here are some additional considerations:
1. Network Configuration: Before making any changes, familiarize yourself with the network configuration settings on your VPS. This includes details like IP addresses, subnet masks, gateways, DNS server information, and any specific network settings required by your VPS provider.
2. DNS Records: If you have domain names associated with your VPS, you may need to update the DNS records to reflect the new IP address. This involves changing the A record or any other relevant DNS records associated with your domain. Consult your DNS provider's dоcumentation for instructions on how to make these updates.
3. Firewall Rules and Port Forwarding: If your VPS has any firewall rules or port forwarding configurations in place, you will need to modify them to accommodate the new IP address. Update any firewall rules or port forwarding settings to ensure that your VPS retains the desired connectivity after the relocation.
4. Data Transfer: If you are moving your VPS to a different physical server or data center, you will need to consider the process of transferring your data. This may involve creating a backup of your current VPS, transferring it to the new location, and restoring it on the new server. Refer to your VPS provider's guidance on migrating or transferring VPS instances.
5. DNS Propagation: Keep in mind that DNS changes may take some time to propagate across the internet. It can typically take a few hours, but it can sometimes take up to 48 hours for the new IP address to be recognized globally. During this time, there may be intermittent connectivity issues as DNS servers update their records.
6. Testing and Verification: After the relocation, it is crucial to thoroughly test the connectivity and functionality of your VPS. Verify that all services, applications, websites, and connections are functioning as expected. This will help ensure a successful transition and allow you to address any issues promptly.
Ensure you include configuration files like /etc/network/interfaces or equivalent files for your IP settings. If your VPS gets corrupted, having these files backed up allows you to restore your exact network configuration, preserving your IP address and plan. For relocation to a different IP or plan, consider backing up any firewall rules and DNS configurations, as these will need adjustment post-migration.