You need to enable JavaScript to run this app.
Elastic Compute Service

Elastic Compute Service

Copy page
Download PDF
Partitioning and formatting a volume
Creating a file system on a raw device
Copy page
Download PDF
Creating a file system on a raw device
This topic uses an ECS instance running CentOS 7.6 to illustrate how to create a file system on a raw device. If you do not need logical partitions (e.g., /dev/vdb1 or /dev/vdb2) for your volume, create a file system directly on the volume instead of partitioning it. Note that this operation only applies to Linux systems.​
Prerequisites​
  • Use e2fsprogs version 1.42 or later if your volume is 16 TiB or larger, or if you plan to expand it to that size. Errors will occur during formatting if the e2fsprogs package version is below 1.42. For more information, see How to upgrade e2fsprogs version.​
Steps​
  1. Run this command to find the name of the volume you want to manage.​
  • ​
    fdisk -l​
    ​
  • As shown in the output below, the instance has two attached volumes: the system volume, /dev/vda1, and the newly added data volume, /dev/vdb.​
  • ​image​​
  1. Run the mkfs -t <file system format> /dev/vdb command to create a file system directly on the raw device, /dev/vdb.​
  • Different file systems support different partition sizes. Select a file system that best meets your business needs. The following command sets the file system to xfs.​
  • ​
    mkfs -t xfs /dev/vdb​
    ​
warning​
Formatting takes time. Monitor the system status and do not exit.​
  1. Run the mkdir <mount point> command to create a mount point.​
  • The following command creates a mount point, /data.​
  • ​
    mkdir /data​
    ​
  1. Run the mount /dev/vdb <mount point> command to mount the volume to the newly created mount point.​
  • The following command mounts the volume to the mount point, /data.​
  • ​
    mount /dev/vdb /data​
    ​
  1. Run this command to verify the mount result.​
  • ​
    df -Th​
    ​
  • The output below shows the mount point corresponding to the volume, indicating that the mount was successful.​
  • ​
    Filesystem Type Size Used Avail Use% Mounted on​
    /dev/vda1 ext4 39G 1.7G 37G 5% /​
    devtmpfs devtmpfs 4.1G 0 4.1G 0% /dev​
    tmpfs tmpfs 4.2G 0 4.2G 0% /dev/shm​
    tmpfs tmpfs 4.2G 9.1M 4.1G 1% /run​
    tmpfs tmpfs 4.2G 0 4.2G 0% /sys/fs/cgroup​
    tmpfs tmpfs 821M 0 821M 0% /run/user/0​
    /dev/vdb xfs 21G 34M 20G 1% /data​
    ​
​
Last updated: 2026.04.29 14:25:50