Answer the question
In order to leave comments, you need to log in
How to make an image of centos7 system on local media with schedule, exception, increments?
There is centos7, it has two disks sda and sdb. sda1 is everything except /home. sdb1 is /home. sdb2 is /backup. I want to backup the system image with the exception of the /var/lib/pgsql/10/data/base directory and possibly incremental copying if there are tools for this. I want to shove all this into the schedule with further sending by mail and deleting old archives. In the open spaces I found tar, dd, rsync, cp tools. It is not clear which one should be used and how to combine.
For example, on the same server I do pg_dump for postgresql databases, but I do it clumsily, because it is not clear how exactly to send the pg_dump result to the mail, so I just send a message without the result of pg_dump itself, I do it through cron:
# get date
DATA=`date +"%Y-%m-%d_%H-%M"`
# loging
echo "`date +"%Y-%m-%d_%H-%M-%S"` Start backup base1c" >> /var/log/postgresql/myservice.log
# backup
/usr/bin/pg_dump -U postgres mybase | pigz > /backup/$DATA-mybase.gz
# loging end
echo "`date +"%Y-%m-%d_%H-%M-%S"` End backup base1c" >> /var/log/postgresql/myservice.log
# delete old backups older 30 days
/usr/bin/find /backup -type f -mtime +30 -exec rm -rf {} \;
# send mail notification
echo "$DATA"| mail -v -s "subject" -S smtp="smtp.mail.ru:587" -S smtp-use-starttls -S smtp-auth=login -S smtp-auth-user="[email protected]" -S smtp-auth-password="mypassword" -S ssl-verify=ignore -S nss-config-dir=/etc/pki/nssdb -S [email protected] [email protected]
UUID=9321ed79-2d9b-4476-a196-5e5bad49776c / ext4 defaults 1 1
UUID=6ec4eac4-2de3-4436-9d44-8993e61ba957 /home ext4 defaults 1 2
UUID=28f8de93-2206-43db-99c6-b49d3fe6b34a /backup ext4 defaults 1 2
Disk /dev/sda: 499.0 GB, 498999492608 bytes, 974608384 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x000d5d24
Устр-во Загр Начало Конец Блоки Id Система
/dev/sda1 * 2048 974608383 487303168 83 Linux
Disk /dev/sdb: 999.0 GB, 998999326720 bytes, 1951170560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x0004bb5c
Устр-во Загр Начало Конец Блоки Id Система
/dev/sdb1 2048 419432447 209715200 83 Linux
/dev/sdb2 419432448 1951170559 765869056 83 Linux
/dev/sda1: UUID="9321ed79-2d9b-4476-a196-5e5bad49776c" TYPE="ext4"
/dev/sdb1: UUID="6ec4eac4-2de3-4436-9d44-8993e61ba957" TYPE="ext4"
/dev/sdb2: UUID="28f8de93-2206-43db-99c6-b49d3fe6b34a" TYPE="ext4"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question