Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
In today's digital age, data loss can have severe consequences. Whether it's personal files, important documents, or critical system configurations, losing data can be devastating. Therefore, it is crucial to have a reliable backup strategy in place. This article will guide you through the process of creating backups on a Raspberry Pi, ensuring the safety and recovery of your valuable data.
Examples:
Creating a Full Disk Image Backup:
sudo dd if=/dev/mmcblk0 of=/path/to/backup.img bs=4M
This command will create a backup image of the entire SD card and save it as "backup.img" in the specified path. Adjust the "of" parameter to the desired backup location.
Incremental Backups with rsync:
rsync -avz --delete /source/directory/ /destination/directory/
Replace "/source/directory/" with the directory you want to back up and "/destination/directory/" with the location where you want to store the backup. The "--delete" flag ensures that any files deleted in the source directory are also removed in the backup.
Scheduled Backups with Cron:
crontab -e
Add the following line to the file to schedule a daily backup at 2 AM:
0 2 * * * rsync -avz --delete /source/directory/ /destination/directory/
Save the file and exit the editor. The specified backup command will now run automatically at the scheduled time.