Cloud Service Cloud Service Contact Us

Tencent Cloud Multi-Account KYC Solutions How to Mount and Resize Disk on Tencent Cloud Linux

Tencent Cloud / 2026-05-14 21:59:56

Before You Start: The “Don’t Set Your Server on Fire” Checklist

So you’ve got a new disk in Tencent Cloud, and now you want it mounted and resized like a responsible adult. Great. Let’s begin with a quick pre-flight checklist because the internet is full of stories that start with, “It looked like the right device…” and end with a long silence.

In Linux, you’re usually dealing with three layers:

  • The block device (like /dev/vdb, /dev/xvdf, etc.) which represents the raw disk space.
  • The partition and/or filesystem (like ext4, xfs, etc.) which organizes the space for your files.
  • Mounting which attaches that filesystem to a directory in your current Linux tree (like /data).

Tencent Cloud Multi-Account KYC Solutions When resizing, you may expand the disk size in Tencent Cloud, then expand the partition (if any), and finally expand the filesystem so Linux can actually use the new space.

Throughout this article, we’ll use a cautious approach: we’ll verify devices, we’ll double-check before formatting, and we’ll confirm the results. Your disks deserve this respect.

What You’ll Need

To follow along, you should have:

  • A Tencent Cloud Linux instance (CentOS, Ubuntu, Debian, etc.).
  • Tencent Cloud Multi-Account KYC Solutions Permissions to run commands as root or via sudo.
  • A new block storage disk already attached in Tencent Cloud (or an existing disk whose size you plan to increase).

If you’re not sure what distro you’re on, run:

cat /etc/os-release

Tencent Cloud Multi-Account KYC Solutions Step 1: Identify the Disk Device You Actually Want

First, let’s find out which device corresponds to your extra disk. Sometimes the device name is obvious (/dev/vdb), and sometimes it’s more like a plot twist. Let’s investigate safely.

List block devices

Run:

lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS

This shows a table of your storage devices. You’re looking for the new disk that:

  • Tencent Cloud Multi-Account KYC Solutions Is of type disk (not a partition).
  • Likely has no FSTYPE and no MOUNTPOINTS yet.

Use dmesg as a detective

If you just attached a disk recently, logs can help. Run:

dmesg | tail -n 50

Look for lines mentioning a new device like vdb, xvdf, or similar. It’s not perfect, but it’s like listening for the sound of a toolbox being dropped in the next room.

Confirm using /dev names

Another helpful command:

sudo fdisk -l

This will list disks and partitions. Make sure you correctly identify the target disk. If you see multiple “disks,” you’re not crazy—Linux just enjoys giving you options.

Step 2: Decide Whether You Need a Partition or Can Use the Whole Disk

Before formatting, you should decide: will you use the whole disk as a single filesystem, or will you create a partition and format that partition?

For most straightforward setups, creating a single partition is common and clean. For example:

  • Whole disk: format /dev/vdb
  • Single partition: format /dev/vdb1

If your resizing plan involves future changes, partitions can be easier to manage. But don’t create partitions if you’re unsure—just follow the steps carefully.

If this is a brand-new disk, it’s usually easiest to create a single partition.

Step 3: (If Needed) Create a Partition

If your disk already has partitions and a filesystem, you may skip this step. But if it’s blank (no partitions), you’ll need to create one.

Example: create a single partition using fdisk

Let’s assume the disk is /dev/vdb. Start fdisk:

sudo fdisk /dev/vdb

Now inside fdisk, you’ll typically do the following:

  • Type n to create a new partition
  • Choose p for primary partition
  • Tencent Cloud Multi-Account KYC Solutions Accept the default partition number (usually 1)
  • Accept the default first sector
  • For last sector, accept the default to use the full disk
  • Type w to write changes and exit

Afterward, confirm:

lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS /dev/vdb

You should now see /dev/vdb1 (or similar).

Important warning (with love)

If you format the wrong device, you can erase data. That’s not a “learning experience,” that’s a “why is my server weeping” experience. Double-check the device name before proceeding.

Step 4: Format the Disk (Choose a Filesystem)

Common Linux filesystems include:

  • ext4 (very common, reliable, great for general use)
  • xfs (also excellent, often used for larger systems; resizing is a bit different)

If you’re unsure, ext4 is a safe default for many cases.

Format using ext4

Tencent Cloud Multi-Account KYC Solutions Assuming your partition is /dev/vdb1:

sudo mkfs.ext4 -F /dev/vdb1

The -F forces formatting without prompting. Use it confidently only when you’re sure you’ve picked the right device.

Create a mount point

Let’s mount it to /data:

sudo mkdir -p /data

Mount the filesystem

Now mount it:

sudo mount /dev/vdb1 /data

Verify:

df -hT /data

You should see your filesystem type and size.

Step 5: Make the Mount Persistent Across Reboots

Mounting once is cute. Rebooting is inevitable. Let’s make sure Linux mounts the disk automatically after restart.

Find the UUID

Use:

sudo blkid /dev/vdb1

You’ll see something like:

UUID="xxxx-xxxx"

Edit /etc/fstab safely

Edit with your preferred editor, for example using nano:

sudo nano /etc/fstab

Add a line like this (replace UUID):

UUID=xxxx-xxxx /data ext4 defaults,nofail 0 2

Notes:

  • defaults includes typical mount options.
  • nofail prevents the boot from failing if the disk is missing.
  • The last two numbers are dump and fsck order. Often 0 and 2 for non-root filesystems.

Test fstab without rebooting

Run:

sudo mount -a

If there are no errors, you’re golden. If it complains, read the error message carefully (it’s usually trying to be helpful, just with sarcasm).

Step 6: Resize the Disk on Tencent Cloud

Now the disk is mounted and working. Great. Then Tencent Cloud asks: “Would you like to increase the size?” You probably said yes, because storage always gets eaten by logs, containers, models, and that one folder you forgot existed.

In the Tencent Cloud console, find your instance’s attached storage and increase its size.

After resizing in the cloud, your operating system needs to notice the new capacity. This may happen automatically, but sometimes you should rescan devices.

Step 7: Rescan the Disk in Linux

Try:

sudo lsblk

If you don’t see the updated size, you may need a rescan. Depending on your environment, you can try:

  • On some systems with scsi-style devices: sudo rescan-scsi-bus (may require additional setup)
  • Tencent Cloud Multi-Account KYC Solutions For many cloud environments, a simple reboot works too (not always ideal, but practical)

Often, lsblk will show the updated disk size after a moment. If it doesn’t, don’t panic—verify the exact device name you’re using.

Step 8: Check Current Partition and Filesystem Size

Before resizing anything, check:

lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS

Compare:

  • The disk size (e.g., vdb)
  • The partition size (e.g., vdb1)
  • The filesystem size as mounted (using df -hT)

You typically encounter a situation like:

  • Tencent Cloud Multi-Account KYC Solutions The disk size has increased in the cloud.
  • The partition still ends at the old boundary.
  • The filesystem still shows old size.

That’s normal. Resizing is a chain reaction: disk → partition → filesystem.

Step 9: Grow the Partition (if Necessary)

If your partition already spans the entire disk, you might not need to modify it. But if it’s stuck at the old size, you’ll need to expand it.

Using growpart (if available)

Some distros have a tool called growpart. Try:

growpart --help

If it exists, and your disk is /dev/vdb with partition 1 (/dev/vdb1), run:

sudo growpart /dev/vdb 1

Then confirm with:

lsblk

If growpart isn’t available: use parted

Install parted if needed (example for Debian/Ubuntu):

sudo apt-get update && sudo apt-get install -y parted

Then use parted in script mode or interactive mode. Interactive example:

sudo parted /dev/vdb

Inside parted, you might:

  • Check partition table: print
  • Resize partition: resizepart 1 100% (use the correct partition number)
  • Write changes: quit (usually writes automatically, but follow tool output)

After that, check again with lsblk.

Step 10: Resize the Filesystem

Now the partition should be larger. But Linux still needs to expand the filesystem inside it so it can actually store data in the new space.

The exact command depends on the filesystem type.

If your filesystem is ext4

Use:

sudo resize2fs /dev/vdb1

This can often be done while mounted, but it depends on the situation. If you get errors, check whether the device is mounted and whether the filesystem is ext4.

Verify the new size:

df -hT /data

If your filesystem is XFS

For XFS, you typically run:

sudo xfs_growfs /data

Notice that you pass the mount point, not the device. Because XFS is stylish like that.

Then verify:

df -hT /data

Step 11: Confirm Everything Works and Looks Sensible

Resize success is not just about the numbers changing. It’s about your mount still being correct and your system behaving like it remembers the disk exists.

Verify mount status

mount | grep /data

Verify filesystem integrity (optional but wise)

You can run a check, though some checks may require unmounting or special options. For ext4, you could consider:

sudo e2fsck -f /dev/vdb1

But only do this when you understand whether your filesystem is mounted and safe to check. For a production system, this may be scheduled rather than done casually in the moment.

For most cases, verifying df and basic IO is enough.

Troubleshooting: When Things Don’t Resize Like They Should

Let’s address the classic problems.

Problem: /dev/vdb1 doesn’t exist

You might have chosen the wrong disk name, or the disk has no partition. Re-check with:

lsblk

Then decide whether you need to create a partition, or format the whole disk. If it’s empty, formatting will create filesystem boundaries.

Problem: The disk grew, but df still shows old size

That usually means you expanded the disk in Tencent Cloud but not yet:

  • the partition, or
  • the filesystem.

Check:

lsblk and df -hT

If vdb1 is still the old size, resize the partition. If vdb1 is larger but filesystem is still old, run resize2fs (ext4) or xfs_growfs (xfs).

Problem: mount fails after edits to /etc/fstab

First, undo by commenting the line or adjust it with correct UUID and filesystem type.

Then test with:

sudo mount -a

If it fails, the error message will usually point out what’s wrong: wrong UUID, wrong fstype, or directory mismatch.

Problem: You formatted the disk, but performance seems weird

Usually it’s not a filesystem issue; it’s more about workload and caching. Still, ensure you didn’t accidentally mount with a weird option, and check if you used barrier or other settings. For most cases, defaults are fine.

If you’re installing a database, consider vendor-recommended settings. Databases are like toddlers: they won’t care about your command-line feelings, only your configuration.

Common “Good Practices” (So You Don’t Repeat Pain)

Here are a few habits that make disk work less chaotic:

  • Use UUID in /etc/fstab instead of device names like /dev/vdb1. Device naming can shift across reboots in some scenarios.
  • Keep a note of what’s mounted where. A quick document or a simple table saves you from “mystery mounts” later.
  • Resize in the correct order: cloud disk size → partition → filesystem → verify with df.
  • Don’t format unless you’re sure. If the disk has anything on it, ask questions first.
  • Verify file writing after mounting. A simple test like writing a small file to /data can confirm everything is truly functional.

You can do a quick test:

Tencent Cloud Multi-Account KYC Solutions echo "disk test" | sudo tee /data/disk_test_$(date +%F)

Putting It All Together: A Practical Example Flow

Let’s summarize the typical flow as a checklist-like narrative.

1) Identify device

Run:

lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS

Suppose you see an empty /dev/vdb and want to mount it as /data.

2) Create partition

Create /dev/vdb1 (using fdisk or parted).

3) Format

Format:

sudo mkfs.ext4 -F /dev/vdb1

4) Mount

Create mount point and mount:

sudo mkdir -p /data

sudo mount /dev/vdb1 /data

Verify with:

df -hT /data

5) Persist

Add UUID to /etc/fstab, then run:

sudo mount -a

6) Resize in cloud

Increase disk size in Tencent Cloud console.

7) Rescan/confirm new disk size

Run:

lsblk

8) Grow partition

Use growpart or parted to expand vdb1 to fill the disk.

9) Grow filesystem

For ext4:

sudo resize2fs /dev/vdb1

For xfs:

sudo xfs_growfs /data

10) Verify

Confirm with:

df -hT /data

Quick Command Reference (No Drama, Just Commands)

Here’s a compact reference you can keep nearby like a seatbelt manual:

  • List devices: lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
  • Partition listing: sudo fdisk -l
  • Tencent Cloud Multi-Account KYC Solutions Format ext4: sudo mkfs.ext4 -F /dev/vdb1
  • Mount: sudo mount /dev/vdb1 /data
  • UUID: sudo blkid /dev/vdb1
  • Test fstab: sudo mount -a
  • Grow ext4 filesystem: sudo resize2fs /dev/vdb1
  • Grow xfs filesystem: sudo xfs_growfs /data

Final Words: Your Disk Is Now a Proper Citizen

If you followed the steps, your disk should be mounted at your chosen path (like /data), persistent across reboots, and resized properly so the extra capacity isn’t just sitting there looking lonely.

Remember: disk resizing is a three-act play. Act one is the cloud resizing the disk. Act two is Linux resizing the partition. Act three is the filesystem finally realizing it can grow up and use the space. If any act is missing, you get a disappointing ending where the numbers don’t change and you start questioning your life choices. But with this guide, you’ll mostly avoid that.

If you want, tell me your distro (Ubuntu/CentOS/etc.), filesystem type (ext4 or xfs), and the device names you see in lsblk. I can help you tailor the exact commands without guessing wildly like a magician in a blackout.

TelegramContact Us
CS ID
@cloudcup
TelegramSupport
CS ID
@yanhuacloud