4

This question has bothered me for a while.

I have a remote machine with CentOS, which can only be accessed via ssh. I need to clone everything this system has and replicate it in my local with virtualbox. Here is what did:

  1. Clone the system by following steps/commands (dd) mentioned in this article. The command looks like this:

    dd if=/dev/xvda of=xvda.raw
    
  2. Transfer the dumped file to my local, and convert it to VDI format after reading this page:

    VBoxManage convertdd xvda.raw xvda.vdi --format VDI
    
  3. Create a VM with xvda.vdi

The VM cannot be launched, showing black screen and saying "Press any key to continue...".

Updated: See below dump from the remote machine. It seems there's no boot partition exists in the remote machine. If this, how can I create a boot partition in my local VM and clone all other partitions (I guess it's all about /dev/xvda) from remote machine?

[tom@ip-10-203-0-000 ~]$ sudo fdisk -l
Disk /dev/xvda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00057cbb

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1               1        3917    31456256   83  Linux

[tom@ip-10-203-0-000 ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       30G  9.2G   19G  33% /
tmpfs           1.8G     0  1.8G   0% /dev/shm
1

You may be missing a boot loader. You'll probably want to go with dd if=/dev/sda instead of /dev/sda1. Maybe you'll want to use some stop argument to prevent from dumping further than your bootloader and first partition.


Update:

Reading your df output, I'm guessing your source instance is something like a Xen Paravirtualized domU, which means there's no guarantee your instance has a bootloader or even a kernel. I'ld bet that a ls /dev/xvd* would only show partitions and no devices. And maybe you even have a /proc/xen directory?

Assuming the latter is true, then you should investigate on Xen PV to VirtualBox conversion. Which would probably involve installing a kernel and bootloader prior to dumping your partition. Make sure to backup your instance before breaking anything, ...

Also: your initial post told about dumping sda1, your edit shows a xvda1, ... Are you sure you are dumping the right partition?

  • @vlastimi, thanks but can you please share more details? I yet used these commands very often. – Jeffery Dec 7 '16 at 3:27
  • I actually tried >dd if=/dev/sda as well but no luck. Please share the full command as you mentioned. Appreciate that! – Jeffery Dec 7 '16 at 3:36
  • ...or you could install a new boot loader. You have the partition, assuming all good, boot using a live OS and reinstall grub. – jc__ Dec 7 '16 at 15:18
  • Thanks for your updates. You are absolutely right. There're only partitions ls /dev/xvd* and /proc/xen does exist although the folder is empty. I'm not familiar with Xen PV and will install a boot loader as @jc__ said. BTW, all my work was about xvda than sda1. Updated the original post. – Jeffery Dec 7 '16 at 15:39
  • Finally changed direction and clone another vm which doesn't use Xen PV. – Jeffery Dec 8 '16 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.