Skip to main content

Chapter III: 3.2 Formatting a Disk

After you create and attach the new disk to a VM, you must format and mount the disk, so that the operating system can use the available storage space.

3.2.1 Formatting & mounting a disk on Windows

  • Open your Windows VM, right-click the Windows Start button and select Disk Management.

    Disk Management is a system utility in Windows that enables you to perform advance storage tasks. Here are some of the things Disk Management is good for:

    • To setup a new drive
    • To extend a volume into space that’s not already part of volume on the same drive
    • To shrink a partition, usually so that you can extend a neighboring partition
    • To change a drive letter or assign a new drive letter


Image 3.6 Windows - Disk Management



  • Disk Management will appear, right click on Disk 1, then click Online. You must bring it online before you can initialize it or create volumes on it.

    The fields in Disk Management include:

Table 3.2 Disk Management


Column Description
Volume Partition and logical drives are known as volumes
Layout The type of the volume
Type The type of Disk
File System The types of file system. Disk Management only supports 3 types of file system: FAT,FAT32, and NTFS
Status The status of volume
Capacity The capacity of each volume in MB or GB
Free Space The free space of each volume in MB or GB
% Free The free space of each volume in %
Disk 0 The single physical drive you have in your system
Disk 1 another single physical drive that you just attached

Disk 0 and Disk 1 are physically different hard disk


Image 3.7 Disk Management



  • Right click on Disk 1, then click Initialize Disk. Initialize Disk erases everything on it and prepares it for use by Windows, You need initialize it before using it. You can only initialize a drive that’s not yet formatted.


Image 3.8 Disk Management - Initialize Disk



  • Disk Management prompts you to select a partition scheme for the new disk. Select GPT and click OK.

    Disk can be divided up into multiple chunks called partition. Each partition has to have a partition style, GPT or MBR. Windows uses the partition style to understand how to access the data on the disk.

Table 3.3 GPT/MBR


Column Description
GPT (GUID Partition Table) The newer GPT partition table style is required on your boot drive by newer computers that use UEFI instead of BIOS. GPT is more robust and allows for volumes bigger than 2TB, and also GPT supports up to 128 partitions on the same hard drive
MBR (Master Boot Record) Old format partition that is used by 32-bit PCs, older PCs, and removable drives such as memory cards. One of these limitations is that MBR only supports up to 4 primary partitions, the next limitation is that partitions using the MBR format have a maximum size of 2TB


Image 3.9 Disk Management - Initialize Disk (GPT)



  • After the disk is initialized, right-click the Unallocated Disk Space and select New Simple Volume.


Image 3.10 Disk Management - New Simple Volume



  • Follow the instructions in the New Simple Volume Wizard to configure a new volume.


Image 3.11 New Simple Volume Wizard



  • In the Specify Volume Size pop-up, click the Next button.

    The field in Specify Volume Size include:

Table 3.4 Specify Volume Size


Column Description
Maximum disk space in MB The maximum size you can use.
Minimum disk space in MB The minimum size you can use
Simple volume size in MB Specify the volume size as needed.


Gambar 3.12 New Simple Volume Wizard - Specify Volume Size



  • Then on Assign Drive Letter or Path, select Assign the following drive letter, then click Next.

    The field in Assign Drive Letter or Path include:

    • Assign the following drive letter, this option if you want assign the volume to a drive letter.
    • Mount in the following empty NTFS folder, you can mount (make a drive accessible) in a folder rather than a drive letter if you want. This makes the drive appear as just another folder. You can mount drives only in empty folders on NTFS volumes.
    • Do not assign a drive letter or drive path, You can choose this option if you don’t want to assign a drive letter or drive path.


Image 3.13 New Simple Volume Wizard - Assign Drive Letter or Path



  • Next is Format Partition, select Format this volume with the following settings, you can use any partition format you like, but for this example choose NTFS. Also, click the checklist on Perform a quick format to speed up the process. Then click next.


Image 3.14 New Simple Volume Wizard - Format Partition



  • The last step is to click Finish


Image 3.15 New Simple Volume Wizard - Finish



  • After you have completed the format wizard and volume, check the Status column in the list of mounted disks to make sure that the new disk has a Healthy. Now the disk is ready to use.


Image 3.16 Disk Management



3.2.2 Formating & mounting a disk on Linux

  • On your Linux VM, to do this we need to be the root user and run the following command: fdisk -l, as we can see the new hard drive, 10GB, is assigned to the path /dev/vdb.


Image 3.17 VM Linux



  • After the new hard disk has been identified, the next step is partitioning, for this, we will use the following syntax:
fdisk /dev/vdb
  • Common fdisk parameter are:
    • n: Create a new partition.
    • P: Print the partition table.
    • d: Remove a partition.
    • q: It leaves without saving the change.
    • w: Save the changes and exit the command. With this in mind we will perform the following process once the fdisk /dev/vdb command has been executed: Enter the letter n to create the new partition. - Enter the letter p to define as a primary partition - Number 1 to establish a single partition of the new disk. - Establish the value of the first sector which is 2048 by default. - Establish the value of the last sector which is 20971519. - Save the changes using the letter w.


Image 3.18 VM Linux - Fdisk



  • We can see that the process is executed correctly. If we run fdisk -l we can look at the changes in the new disk (/dev/vdb).


Image 3.19 VM Linux - Fdisk - New Disk



  • Next step is to format the new hard drive with the desired file system using the command
mkfs.ext4 /dev/vdb1

(mkfs is make file system).


Image 3.20 VM Linux - MKFS



  • After that we need to create a new directory, in this tutorial we create a new directory called /data:
mkdir /data


Image 3.21 VM Linux - New Directory



  • Next step we mount the new disk in the desired location, in this tutorial we have created a new directory called /data. use command
mount /dev/vdb1/ /data


Image 3.22 VM Linux - Mount



  • If we want that partition to be mounted permanently, it will be necessary to edit the file /etc/fstab using the preferred editor and to enter the following line. We keep the change.
/dev/vdb1 /data ext4 default 0 0


Image 3.23 VM Linux - Mount Permanent




Image 3.24 VM Linux - Mount Permanent



  • After that, use df -h command to see mounted hard drive.


Image 3.25 VM Linux - df -h



×