PremiumCloud PremiumCloud Contact Us

Bulk Verified Personal Huawei Cloud Accounts Mount data disk on Huawei Cloud server

Huawei Cloud / 2026-04-26 15:59:08

Mount Data Disk on a Huawei Cloud Server: The “Please Don’t Break Production” Guide

So you’ve spun up a Huawei Cloud server, and now you want to mount an extra data disk. Good. More storage is always a thrilling decision—until it turns into the kind of thrilling where you stare at the terminal, whisper “why won’t you mount,” and contemplate your life choices.

Don’t worry. This guide walks you through mounting a data disk on a Huawei Cloud server in a clear, practical way. We’ll cover everything: identifying the disk, partitioning it, formatting it, mounting it, setting permissions, and making it persist after reboot. Along the way, we’ll also handle common issues so you don’t have to learn every lesson the hard way.

Assumptions: You have access to a Huawei Cloud ECS or similar compute instance running Linux. The “data disk” is already attached to the server in the cloud console. You know the disk is present but not yet mounted in the OS.

Before You Touch Anything: Quick Sanity Checks

1) Confirm the disk is attached

In the Huawei Cloud console, verify your data disk is attached to the instance. The OS side won’t guess your intent—if the disk isn’t attached, you’ll only get disappointed output.

2) Log in to the server

SSH into the instance using your usual method. Then switch to a user with sudo privileges.

Example (replace with your preferred login method):

ssh your-user@your-server-ip

Bulk Verified Personal Huawei Cloud Accounts Then:

sudo -i

3) Get a baseline of what disks you already have

Before adding the new disk, you might already have one or more disks. Let’s list block devices.

lsblk

Look for the system disk (often something like /dev/vda, /dev/sda, or similar) and note any existing partitions. Don’t worry if you don’t know which is which yet—we’ll identify the new disk in the next section.

Also check:

sudo fdisk -l

This prints details about disks and partitions. It can be verbose, but verbosity is a virtue when you’re trying not to mount the wrong thing.

Identify the New Data Disk (Without Accidentally Mounting Your OS)

This step is where most people either (a) succeed heroically or (b) mount something they shouldn’t and then wonder why the system feels “different.” Let’s avoid “b” by being deliberate.

1) Compare block devices

Run:

lsblk -o NAME,SIZE,TYPE,MOUNTPOINT

You’ll typically see disks and partitions. A data disk may appear as a block device with no mountpoint, such as:

NAME   SIZE TYPE MOUNTPOINT
vda    ... disk 
└─vda1  ... part /
vdb    ... disk 

In this example, /dev/vdb might be the new data disk. Yours may be named /dev/sdb, /dev/vdc, etc. The exact name depends on the server and virtualization setup.

2) Confirm with device details

Use:

sudo lsblk /dev/vdb

Or if you’re unsure about the name, use lsblk output and pick the device that:

  • Matches the size of the data disk you attached
  • Has no partitions (or has partitions but no mountpoint)
  • Is not your root/system disk

3) Check filesystem presence (optional but helpful)

If the disk was pre-formatted, you can check with:

sudo blkid /dev/vdb

If it prints something like UUID=... and a TYPE=ext4, it may already have a filesystem. If it prints nothing, you probably need to partition and format it.

Important: If you intend to format, double-check you’re using the correct device. Formatting is the system administrator equivalent of hitting “delete” and then immediately wondering where your photos went.

Partition the Disk (If Needed)

Not all workflows require partitioning. Some people format the whole disk directly. But partitioning is often clearer and safer for future growth.

1) Determine whether the disk already has partitions

Run:

lsblk /dev/vdb

If you see something like /dev/vdb1, the disk likely already has a partition. If not, you’ll need to create one.

2) Create a partition with fdisk

Let’s assume the disk is /dev/vdb and you want a single partition using the whole disk.

Start fdisk:

sudo fdisk /dev/vdb

Common interactive steps:

  • Press n for new partition
  • Choose p for primary (if prompted)
  • Use partition number 1 (usually default)
  • Accept default first sector
  • Accept default last sector (to use full disk)
  • Press w to write changes

fdisk will warn you (politely) before writing. That’s your cue to confirm again that this is indeed the correct device.

3) Re-read partition table

After partitioning, run:

sudo partprobe /dev/vdb

Or simply:

lsblk

You should now see something like /dev/vdb1.

Format the Partition (Choose a Filesystem)

Once the partition exists, you need a filesystem. The default and most common choice is ext4 for Linux servers.

1) Decide what filesystem you want

Common options:

  • ext4: Great default for Linux, stable and widely supported
  • xfs: Often used for large storage and good performance characteristics
  • ext3: Older, usually not necessary

This guide uses ext4.

2) Format the partition

Assume your new partition is /dev/vdb1. Format with:

sudo mkfs.ext4 -F /dev/vdb1

The -F forces formatting in some cases. If you’re already sure, it saves you from annoying prompts. If you prefer caution, remove -F and answer questions.

3) Verify the result

Check:

sudo blkid /dev/vdb1

You should see a UUID and TYPE="ext4".

Create a Mount Point

A mount point is just a directory where the filesystem will “appear.” Common patterns are /data, /mnt/data, or application-specific directories.

1) Create the directory

Let’s use /data as a mount point. First create it:

sudo mkdir -p /data

2) (Optional) Mount in a nested directory

Bulk Verified Personal Huawei Cloud Accounts If you want to be tidy (or you have multiple disks), you might prefer something like:

sudo mkdir -p /data/disk1

This can help when you later attach more disks and don’t want the directory to turn into a cluttered museum exhibit.

Mount the Disk (The Main Event)

1) Mount using mount command

Mount /dev/vdb1 to /data:

sudo mount /dev/vdb1 /data

No output means “success,” which is Linux’s love language.

2) Verify it mounted correctly

Check:

df -hT

You should see /data with filesystem type ext4.

Also confirm:

lsblk -f

Look for the mountpoint association.

3) Test write access

Create a small test file:

echo "hello data disk" | sudo tee /data/testfile.txt

Then list it:

ls -l /data/testfile.txt

Bulk Verified Personal Huawei Cloud Accounts If it’s there, the disk is mounted and writable. If not, we’ll troubleshoot in a later section.

Bulk Verified Personal Huawei Cloud Accounts Make the Mount Persistent Across Reboots (fstab)

Mounting manually is great—until you reboot and everything is gone, replaced by that special brand of silence known as “why isn’t my storage available.” Let’s prevent that.

1) Get the UUID of the partition

Using UUID is recommended because device names like /dev/vdb can change depending on boot order.

sudo blkid /dev/vdb1

You’ll see something like:

/dev/vdb1: UUID="abcd-1234" TYPE="ext4" ...

2) Edit /etc/fstab safely

Open fstab:

sudo nano /etc/fstab

Or use your preferred editor.

Add a line at the end. Example:

UUID=abcd-1234  /data  ext4  defaults,nofail  0  2

Let’s break down the fields:

  • UUID=...: Identifies the disk reliably
  • /data: Mount point
  • ext4: Filesystem type
  • defaults,nofail: Common options; nofail prevents boot failure if the disk isn’t ready
  • 0: Dump frequency (usually 0)
  • 2: fsck order (2 is common for non-root)

3) Test fstab changes

Before rebooting, validate the configuration:

sudo mount -a

If there are errors, you’ll learn about them immediately, without requiring a reboot. Systems love immediate feedback; it saves everyone’s sanity.

4) Confirm after mount -a

df -hT | grep /data

Permissions: So Your Apps Can Actually Use the Disk

Mounting the disk isn’t enough if your application expects certain ownership or permissions.

1) Check current ownership

Run:

ls -ld /data

The directory is just a mountpoint, but the filesystem itself has permissions too. Often you’ll see ownership like root:root.

2) Set permissions (example)

If you want a typical setup where a specific user (say appuser) owns the directory:

sudo chown -R appuser:appuser /data

If you prefer to allow broader access (be cautious with 777, unless your security team is feeling poetic):

sudo chmod -R 755 /data

Better: use a proper user/group strategy for your workloads.

Troubleshooting Common Problems

1) “mount: wrong fs type” or filesystem type mismatch

This happens when the fstab entry uses the wrong filesystem type. Check with:

sudo blkid /dev/vdb1

Verify TYPE. If it’s xfs, your fstab should say xfs instead of ext4.

2) Device not found after reboot

If you used /dev/vdb1 directly in fstab, it might change after reboot. Use UUID instead. If you already used UUID, then ensure the UUID is correct.

Also confirm your /data directory exists before mounting. With system boot, missing directories can cause errors. Use mkdir -p /data ahead of time.

3) “Permission denied” when writing files

Bulk Verified Personal Huawei Cloud Accounts Check ownership and permissions:

ls -l /data

Then adjust:

sudo chown -R youruser:yourgroup /data

4) Disk shows up, but mount fails with I/O errors

First check if the disk is healthy. Inspect kernel messages:

dmesg | tail -n 50

Look for errors related to the specific device. If you see repeated I/O failures, you may need to detach and reattach the disk in the cloud console or check the underlying storage status.

Bulk Verified Personal Huawei Cloud Accounts 5) The disk is already partitioned/formatted, but you formatted again

If you did this… congrats on learning a painful lesson early. In future, verify with:

sudo blkid /dev/vdb1

If it already has data, decide whether you need to mount it as-is instead of formatting.

Optional: Use a More “Professional” fstab Setup

If this server is important, you can add slightly more robust mount options.

1) Recommended pattern with UUID and nofail

Bulk Verified Personal Huawei Cloud Accounts For ext4:

UUID=abcd-1234  /data  ext4  defaults,nofail  0  2

For performance tuning, you might consider additional options (only if you know what you’re doing and you’ve tested). In many cases, defaults is perfectly adequate.

2) Add timeout to avoid boot delays

Some systems may wait for devices. While nofail reduces risk of boot failure, you can still tune behavior. This depends on distro and init system. Keep it simple unless your platform team has guidelines.

Optional: Verify Mount Persistence Like a Grown-Up

After updating fstab and running mount -a, you can do a reboot test. Before rebooting, maybe confirm what services depend on /data.

If you’re brave:

sudo reboot

After it comes back, confirm:

df -hT | grep /data

If /data shows up, you win. If not, you get to enjoy troubleshooting, but now at 2 AM. Try to avoid that.

Real-World Example: Mounting a Disk and Preparing It for an Application

Let’s imagine your goal is to store logs or application data on the mounted disk.

1) Mount and create an app directory

sudo mount /dev/vdb1 /data
sudo mkdir -p /data/myapp

2) Adjust ownership

sudo chown -R myapp:myapp /data/myapp

3) Test application write

sudo -u myapp touch /data/myapp/write_test.txt

If it works, you’ve turned a “disk problem” into a “storage is working” problem. Which is the kind of upgrade we all want.

FAQ: Quick Answers to Common Questions

Do I have to partition the disk?

No. You can format the whole disk directly (e.g., mkfs.ext4 /dev/vdb) if you want. But partitioning is usually cleaner for management and future resizing.

How do I know which device is correct?

Match the disk size from the cloud console with lsblk output. Also confirm by checking whether it has partitions or a filesystem already using blkid.

Can I mount an existing filesystem?

Yes. If blkid shows a filesystem type for /dev/vdb1, you can skip formatting and just mount it. Still, verify mountpoint and permissions.

What if I mounted the wrong disk?

Don’t panic. If nothing critical is harmed, you can unmount and remount correctly. Use:

sudo umount /data

Then mount the correct partition. But if you already formatted, data loss may have occurred—so verify before formatting in the first place.

Conclusion: You’ve Got a Mounted Disk, Not a Mounted Headache

Mounting a data disk on a Huawei Cloud server isn’t hard—especially when you follow a disciplined approach: identify the right device, partition if necessary, format with the appropriate filesystem, mount to a sensible directory, set permissions, and update /etc/fstab using UUID so it survives reboots.

Once you do it once, it becomes one of those boring-but-important admin tasks. Like changing a tire. Nobody cheers when you do it, but everyone appreciates it when the car doesn’t stop working.

If you want, tell me your device name (for example /dev/vdb), your Linux distro, and what lsblk shows. I can help you tailor the exact commands for your specific server—without playing roulette with your system disk.

TelegramContact Us
CS ID
@cloudcup
TelegramSupport
CS ID
@yanhuacloud