Skip to content

Instantly share code, notes, and snippets.

@gbiz123
Last active January 5, 2026 22:46
Show Gist options
  • Select an option

  • Save gbiz123/2ea60569c172dd72e2def96625fd9ea7 to your computer and use it in GitHub Desktop.

Select an option

Save gbiz123/2ea60569c172dd72e2def96625fd9ea7 to your computer and use it in GitHub Desktop.
Create a bootable backup image of a linux system remotely using RSYNC
You may have a linux system you wish to recreate repeatedly on bare metal.
The best way to do this is to create a bootable image of your system.
Typically, you would accomplish this with `dd` locally.
If the system you want to back up is a remote server, you can use `rsync`.
First, find the device on the remote server you want to back up using `lsblk`:
```
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 50.9M 1 loop /snap/snapd/25577
loop1 7:1 0 73.9M 1 loop /snap/core22/2139
vda 253:0 0 50G 0 disk
├─vda1 253:1 0 48.9G 0 part /
├─vda13 253:13 0 1023M 0 part /boot
├─vda14 253:14 0 4M 0 part
└─vda15 253:15 0 106M 0 part /boot/efi
vdb 253:16 0 466K 1 disk
```
In this case it's `/dev/vda`.
Finally, use the following command to backup the data from the block device using rsync:
`rsync --copy-devices --progress root@45.55.187.5:/dev/vda image.iso`
This is how you get a bootable image of any Linux system over SSH.
@gbiz123
Copy link
Author

gbiz123 commented Jan 5, 2026

You may have a linux system you wish to recreate repeatedly on bare metal.
The best way to do this is to create a bootable image of your system.
Typically, you would accomplish this with dd locally.
If the system you want to back up is a remote server, you can use rsync.

First, find the device on the remote server you want to back up using lsblk:

NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
loop0     7:0    0 50.9M  1 loop /snap/snapd/25577
loop1     7:1    0 73.9M  1 loop /snap/core22/2139
vda     253:0    0   50G  0 disk
├─vda1  253:1    0 48.9G  0 part /
├─vda13 253:13   0 1023M  0 part /boot
├─vda14 253:14   0    4M  0 part
└─vda15 253:15   0  106M  0 part /boot/efi
vdb     253:16   0  466K  1 disk

In this case it's /dev/vda.

Finally, use the following command to backup the data from the block device using rsync:
rsync --copy-devices --progress root@45.55.187.5:/dev/vda image.iso

This is how you get a bootable image of any Linux system over SSH.
You can load the image onto any major cloud platform, or put it on a physical USB stick and load it onto bare metal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment