27 lines
1.2 KiB
Plaintext
27 lines
1.2 KiB
Plaintext
Backup up your Ubuntu server installation using the tar command via the terminal.
|
|
|
|
Two easy steps simplified
|
|
|
|
To Create the Backup Archive:
|
|
|
|
sudo tar -cvpzf yourbackupfilename.tar.gz --exclude=/path/to/backup/yourbackupfilename.tar.gz --one-file-system /
|
|
|
|
In the last part of the command a single forward slash will backup the entire root directory, or you can specify a certain directory to backup.
|
|
|
|
Restoring your backup:
|
|
|
|
sudo tar -xvpzf /path/to/yourbackupfilename.tar.gz -C /directory/to/restore/to --numeric-owner
|
|
|
|
If restoring a complete root directory backup the last section of this command would simply be a forward slash /
|
|
|
|
Reboot and enjoy.
|
|
|
|
#!/bin/sh
|
|
sudo tar --cvpzf /home/agnav/backups/sys_$(date +\%Y\%m\%d).tgz --exclude='/home/agnav/temp' --exclude='/home/agnav/agmission' --exclude='/home/agnav/db' --exclude='/home/agnav/jsreport' --exclude='/home/agnav/backups' / --one-file-system
|
|
|
|
sudo tar --cvpzf /home/agnav/backups/agm_$(date +\%Y\%m\%d).tgz /home/agnav/agmission /home/agnav/jsreport /home/agnav/db
|
|
|
|
|
|
Run script to update userId maps
|
|
mongo --quiet -host agmission.agnav.com -u "agm" -p "Agm2017" --authenticationDatabase "agmission" agmission c_users_map.js > users_map.csv
|