12

I have been through a lot of questions regarding backing up your data, most recommended method is Clonezilla live CD but that wont work for me due to the server being remotely hosted by a company so I do not have a physical access

According to fdisk -l sda1 is the boot partition but after using dd to make a byte by byte copy of the data and downloaded to my computer, I cannot seem to boot from it on virtualbox after converting the output file to VDI, a quick search says that the partition does not have the boot files and I would need to make an image of the whole drive

I cannot make a dd image of the whole drive as the drive is 107GB and over 80GB is empty, I will end up with my drive fully consumed and no image

Is there a way to make a dd image with the boot files without cloning the whole drive? or maybe another way other than dd?

21
  • 1
    A dd image is cloned, which means that every byte is copied as it is. You can compress the image, which works best, if you zeroise all free space in the partition(s). But you must expand from the compressed image in order to run from the image. There are other ways to backup, and I think you should select one of those in this case. After all, your personal data are most important to back up. It is rather easy to reinstall Ubuntu. See this link: BackupYourSystem
    – sudodus
    Commented Apr 10, 2018 at 18:34
  • 1
    I have no problems with the image size, 20GB is no problem so no need for compression. The issue is running it on virtualbox as I have no knowledge on that I took a look at the link you provided, and tried some of the methods but most of them I either did wrongly or it did not work Tar gives me an error and rsync loops itself and makes a backup of the backup Commented Apr 12, 2018 at 6:19
  • I have tried TAR again and at the end, it gives the following Exiting with failure status due to previous errors on the previous lines all I see was socket ignored and no other issues Commented Apr 12, 2018 at 6:54
  • You can create a new virtual drive, that is big enough for the dd image (at least 20 GB), and then clone from the dd image to this new virtual drive. Then try to boot from the new virtual drive. (If the original system, the source of the dd image, was running in the virtual machine, the drivers should be correct, and the cloned copy on the new virtual drive should work too.)
    – sudodus
    Commented Apr 12, 2018 at 7:44
  • Beware, you should not boot with with both the original drive and the cloned copy connected. So please 'disconnect' the original virtual drive before booting into the new drive with the cloned copy. Otherwise the system will be confused, and can destroy both systems.
    – sudodus
    Commented Apr 12, 2018 at 7:48

1 Answer 1

19

I have managed to make a virtual machine by doing the following

  1. Create a Virtual Machine with a large HDD (500GB was enough for me).
  2. Install Ubuntu server 12.04 (matching my remote server).
  3. run this command ssh user@remoteserverip "dd if=/dev/sda" | dd of=/backup/ubuntu.bin it will make a copy of sda and save it to the virtual machine.
  4. After the ubuntu.bin is fully downloaded to the virtual machine, install virtualbox using the following command sudo apt-get install virtualbox.
  5. Run this command VBoxManage convertdd /backup/ubuntu.bin /backup/ubuntu.vdi --format VDI it will convert the image to a virtual hard disk.
  6. Download ubunti.vdi form the virtual machine to the host computer, the host was a windows system so I used WinSCP to download the file.
  7. Start a new virtual machine using the ubuntu.vdi file and you should be a running virtual machine of your remote server.
4
  • Congratulations and thanks for sharing your solution :-)
    – sudodus
    Commented Apr 17, 2018 at 10:11
  • 2
    Typo in "converdd" is "convertdd" Commented Nov 8, 2019 at 1:24
  • Perfect solution. Thanks!
    – John Manko
    Commented Feb 22, 2021 at 21:58
  • In VirtualBox 6 instead of convertdd use convertfromraw docs
    – Mikolasan
    Commented Jun 2, 2021 at 11:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .