How to partition, format and mount a volume
Log in as root to the VM the volume is attached to. To list the devices, type
fdisk -l
The result is similar to the one shown in the figure, where the name of the device we want to configure (in this example /dev/vdb
) is enlighted.
How to make a partition
How to format a device
How to mount a device
How to make a partition
To make a partition up to 2 TB large, type
fdisk <device-name>
replacing <device-name>
with the name of the device (in this example /dev/vdb
), and answer to the various questions as follows:
- answer n to make a new partition
- answer p to create a primary partition
- answer 1 to make only one partition (a higher number to create that number of partitions)
- other options can be set to default
- finally answer w to write the partition.
Type
fdisk -l
to check the name of the partition (in this example /dev/vdb1
).
How to format a device
To format the device, type
mkfs.ext4 <partition-name>
replacing <partition-name>
with your partition name (in this example /dev/vdb1
).
How to mount a device
To mount the device, create a directory as a mountpoint (in this example, /disk/vdb1)
mkdir -p /disk/vdb1
and mount the device on that directory
mount <partition-name> /disk/vdb1
replacing <partition-name>
with the name of the partition that has to be mounted (in this example /dev/vdb1
).
You can check your device has been correctly mounted by looking at all the mounted partitions:
mount