H
H
HeroFromEarth2016-08-13 18:50:07
linux
HeroFromEarth, 2016-08-13 18:50:07

What are the utilities for creating a live image of a UNUX system?

Hello.
The next task is to create an image of Unix systems (Solaris, CentOS...) "on the fly", and, if possible, without a strong performance drop (in any case, so that someone else can work on such a system). Systems on a physical server and virtual machines, "at hand" and remote.
At the moment I was thinking through three options, but everyone has their own "but":
1. With the help of dd. There are at least two minuses - during operation it eats up a lot of resources from the disk, especially if it is not an SSD, and the size of the backup is equal to the size of the disk, i.e. if the conditional disk /dev/sda1 has 20GB of data, but the disk itself is 120GB, then the backup size will be 120GB (I am clarifying such trifles for those who are also looking for answers).
2. Using tar. Minus at least one - non-compliance with the requirements. It is not possible to make a backup of the system "on the fly"; many files in /dev and /proc are not archived, either because they are modified during the backup, or because they are open sockets, or for some other reason. It is not always possible to boot from a LiveCD.
3. Backup/Restore LVM. Somewhat confused, but I managed to make a backup (I make a snapshot -> I make a backup of it), but I can't deploy it. Cons - GRUB does not support LVM, so /boot needs to be backed up-restored separately anyway, and, obviously, if there is no LVM in the system, then the method is not working.
In total, the only working method that I know of is dd, but the volume of files is enormous, especially if the disks are large and if we are talking about remote machines, then transferring ~ 500GB over the network from Vladivostok to Moscow is not an easy task. Since I don't work with Unix systems very much (I think this can be seen from my post), I'm asking for help in solving the problem. I will also be grateful if you point out similar utilities for Windows systems.
The topic is very relevant and I hope that we will be able to find an answer to it.
In the meantime, I do not fold my pens in anticipation of ready-made solutions, but continue to search. If I find something interesting, I'll post it.
UPDATE1:
I really don’t know whether I am distinguished by a special curvature, or whether I am distinguished by a special curvature (after all, I have some confidence in this). Let's go in order:
1. I tried to backup mondorescue. Perfectly backups, creates an .iso image with a backup, BUT it is impossible to deploy this backup to a disk smaller than the disk from which it was removed: we get a kernel panic. If we deploy to a disk of the same size, then we simply cannot log in as root :)
2. I made backups with tar. With LVM, it cannot be done, the system does not boot, and it was not possible to restore it within a few hours. Without LVM, I did everything exactly according to the article with both KVM and VMware ( https://habrahabr.ru/post/251659/), but the system does not boot into any. I booted from LiveCD, made a backup, booted from this LiveCD on a new VM, mounted a disk with a backup + a new disk, unrolled the backup to a new disk, the system does not boot.
3. Using the backup/restore built into LVM, I make a backup, but I can’t roll it out later.
4. Clonezilla doesn't meet the requirements above (correct me if I'm wrong).
I will try Rsync.
I will also add a question: maybe I want too much? I make a backup of the entire system (excluding /proc, /dev, /sys, /tmp), and then I roll this backup onto a new disk. I put GRUB on the new disk, it installs without errors.
Maybe in my crooked case it will be easier to create a new VM with CentOS installed, backup directories on the target machine

/boot /bin /etc /home /lib /lib64 /opt /root /usr /var
and just throw them on a new VM + update GRUB?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
M
moropsk, 2016-08-13
@moropsk

there is such a backup option to "live":
https://moonback.ru/page/full-server-backup
www.mondorescue.org/docs/mondoarchive.8.html

A
Alexey Cheremisin, 2016-08-13
@leahch

I don't know, since aix I've been using tar for fast copying.
There are, however, a couple of points.
First, only file systems need to be copied! And all sorts of devfs, procfs, sysfs, tmpfs and other special systems cannot be copied! You can get the list with the mount command
. Second, you need to copy each file system separately.
And thirdly, there is no need to create an archive file on the same file system that we are copying!
tar --one-file-system -czf mybackup.tgz /

I
Ivan Tishchenko, 2016-08-13
@Tihon_V

From time to time I use rsync over ssh, or like this "dd_rescue /dev/sdX | gzip -c > /path/to/backup.img.gz"
As for LVM, see how it is implemented in openSUSE. It seems there I saw the opportunity to boot from a snapshot (although I do not exclude that btrfs was there)

S
SergeySL, 2016-08-13
@SergeySL

dump and restore. Everything is done without unmounting the file systems, the dump is a regular file that can be rewritten, packed, etc. etc.

V
Vasily Pechersky, 2016-08-14
@Vasily_Pechersky

Comrades! Rsync is the salvation! Copies only changed files.
First , Yuri Chudnovsky has already written about /proc and his friends.
Secondly, if you snapshot a disk with an open server db file, it will not be consistent during recovery. 5% of cases that he will not immediately take off.
Total - just a Linux machine with static files - replicate with Rsync.
At the same time, it makes sense to do this only on working directories every day, and the rest - once a week.
Databases - dump by standard means, compress pigz (multi-core) and copy to target. We expand there.
For windows - there is also an implementation of Rsync - syncback. Windows backup and disk2vhd help too.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question