Use the fdisk command to partition the disk and make the partition bootable.
echo -e "n\np\n1\n\n\nt\n83\na\n1\nw" | fdisk /dev/xvdc
Device Boot Start End Blocks Id System
/dev/xvdc1 * 1 63 506016 83 Linux
6. Format the new boot disk partition
/dev/xvdc1
.
mkfs.ext4 /dev/xvdc1
7. Setup and mount the new boot disk partition and get the single blockID.
mkdir /virtual diskfile namemount /dev/xvdc1 /virtual diskfile name
a. Setup and mount the new boot disk.
mkdir /virtual diskfile namemount /dev/xvdc1 /virtual diskfile name
For example, make a directory and mount the
newboot
boot disk:
mkdir /newbootmount /dev/xvdc1 /newboot
b. Get the single blockID.
# blkid /dev/xvdc1/dev/xvdc1: UUID="3d7a177b-0fa0-4212-9c0c-
c5554bb1817a" TYPE="ext4"
8. Copy the original boot content to the new boot disk.
cp -dpR /boot/* /virtual diskfile name
For example, for the disk named
newboot
:
cp -dpR /boot/* /newboot
9. Make the new boot partition the active boot partition
umount /virtual diskfile nameumount /bootmount /dev/xvdc1 /boot
umount /newbootumount /bootmount /dev/xvdc1 /boot
10. Setup Grub in the new boot disk.
Use the grub or grub2 command, where
/dev/xvdc
is the new boot disk device.
• If you are using Oracle Linux 6U7, use grub:
# grub
grub> device (hd0) /dev/xvdc
grub> root (hd0,0)
grub> setup (hd0)
Chapter 12
How to Create Driver Domain Virtual Machines
12-37