config backup

General support questions
good_face
Posts: 70
Joined: 2019/10/15 13:29:09

config backup

Post by good_face » 2020/10/16 10:48:22

I want to back up the necessary system files on the server to another location on the same network. Which system files should I back up on Centos 7 and which command should I use? Will the files under etc on the server be enough?

also can i run an automatic backup at certain times for this.

How can I backup both manually and automatically so which command i can use .


I want to ask a different question. In general, how companies that use centos make their backup choices ?

tunk
Posts: 1206
Joined: 2017/02/22 15:08:17

Re: config backup

Post by tunk » 2020/10/16 11:48:49

Look at systemd timers for running scripts/commands/etc
at certain times. You can use this to make 1:1-copies:
/usr/bin/rsync -ah --delete --stats /etc /back/up/directory
You could possibly also backup /boot, /root and /var.

lightman47
Posts: 1522
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: config backup

Post by lightman47 » 2020/10/16 11:55:49

and /home if you wish to save user's settings

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: config backup

Post by jlehtone » 2020/10/16 12:28:40

I don't know about companies, but IMHO the most important part of backup is the restore.

When you install a system, files are installed from packages. Then you either modify those files, or preferably add config files.

That server incinerates to dust. You get a new one. It is not identical; at least MAC addresses on NICs differ.

You need to install same packages. While the old server might have had a file that did mention what packages were installed, is that best way?
Perhaps you have a config file that lists the necessary packages and can be used by installer?
That file was created before or during the installation of the previous server, not copied from the server afterwards.
Besides, it is a "living document" as necessary packages do change over time.

You have now new packages in the new server. Is it really best to simply copy files from backup into it?
What if there are differences? How do you resolve those?

An issue with plain copies is that they are not "structured data". If you can't do plain copy, then you have to read the files.

There are config management tools. See https://wiki.centos.org/SpecialInterest ... agementSIG
Their idea is to have logical config in structured format that machine/program can read and apply to target system.


Another case, where plain file copy is not good, are databases. They have their own procedures for generating a consistent data dump and for restoring from one.

good_face
Posts: 70
Joined: 2019/10/15 13:29:09

Re: config backup

Post by good_face » 2020/10/16 17:38:43

How do I backup the etc directory . i am not good in centos. can you write all command.

Thanks

BShT
Posts: 585
Joined: 2019/10/09 12:31:40

Re: config backup

Post by BShT » 2020/10/16 17:40:47

cp -R /etc/* /backup/

BShT
Posts: 585
Joined: 2019/10/09 12:31:40

Re: config backup

Post by BShT » 2020/10/16 17:45:45

seems that you don´t know what this server runs as you ask us what to backup...

then try a more deterministic approach like a snapshot or a block level backup

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: config backup

Post by TrevorH » 2020/10/16 18:31:34

You are better off starting to use a configuration management program like puppet or ansible (there are other choices too) and putting your config changes into that so that it can do them for you when it's run. That way you have both a "backup" of what they were and also a way to make the same changes to other systems automatically and simplify your setup of new boxes in the future,
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: config backup

Post by desertcat » 2020/10/18 08:26:09

good_face wrote:
2020/10/16 17:38:43
How do I backup the etc directory . i am not good in centos. can you write all command.

Thanks
If you REALLY want to make your life EASY there is a nifty backup program you can use called Backupninja. IF *I* can use it *anybody* can use it, it really is that simple. Very EASY to install in CentOS 7:

yum install backupninja

ninjahelper will help with your config files. They give you EXAMPLES. It allows you to backup your chosen files or directories at a pre-determined time. EXAMPLE: Once a week, day , etc. I run Backupninja Once a week on Sundays usually EARLY in the morning hours when I am -- or should be -- asleep. I have several directories so I assign each one a different time slot.

You will also need a Backup Directory, preferably on a different disk -- the backups won't do you much good if you back up on the current drive and then have the entire drive fail. For me I have dedicated an entire 2TB HDD and the only thing it holds are my backups.

Finally I make two (2) FULL DISK backups using the dd command. One backup is done JUST BEFORE a new Point Release is expected; and one just AFTER a new Point Release comes out and I have updated the new Point Release that usually occurs within the first 10 days of the new Point Release.

The OLD Point Release Backup is there just in case there is something wonky in the New Point Release, then all you do is Roll Back to the OLD release and you can still use the computer while you wait for a fix or work-around. WITHOUT A BACKUP YOU ARE TOAST IF SOMETHING GOES WRONG!! Always Backup your machine BEFORE you Roll The Machine Over, or plan to do a new Install.

Backupninja is great for backing up key files and directories just in case something goes out in the weeds, or you accidentally Delete a key file or directory. Some people prefer to do DAILY backups, others Weekly, and others Monthly Backups. I usually run WEEKLY backups on files and Directories that are constantly changing, and MONTHLY backups on files and directories that seldom change.

Hope this helps.

D'Cat

good_face
Posts: 70
Joined: 2019/10/15 13:29:09

Re: config backup

Post by good_face » 2020/10/22 06:32:20

first thank you for very valuable information.
I have two servers. source server ip address 10.10.10.10 destination server ip address 10.10.50.10

How do I copy the files under etc on the source server to destination server. I could not find the command for it. Can you share where I write the full command and what information?

Post Reply