2

I cloned and enlarged an existing virtual CentOS-6 disk by the following steps:

  1. Create 15GB virtual disk and mount the old and the new disks in GParted.
  2. In GParted copy boot, swap and ext3 partitions from the old disk to the new one.
  3. Mark the new boot partition with boot flag.
  4. Resize the new ext3 to bigger size.

I disconnected the old disk and connected the new one. Now I cannot boot the VirtualBox. I get a black screen. What seems to be the problem here?

Thanks.

2 Answers 2

1

The problem is that you did not install a boot loader ( grub2 ) on the new disk. Also, why bother copying? Just make the existing virtual disk size larger instead of copying to a new one.

4
  • Doesn't copying all partitions also copy the boot loader? If I resize the ext3 partition how do I fix the file system or will it adapt automatically to the new size?
    – Jack
    Commented Feb 7, 2012 at 18:16
  • @Jack no, on a typical msdos partitioned bios booting pc, the boot loader lives outside of any partition. After enlarging the virtual disk image, you need to expand the partition to use the new space. You can do this with gparted from a livecd ( so the partition isn't mounted ).
    – psusi
    Commented Feb 7, 2012 at 23:12
  • @Jack Copying all partitions copies most of the bootloader, but not one critical bit, which is in the bootsector. You need to create a working boot sector, e.g. grub-install. Commented Feb 7, 2012 at 23:56
  • @Gilles, it also doesn't get the core image for grub2, or the stage1.5 for grub-legacy.
    – psusi
    Commented Feb 8, 2012 at 2:16
1

As someone said, the GParted doesn't copy the boot sector. To solve this problem, you need to boot with a LiveCD and then run the following commands:

sudo mount /dev/sda3 /mnt  
sudo grub-install --root-directory=/mnt /dev/sda

Considering that sda3 is your new partition.

You must log in to answer this question.

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