C
C
constnw882021-01-14 10:02:49
SSH
constnw88, 2021-01-14 10:02:49

How to archive the contents of the VPS via SSH for later restoration?

Good morning everyone!

There is a VPS with DEBIAN that will expire today. We will not extend.

You need to somehow make a disk image so that it can be deployed there when it is needed again. SSH access only.

Friends, tell me, please, how can this be done?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Korotenko, 2021-01-14
@constnw88

If your intent is to backup a remote computer's HDD A via SSH to a single file that's on your local computer's HDD, you could do one of the following.
Examples
run from remote computer
$ dd if=/dev/sda | gzip -1 - | ssh [email protected] dd of=image.gz
run from local computer
$ ssh [email protected] "dd if=/dev/sda | gzip -1 -" | ddof=image.gz

C
CityCat4, 2021-01-14
@CityCat4

Restoring directly to a VPS most likely will not work, but it’s not particularly difficult to merge the image for yourself (when you figure it out). Here's how I do it:
The command is executed on a remote server while sending the dump to the server specified on the command line. The command will initiate a regular ssh connection, ask for a key or password, and write the output uncompressed
# dump -0auL root -f - /dev/vda2 | bzip2 | ssh [email protected] -p 22 dd of=vda2.dump
Parameters to change:
-L root - backup label
/dev/vda2 - name of the device from which the backup is
taken [email protected] - user and server name, where is the backup sent
vda2.dump - the name of the file where the backup will be written (by default it will be in the user's home directory)
The user user user must already exist on the servera.net server - it is his password that will be requested.
It is possible through dd, as above, but in this case all blocks will be transferred, including empty ones, and the size of the backup file will be equal to the size of the disk (before compression)

H
HighMan, 2021-01-17
@HighMan

Why do a full dump??
In my opinion, it is easier to copy the actual data and the necessary configs.
Why carry more operating system files?
Most VPS landlords by default fill in the "golden image", which they finished with for a speedy turn and threw out everything that was not needed on the VPS.
(Of course, they still leave the possibility of a complete manual installation of the system)
But if you agree to the "Golden Image", and this is by no means a flawed solution, then oh5 the same. All you need is data and a few configs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question