3/10/2023 0 Comments Linux backup grsyncYou may also use an exclude file if you have many directories to exclude. For instance, use Use multiple -exclude=path/to/file/ directives when excluding multiple files and directories. Note: Don't include the full path when specifying what to exclude, use the relative path. For example, if you want to exclude a directory /var/-exclude=www//junk -C /var/ www -C /etc/ apache2 ![]() To exclude a file or directory from your archive, use -exclude=path/to/file/. Include any other directories you wish to back up with additional -C arguments in the command. Note the space after /var/ and /etc/ in the command before specifying the directory's name to back up. The arguments ( -cvpzf -C) in the command specify the following: $ sudo tar -cvzpf /var/web_backup/ -C /var/ www -C /etc/ apache2 $ sudo mkdir /var/web_backupĬreate a backup of the web server's document root and Apache configuration directory with tar. Once you have confirmed enough space is available to perform the backup, create a directory to contain the local backup. $ df -hĬompare this to the size of your website root and Apache configuration files and any other directories you wish to back up: $ du -sh /var/www Backup Preparationīefore creating a backup, ensure you have sufficient disk space on the web server. With this system, you're highly unlikely to lose your data. In addition to the primary working copy, you need two backups, stored on different types of storage media, with one of the copies offsite. The 3-2-1 backup rule states that you need three copies of your data. ![]() The commands used are standard for most Linux distros. You can adapt this guide for other web servers and Linux distributions with slight modifications. PrerequisitesĪ fully-updated Ubuntu Linux 20.04 server, running Apache.Ī fully-updated Ubuntu Linux 20.04 server for offsite backups.Ī non-root sudo user and SSH access to both servers. The example schedule runs daily, with backup retention for one year. This guide describes how to create automated backups of a web server's document root and Apache configuration files using the utilities tar, rsync, and cron.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |