Simple server backup
sudo mount /dev/xxxx -o remount-ro /mnt
mkdir /backup
cd /backup
tar --exclude='/backup' --exclude='/mnt/backup' --exclude='/mnt/mnt' -cvjpf mybackup.tar.bz2 /mnt
tar –exclude='./backup' –exclude='./mnt/backup' -cvjpf mybackup.tar.bz2 /mnt
Then you unpack with behavior permission
sudo tar -xvjpf mybackup.tar.bz2
Creating A Backup All Datebases And Restore
mysqldump -u root -p --all-databases > all_databases.sql
mysqldump -u root -p --all-databases < all_databases.sql
Creating A Backup Single Datebase And Restore
mysqldump -u root -p db_name > db_file.sql
mysqldump -u root -p db_name < db_file.sql
Split larger files into smaller parts? No problem!
Lets says I have an image and its too big (10MB). All I do is:
split --bytes=1M /path/to/image/image.jpg /path/to/image/prefixForNewImagePieces
and then to put it together I use cat:
cat prefixFiles* > newimage.jpg
rsync
backup from remote server 192.168.0.100 to local /mnt
mount /dev/sda1 /mnt/
rsync -aHxv root@192.168.0.100:/* /mnt --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/tmp
/backup_`date +"%F"`.tar.bz2