Select the initialization method according to your actual use cases:
If the entire disk is presented as one independent partition (there is no logical disks such as vdb1 and vdb2), we strongly recommend that you not use partition, and directly create the file system on bare devices. If the entire disk needs to be presented as multiple logical partitions (there are multiple logical disks), you need to first partition the disk, and then create the file system on a partition. Creating file systems on bare devices
Note:
This example uses a Lighthouse instance using CentOS 8.0 operating system. Note that the steps may vary according to the operating system version.
2. Run the following command to view the disk name.
If the returned result is similar to what is shown below, the current Lighthouse instance has two disks, where /dev/vda
is the system disk (40 GB) and /dev/vdb
is the new data disk (20 GB).
3. Run the following command to create a file system on the /dev/vdb
bare device.
sudo mkfs -t <File system format> /dev/vdb
The partition size supported by different file systems varies. Select an appropriate file system as needed. The following example takes EXT4
as the file system:
sudo mkfs -t ext4 /dev/vdb
Note:
The formatting takes a while. Please pay attention to the system’s running status and do not exit.
4. Run the following command to create a new mount point. The following example uses /data
as the new mount point:
5. Run the following command to mount the device to a new mount point. The following example uses /data
as the new mount point:
sudo mount /dev/vdb /data
6. Run the following command to view the mount result.
If the returned result is similar to what is shown below, /dev/vdb
is mounted to /data
successfully.
The disk needs to be mounted to the instance every time the instance starts up. To set the disk to be automatically mounted upon instance start-up, see Auto-Mounting Disk upon Linux Instance Start-up. Creating a file system on a partition
Note:
This example uses the parted partition tool in the CentOS 8.0 operating system to configure data disk /dev/vdc
as the primary partition. MBR is used as the default partition format, EXT4 format as the file system, and /data/newpart
as the mount point. Disk automount at startup is configured. Note that the formatting operation may vary according to the operating system.
2. Run the following command to view the disk name.
If the returned result is similar to what is shown below, the current Lighthouse instance has two disks, where /dev/vda
is the system disk (40 GB) and /dev/vdb
is the new data disk (20 GB).
3. Run the following command to enter the fdisk partition tool and start partitioning the new data disk. The following example uses /dev/vdb
as the newly attached data disk:
The returned information is similar to what is shown below:
4. Enter n and press Enter to start creating a partition. The following information is returned:
This indicates that the disk has two partition types: p: Primary partition.
e: Extended partition.
5. Take creating a primary partition as an example. Enter p
and press Enter to start creating a primary partition. The following information is returned:
Partition number indicates the number of the primary partition. Valid range: 1-4.
6. Take partition 1 as an example. Enter the primary partition number 1 and press Enter. The following information is returned:
First sector indicates the start sector. Valid range: 2048 (default value) - 41943039.
7. Take selecting the default start sector number 2048 as an example. Press Enter. The following information is returned:
Last sector indicates the end sector. Valid range: 2048 - 41943039 (default value).
8. Take selecting the default end sector number 41943039 as an example. Press Enter. The following information is returned:
9. The partitioning is complete. A new partition has been created on the 20 GB data disk.
10. Enter p and press Enter to view the details of the new partition /dev/vdb1
.
Note:
If an error occurs during the partitioning operation, enter q to exit the fdisk tool and the prior partition result will not be retained.
11. Enter w and press Enter to write the partition result to the partition table. The returned result is shown below, indicating that the partition creation is complete.
12. Run the following command to sync the partition table to the operating system.
13. Run the following command to set the file system of the new partition to the format required by the system.
sudo mkfs -t <File system format> /dev/vdb1
The partition size supported by different file systems varies. Select an appropriate file system as needed. The following example takes EXT4
as the file system:
sudo mkfs -t ext4 /dev/vdb1
Note:
The formatting takes a while. Please pay attention to the system’s running status and do not exit.
14. Run the following command to create a new mount point. The following example uses /data/newpart
as the new mount point:
15. Run the following command to mount the new partition to a new mount point. The following example uses /data/newpart
as the new mount point:
sudo mount /dev/vdb1 /data/newpart
16. Run the following command to view the mounting results.
The returned information is similar to what is shown below. This indicates that the partition /dev/vdb1
has been mounted to /data/newpart
.
The disk needs to be mounted to the instance every time the instance starts up. To set the disk partition to be automatically mounted upon instance start-up, see Auto-Mounting Disk upon Linux Instance Start-up. Note:
This example uses a Lighthouse instance using Windows Server 2016 R2 operating system. Note that the steps may vary according to the operating system version.
2. On the desktop, right-click in the lower-left corner and click Disk management in the pop-up menu.
Open the Disk management window to view the data disk information.
Note:
If the new disk is offline (as shown above), continue to Step 3 to make it online. If it’s already online, go to Step 4. 3. Right-click in the Disk 1 area
, and click Online.
4. Disk 1 changes from Offline to Not Initialized
. Right-click in the Disk 1 area and select Initialize Disk.
5. In the Initialize Disk window, select the target disk and the disk partition format, and click OK. In this example, MBR (Master Boot Record) is used.
Note:
If the disk partition format is changed after the disk is put into use, the original data on the disk will be erased. Please select an appropriate partition format based on actual needs.
6. Right-click the free space of Disk 1, and select New Simple Volume.
7. In the welcome page of New Simple Volume Wizard pop-up window, click Next.
8. Specify the volume size as needed, which is the maximum value by default. Click Next.
9. Assign a drive letter, and click Next.
10. Select Format this volume with the following settings. Configure the parameters as needed, format the new partition, and click Next.
11. Click Complete. Wait for a while for the system to complete the initialization. When the volume status becomes "Healthy", the disk initialization is successful.
After the initialization is complete, enter the PC interface to view the new disk.
Was this page helpful?