Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Ankur_Datta
Collaborator

automating mds backup

Hi all,

 

I am writing a script to automate mds backup. 

will running mds_backup with -b parameter will create any problems?

 

we are planning to run this script in midnight when nobody is login into management. for precaution measures, we will enable the setting to log out user from smart console after specific idle time-out.

 

Kindly also let me know if any suggestions please.

 

Thanks

0 Kudos
12 Replies
Danny
Champion
Champion

No need for a script, a simple one-liner is enough. I'm using the -b parameter all the time without any issues.
Just enter this line into the GAiA job scheduler and have it executed at midnight:

. /opt/CPshrd-R??/tmp/.CPprofile.sh; mdsstop; sleep 120; /opt/CPmds-R??/scripts/mds_backup -l -b -d /var/log/mdsbackups/ 2>/dev/null; sleep 120; mdsstart -s

Manually create the folder /var/log/mdsbackups and use another one-liner to clean up the number of mds_backups in it:

ls -tl /var/log/mdsbackups/*.tgz | tail -n +10 | xargs rm -f

Additional info: How to reduce the size of mds_backup file (sk103115)

 

S_E_
Advisor

hi

is there any specific reason to run a mdsstop /mdsstart ?

This might be very time consuming until every process is back and has potential to loose logs.

 

We run this one and did not experience any issue:

mds_backup -g -b -L best

 

Regards

 

0 Kudos
Sanjay_S
Advisor

Hi Danny,

I tried using the below command in Job scheduler but it is not working. Any suggestions on this?

. /opt/CPmds-R80.30/scripts/mds_backup -l -b -s -d /var/log/mdsbackups/ 2>/dev/null; sleep 120;

Regards,

Sanjay S

0 Kudos
Danny
Champion
Champion

You need to load the CP environment first: source /etc/profile.d/CP.sh

0 Kudos
Sanjay_S
Advisor

Hi Danny,

I used the below and still no back up in the mentioned path.

. /etc/profile.d/CP.sh; /opt/CPmds-R80.30/scripts/mds_backup -l -b -s -d /var/log/mdsbackups/ 2>/dev/null; sleep 120;

Any thoughts?

Regards,

Sanjay S

0 Kudos
Kaspars_Zibarts
Authority
Authority

Why don't you run Gaia backup that would include everything? 🙂 Nothing to write. Works out of the box and fully supported.
Danny
Champion
Champion

Of course Gaia backup is also recommended. However, that‘s another backup option the thread starter didn‘t ask for.

0 Kudos
Kaspars_Zibarts
Authority
Authority

I've noticed over the years that some people didn't know that Gaia does full MDS backup 🙂 that's all
0 Kudos
Bruno_Petronio
Contributor

Hello Kaspars, 

When you mention Gaia Backup, you mean System Backup (in WebUi) and/or backup/restore in clish ?

I could not find any documentation beside mds_backup tool for backup MDS, and that's why i'm asking 🙂 If so, does it stops the domains in the process ? 

 

Thanks for your confirmation.

Bruno Petrónio 

0 Kudos
Kaspars_Zibarts
Authority
Authority

It doesn't matter if you use GAIA WebUI or CLI both will create the same result.

i.e in CLI you can just type

backup local

This directory shows which products will be backed up:

image.png

 

Bruno_Petronio
Contributor

Thanks,

I would guess we don't have to manually change this file to setup it to a mds, but instead the device will recognize the product type, in this case a MDS ?

I just found a reference in a backup log to a scheme used in my MDS Gaia Backup (/var/CPbackup/schemes/mds.cpbak), i dont find this file in any other Product, SMS or SG, so i would guess its automatic 🙂

0 Kudos
Kaspars_Zibarts
Authority
Authority

That's correct - essentially you run the same command on the gateway and MDS and device itself will now what to back up

0 Kudos