This topic uses an ECS instance running the Ubuntu operating system to show how to create a file system on a raw data disk. You can skip the steps to create a new partition, such as /dev/vdb1 or /dev/vdb2, and directly create a file system if no partition is required. This method is only applicable to ECS instances running a Linux operating system.


A cloud disk has been created and attached to an ECS instance. For more information, see Create a Pay-As-You-Go cloud disk and Attach a cloud disk.


  1. Remotely connect to an ECS instance as a root user. For more information, see Overview.
  2. Run the following command to view the name of the attached cloud disk.
    fdisk -l 
    If the following output is displayed, it indicates that the ECS instance has two cloud disks: /dev/vda as the system disk and /dev/vdb as a data disk.
  3. Create a file system for the /dev/vdb data disk. Example:
    • Create an ext4 file system
      mkfs.ext4 /dev/vdb
    • Create an ext3 file system
      mkfs.ext3 /dev/vdb
    • Create an xfs file system
      mkfs.xfs /dev/vdb
    • Create a btrfs file system
      mkfs.btrfs /dev/vdb
  4. Optional: Create a mount directory, such as /media/vdb.
    If this step is omitted, you can also attach the disk to an existing directory.
    mkdir /media/vdb
  5. Attach the disk to the mount directory.
    mount /dev/vdb /media/vdb
  6. Run the df command to view the data disk information.
    The mount directory information of the disk is displayed, indicating that the operation was successful.
    [root@ecshost ~]# df -h
    Filesystem Size Used Avail Use% Mounted on
    udev 3.9G 0 3.9G 0% /dev
    tmpfs 798M 2.9M 795M 1% /run
    /dev/vda1 40G 3.2G 35G 9% /
    tmpfs 3.9G 0 3.9G 0% /dev/shm
    tmpfs 5.0M 0 5.0G 0% /run/lock
    tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
    tmpfs 798M 0 798M 0% /run/user/0
    /dev/vdb 98G 61M 93G 1% /media/vdb