Huawei Cloud International Independent Account Huawei Cloud ECS attach data disk tutorial

Huawei Cloud / 2026-05-15 14:38:33

Huawei Cloud ECS attach data disk tutorial

Huawei Cloud International Independent Account Attaching a data disk to an ECS instance on Huawei Cloud sounds like one of those tasks that’s either “super easy” or “why is nothing working?” depending on how prepared you are. The truth is: it’s usually straightforward, and the failures are almost always predictable. Most of them come from one of three culprits: the disk isn’t in the right state, you attached it to the wrong ECS, or you forgot that the OS still needs formatting and mounting after the cloud side is done. In other words: the console can attach the disk all day, but your operating system won’t automatically start using it just because it showed up like an uninvited guest.

This tutorial walks you through the full journey: prerequisites, attaching via Huawei Cloud console, preparing the disk inside Linux, validating the result, and handling common issues. I’ll keep the steps clear and realistic, not magical. Think of it as a guide written by someone who has absolutely stared at a “Disk attach failed” message long enough to develop opinions about fate.

What you’ll accomplish

By the end of this tutorial, you should be able to:

  • Confirm you have the right resources (an ECS instance and a compatible data disk).
  • Attach a data disk to your ECS instance using the Huawei Cloud console.
  • Log into the ECS and detect the new block device.
  • Partition (optional but common), format, and mount the disk.
  • Verify the mount and ensure it persists after reboot.
  • Troubleshoot the usual problems without panic.

Prerequisites before you touch the “Attach” button

Before you start clicking, gather these essentials. Not because we love checklists, but because storage is like that one friend who always asks for your wallet before leaving the house.

1) Confirm disk type and region/availability zone compatibility

In cloud land, disks and compute instances generally need to be in compatible locations. Your ECS instance and data disk should belong to the same region and should satisfy the same availability zone constraints (depending on configuration). If your disk and ECS don’t match, you may still see the disk in your inventory, but attachment will fail or won’t behave correctly.

Best practice: open both the ECS page and the disk page and verify:

  • Region
  • Availability zone (AZ)
  • Project/tenant context (so you aren’t mixing resources across boundaries)

2) Understand what “attaching” means vs. “using” the disk

Attaching in the cloud console typically means the block device is presented to the ECS hypervisor/guest. That’s step one. Step two is inside your operating system: partitioning, formatting, and mounting. Without step two, your disk is just sitting there, silently waiting for you to give it a job description.

3) Backup and data safety

If the disk is new, formatting is straightforward. If it’s an existing disk with data, be careful. Formatting can erase data. If you attach a disk that already contains a filesystem, you might only need mounting. Before formatting, always check whether the disk already has partitions or a filesystem.

4) Have permissions to attach disks

Make sure your account (or IAM role) has permission to attach storage to ECS. If you get permission errors, the console will not turn into a magical supportive oracle. It will just tell you “no.” So double-check access rights early.

Step 1: Create or locate your data disk

You can attach either a newly created data disk or a pre-existing one. For the tutorial, assume you have already created (or can create) an Elastic Volume / data disk in Huawei Cloud.

Creating a new data disk (optional)

If you don’t have a disk yet:

  • Go to Huawei Cloud Console
  • Navigate to Storage/ECS-related disk management (exact menu naming can vary)
  • Create a new data disk
  • Choose disk size and performance characteristics
  • Make sure it’s in the same region/AZ as your target ECS

When the disk is created, it usually starts unattached and in an available state. That’s what you want before attachment.

Locating an existing disk

If you already have a disk, open its details page and note:

  • Disk ID
  • Current attachment state (should be “available”/unattached)
  • Size
  • Type (SSD/SAS/whatever your setup uses)

Keep the Disk ID handy. You’ll likely need it during attach.

Step 2: Attach the data disk to your ECS instance (Huawei Cloud console)

Now for the part that feels like the “official” operation: attaching the disk to the ECS instance through the console.

1) Go to your ECS instance

Open the ECS section of the console and select the specific instance you want to attach to. You should see details like the instance ID, network settings, OS information, and storage-related tabs or sections.

2) Find the storage attachment option

Depending on UI version, you might see something like:

  • Disks
  • Storage
  • Block devices
  • Additional disks / Data disks

Look for an action button such as “Attach Disk” or “Add Data Disk.” If you’re not seeing it, double-check you’re in the correct instance page, not a general compute dashboard.

3) Choose the disk to attach

When you click attach/add:

  • Select the disk you want to attach (by Disk ID or by checking it from the list)
  • Confirm any required parameters (for example, device name mapping options if available)

Some consoles let you select a target device path (like /dev/vdb or /dev/sdb) or an attachment mode. If you don’t see that, don’t worry. You can still identify the device later inside Linux using discovery commands.

4) Attach and wait for completion

Huawei Cloud International Independent Account Submit the attach request and monitor the task status. Usually you’ll see states like “in progress,” “successful,” or an error reason.

If it fails, don’t assume it’s you being cursed personally. Usually it’s something like:

  • Disk is already attached to another ECS
  • Disk is in an invalid state (not “available”)
  • Disk and ECS mismatch in region/AZ
  • Insufficient permissions

Fix the cause and try again.

Step 3: Confirm the disk is visible inside the operating system

Once the console attachment says success, log into your ECS.

1) Log into your ECS

Use SSH (for Linux) or the appropriate remote console (for Windows). This tutorial focuses on Linux because most “how do I mount it?” questions live there, and also because Linux is like an overachieving intern: it will tell you exactly what it’s doing if you ask the right commands.

2) Find the new block device

Common commands to discover storage include:

  • lsblk
  • Huawei Cloud International Independent Account fdisk -l
  • blkid
  • dmesg | tail

Run:

lsblk

You should see new entries for block devices. The system disk usually appears as something like /dev/vda or /dev/sda, while the attached data disk might appear as /dev/vdb, /dev/vdc, etc. The exact device letter varies.

Also check:

sudo fdisk -l

If the disk is new and unpartitioned, fdisk might show it without any partitions. That’s normal. It’s not “broken”; it’s just undecided about its purpose.

3) Identify which device is your attached disk

To avoid mounting the wrong disk (a classic way to accidentally create a data disaster), verify size. For example:

  • Use lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
  • Compare the size of the new device to what you expect from the disk details page

Example command:

lsblk -o NAME,SIZE,TYPE,MOUNTPOINT

Once you’re confident about the device, move on.

Step 4: Partition and format the disk (Linux)

This is the part where your disk transforms from “a mysterious lump of nothing” into “a reliable storage location.”

Case A: The disk is new and unpartitioned

If lsblk shows the disk with no partitions (for example, /dev/vdb only, not /dev/vdb1), you’ll need to create a partition table and a partition.

You can do partitioning using fdisk (common) or parted. Here’s a practical fdisk approach.

1) Create a partition using fdisk

Assume your disk is /dev/vdb. Replace with your actual device:

sudo fdisk /dev/vdb

Then, within fdisk, typical steps are:

  • Press n to create a new partition
  • Choose primary partition (often option 1)
  • Accept default partition number
  • Accept the default start/end to use the full disk (or adjust if you prefer a smaller partition)
  • Press w to write changes

If the disk is blank, this will create something like /dev/vdb1.

2) Format the partition

Pick a filesystem. Most people use ext4 for Linux because it’s stable and boring in a good way.

Format:

sudo mkfs.ext4 /dev/vdb1

If you want XFS instead, use:

sudo mkfs.xfs /dev/vdb1

Formatting takes a moment depending on disk size.

Case B: The disk already contains data or partitions

If lsblk shows partitions already (for example /dev/vdb1 exists), check if a filesystem is present:

sudo blkid /dev/vdb1

If you see a TYPE like ext4 or xfs, the filesystem likely exists. In that case, you may only need to mount it. Don’t run mkfs unless you explicitly intend to wipe the disk.

Step 5: Mount the disk

Huawei Cloud International Independent Account Formatting alone doesn’t make it accessible. You still need a mount point and a mount command.

Huawei Cloud International Independent Account 1) Create a directory for the mount point

Example:

sudo mkdir -p /mnt/data

2) Mount the filesystem

Mount your partition (replace with your actual partition path):

sudo mount /dev/vdb1 /mnt/data

3) Verify it’s mounted

Run:

df -h

You should see /mnt/data and the expected size.

Also check:

mount | grep /mnt/data

Step 6: Make the mount persistent after reboot

If you reboot now, the mount will usually disappear unless you configure persistence. To do that, you can update /etc/fstab. The safest approach is to use UUIDs (so it stays correct even if device letters change).

1) Get the UUID

sudo blkid /dev/vdb1

Copy the UUID value.

2) Edit /etc/fstab

Open fstab:

sudo nano /etc/fstab

Add a line at the end similar to:

UUID=your-uuid-here  /mnt/data  ext4  defaults,nofail  0  2

Use ext4 or xfs based on your filesystem type. If you use XFS, replace ext4 with xfs.

The nofail option is helpful: it prevents boot failure if the disk is temporarily unavailable. However, it can also hide problems. If you’re 100% sure the disk will always be present, you might omit nofail.

3) Test fstab configuration

Run:

sudo mount -a

If there’s a problem, mount -a will complain and save you from a reboot roulette game.

Step 7: Optional checks for peace of mind

Now that the disk is mounted, you’ll want to confirm it behaves like a proper storage device.

1) Create a test file

sudo touch /mnt/data/testfile

And verify:

ls -l /mnt/data/testfile

2) Check performance basics (optional)

You can run a simple throughput test with dd if you want. Keep it short to avoid wasting time and patience.

sudo dd if=/dev/zero of=/mnt/data/testblock bs=1M count=256 status=progress

Then remove the file:

sudo rm -f /mnt/data/testblock

Not required for most setups, but it’s nice for troubleshooting “is the disk actually writable?” moments.

Common mistakes (and how to avoid them)

These are the classic ones that cause attachment or mounting to fail. If you recognize yourself in these, congratulations: you’re learning. If you don’t, also congratulations: you’re learning faster than me.

Mistake 1: Attaching the disk but never mounting it

Symptom: You can see the disk in the console, but in Linux there’s no new usable directory. The fix: partition/format/mount inside the OS.

Mistake 2: Formatting the wrong device

Symptom: Existing data disappears or system becomes unstable. The fix: confirm device name and size before running mkfs.

Pro tip: don’t rely on “it’s probably /dev/vdb.” Verify size via lsblk.

Mistake 3: Mixing filesystem type in fstab

Symptom: mount -a fails, or the filesystem doesn’t mount after reboot. The fix: use the correct filesystem type (ext4 vs xfs) in /etc/fstab.

Mistake 4: /etc/fstab typo

Symptom: boot issues or mount -a errors. The fix: double-check spacing and fields. A small typo can derail your whole day.

Mistake 5: Disk not in the correct state for attachment

Symptom: console attachment fails with an error. The fix: ensure the disk is “available/unattached” and in the correct AZ/region.

Troubleshooting guide

Let’s handle the most common “it’s attached but I can’t see it” and “mount won’t work” issues.

Problem: The disk is attached in the console, but lsblk doesn’t show it

Try these checks:

  • Restart the instance and re-check lsblk (if appropriate in your environment).
  • Check dmesg for new device messages:
sudo dmesg | tail -n 50

If you see kernel messages mentioning a new SCSI device or block device, then the disk is likely present but maybe not yet partitioned.

  • Check SCSI devices:
ls -l /dev/disk/by-id/

Sometimes /dev/vdb isn’t the best label to trust. The by-id paths can be more stable for identification.

Problem: mount fails with “wrong fs type”

This usually happens when you formatted with one filesystem but /etc/fstab references another, or when the disk actually contains something else.

Fix:

  • Run blkid on the partition to confirm TYPE.
  • Huawei Cloud International Independent Account Update /etc/fstab accordingly.

Problem: Disk is read-only

If the filesystem is damaged or mounted incorrectly, you might end up read-only. Check dmesg:

sudo dmesg | tail -n 100

For ext4, you can run fsck if needed (be careful and usually unmount before repairs):

sudo umount /mnt/data
sudo fsck.ext4 -f /dev/vdb1

Then mount again.

Problem: You attached the disk but don’t know which device it is

Do the “before/after” method if you can. But since you may already attached it, you can use device discovery differences.

Run:

lsblk

Then compare to what it looked like previously (if you logged it) or compare disk sizes. If you know the new disk size from the console, match it.

You can also use:

sudo fdisk -l

Look for the device with the matching size and blank/partition state.

Attachment strategy: hot vs. reboot workflows (practical guidance)

Some cloud environments allow attaching disks without reboot; others may recommend or require a restart for stable device discovery. If you don’t see the disk after attachment, a reboot often resolves detection and rescans storage. That said, you should consider your workload stability and maintenance window. You don’t want to reboot a production instance just because you’re impatient; that’s how incidents are born.

As a practical flow:

  • Huawei Cloud International Independent Account Try attaching and immediately check lsblk.
  • If not visible, check dmesg.
  • If still not visible, reboot (if allowed) or ask your operations team whether a rescan is preferred.

Quick checklist (use this like a seatbelt)

  • Disk and ECS are in the same region/AZ compatibility.
  • Huawei Cloud International Independent Account Disk is unattached and in an “available” state.
  • Console attachment shows success.
  • Inside Linux, lsblk shows the new device.
  • If new: partition and format (ext4/xfs).
  • Create mount point and mount.
  • Update /etc/fstab using UUID.
  • Run mount -a to validate.
  • Create a test file to confirm write access.

Wrap-up: you now own your storage

At the beginning of this tutorial, the disk is just a cloud resource waiting for purpose. After attaching, it appears to the instance. After partitioning and formatting, it becomes a usable filesystem. After mounting and fstab updates, it becomes a stable part of your server life cycle, surviving reboots like it actually intends to stay.

If you follow the steps in order and verify disk identity by size and UUIDs, you’ll avoid most “why is this so hard” moments. And if something still goes wrong, you now have a troubleshooting map instead of a vibe.

If you want, tell me your setup (Linux distro, disk type, and whether the disk already has data). I can tailor the exact commands and device identification approach so you don’t have to guess whether your disk is /dev/vdb, /dev/vdc, or that one sneaky device that always shows up late to meetings.

TelegramContact Us
CS ID
@cloudcup
TelegramSupport
CS ID
@yanhuacloud