Hi,
I'm currently trying to solve a tricky problem, and I don't even know if it's possible. Let me describe the situation with a practical example.
In my office I have a sandbox PC for testing various setups that can't be tested in a virtual machine. I'm using this machine to test various setups with the Linux distributions I'm using, namely CentOS 7, CentOS 8 and OpenSUSE Leap 15.
I have a series of Ghost images of these systems on a local FTP server, and I'm using G4L (Ghost4Linux) to transfer these images to and from the server.
* https://sourceforge.net/projects/g4l/
On a side note, I take care of zeroing unused disk space in order to get relatively compact disk images like this:
# dd if=/dev/zero of=/0bits bs=20M ; rm -f /0bits
Besides my local sandbox machine, I also have a sandbox server in a datacenter, which I'm using for testing Internet-facing stuff.
I'd like to be able to do something similar with this public machine, e. g. backup the whole disk content completely agnostic in terms of partitions and file systems and send it to a public FTP server.
Unfortunately I can't boot G4L on this server, since I don't have physical access to the machine. The datacenter is about 700 km from where I can live.
What I can do: fire up a rescue console via an administration web interface and boot a live Linux system, either Ubuntu 16.04 or 18.04.
Now here's the question. From within my live system, how could I compress my system into a compact image and then send it to a distant FTP server?
And once this is done, how could I get my image back from the server?
Cheers from the sunny South of France,
Niki
Le 28/11/2020 à 08:13, Nicolas Kovacs a écrit :
Now here's the question. From within my live system, how could I compress my system into a compact image and then send it to a distant FTP server?
I'll answer this myself, since I just experimented and found a strikingly simple solution using dd and SSH (better than FTP).
Backup the server over the network from a live rescue session:
# dd if=/dev/sda status=progress | gzip --fast - | \ ssh microlinux@backup.microlinux.fr \ dd of=centos-7.9-server-image.gz
Restore this image from a live rescue session:
# ssh microlinux@backup.microlinux.fr \ dd if=centos-7.9-server-image.gz | \ gunzip --fast - | dd of=/dev/sda status=progress
Why didn't I think of this before ?
:o)
Niki
On Nov 28, 2020, at 7:12 AM, Nicolas Kovacs info@microlinux.fr wrote:
Le 28/11/2020 à 08:13, Nicolas Kovacs a écrit :
Now here's the question. From within my live system, how could I compress my system into a compact image and then send it to a distant FTP server?
I'll answer this myself, since I just experimented and found a strikingly simple solution using dd and SSH (better than FTP).
Backup the server over the network from a live rescue session:
# dd if=/dev/sda status=progress | gzip --fast - | \ ssh microlinux@backup.microlinux.fr \ dd of=centos-7.9-server-image.gz
Restore this image from a live rescue session:
# ssh microlinux@backup.microlinux.fr \ dd if=centos-7.9-server-image.gz | \ gunzip --fast - | dd of=/dev/sda status=progress
As you mention “compress” in your question, you could also add -C flag to ssh command (to turn on compression)
Valeri
Why didn't I think of this before ?
:o)
Niki
-- Microlinux - Solutions informatiques durables 7, place de l'église - 30730 Montpezat Site : https://www.microlinux.fr Blog : https://blog.microlinux.fr Mail : info@microlinux.fr Tél. : 04 66 63 10 32 Mob. : 06 51 80 12 12 _______________________________________________ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos