I have inherited an Ubuntu 14.04 server that I need to create a sandboxed copy of locally in VirtualBox to experiment with as part of preparing to upgrade to Ubuntu 20.04, as we strongly suspect it is not a straight-forward update.
In order to do so, I would like a complete backup of the server file systems to restore in a blank virtual machine, which I traditionally would do for ext4 using dump
as root on the server to a file, copy that file locally and restore
it. Unfortunately there is not room on the server to hold the resulting file for the root file system.
I therefore have experimented with dumping to standard out in an ssh connection and capturing the output locally, similar to:
ssh -t me@there "echo MYPASSWORD | sudo -S dump -y -f - /boot 2>/dev/null " > boot.dump
(The standard error redirect is to avoid having the dump messages mixed into the dump file)
Unfortunately restore
(also under 14.04) dislikes this dump file as it fails the checksums. If I create the dump file on the server and copy it, it is fine.
Most resources on the net runs the ssh command on the same machine as the dump command, so the file descriptors are not mixed together.
Any suggestions?
EDIT: Some experimentation with the /boot
file system, show that the file created by dump directly is 125932218 bytes, and the file created from the ssh command is 125465751 bytes, with a difference of about 466000 which - using the technique described in https://stackoverflow.com/a/31417454/53897 - appears to be \r
characters (0d hex) inserted ahead of a \n
character (0a hex). So this is not about extra messages being merged silently into the datastream but about not being binary clean. Interesting.