2.14.2.2. Initialize a Newly Added Disk

After you added a new blank virtual hard disk to the virtual machine configuration, it will be invisible to the operating system installed inside the virtual machine until the moment you initialize it.

Initializing the New Virtual Hard Disk in Windows

To initialize a new virtual hard disk in a Windows guest OS, you will need the Disk Management utility available. For example, in Windows Server 2012 you can access this utility by clicking Start > Control Panel > System and Security > Administrative Tools > Computer Management > Storage > Disk Management.

When you open the Disk Management utility, it automatically detects that a new hard disk was added to the configuration and launches the Initialize Disk wizard:

  1. In the Select disks section, select the newly added disk.
  2. Choose the partition style for the selected disk: MBR (Master Boot Record) or GPD (GUID Partition Table).
  3. Click OK.

The added disk will appear as a new disk in the Disk Management utility window, but its memory space will be unallocated. To allocate the disk memory, right-click this disk name in the Disk Management utility window and select New Volume. The New Volume Wizard window will appear. Follow the steps of the wizard and create a new volume in the newly added disk.

After that your disk will become visible in My Computer and you will be able to use it as a data disk inside your virtual machine.

Initializing the New Virtual Hard Disk in Linux

Initializing a new virtual hard disk in a Linux guest OS comprises two steps: (1) allocating the virtual hard disk space and (2) mounting this disk in the guest OS.

To allocate the space, you need to create a new partition on this virtual hard disk using the fdisk utility:

Note

Note: To use the fdisk utility, you need the root privileges.

  1. Launch a terminal window.
  2. To list the IDE disk devices present in your virtual machine configuration, enter:

    fdisk /dev/hd*

    Note

    Note: If you added a SCSI disk to the virtual machine configuration, use the fdisk /dev/sd* command instead.

  3. By default, the second virtual hard disk appears as /dev/hdc in your Linux virtual machine. To work with this device, enter:

    fdisk /dev/hdc

    Note

    Note: If this is a SCSI disk, use the fdisk /dev/sdc command instead.

  4. To get detailed information about the disk, enter:

    p
  5. To create a new partition, enter:

    n
  6. To create the primary partition, enter:

    p
  7. Specify the partition number. By default, it is 1.
  8. Specify the first cylinder. If you want to create a single partition on this hard disk, use the default value.
  9. Specify the last cylinder. If you want to create a single partition on this hard disk, use the default value.
  10. To create a partition with the specified settings, enter:

    w

When you allocated the space on the newly added virtual hard disk, you should format it by entering the following command in the terminal:

mkfs -t <FileSystem> /dev/hdc1

Note

Note: <FileSystem> stands for the file system you want to use on this disk. It is recommended to use ext3 or ext2.

When the added virtual hard disk is formatted, you can mount it in the guest OS.

  1. To create a mount point for the new virtual hard disk, enter:

    mkdir /mnt/hdc1

    Note

    Note: You can specify a different mount point.

  2. To mount the new virtual hard disk to the specified mount point, enter:

    mount /dev/hdc1 /mnt/hdc1

When you mounted the virtual hard disk, you can use its space in your virtual machine.