Alibaba Cloud payment methods Alibaba Cloud Server Data Disk Mounting Tutorial on Linux
Alibaba Cloud Server Data Disk Mounting Tutorial on Linux
So you've got yourself an Alibaba Cloud server, and, somewhere along the way, someone mentioned the magical phrase "additional data disks". Suddenly, you're staring at your screen wondering, "How do I attach a new data disk and make it ready for action?" Well, worry no more. This tutorial is your trusty sidekick, guiding you through attaching, formatting, and mounting a data disk on your Linux server. Buckle up, because by the end, you'll be mounting disks like a pro—and maybe even doing it in your sleep!
Prerequisites
What You Need
- An Alibaba Cloud ECS Linux server (Ubuntu, CentOS, or any other flavor)
- Administrator (root) access to the server
- Basic knowledge of Linux command line
- Having your Alibaba Cloud console open, where you can manage disks
Note Before We Start
This process involves attaching and configuring disks, so make sure you're prepared for the possibility of data loss if you're working with existing data. Always back up important files first! Now, with caution and a splash of humor, let’s dive in.
Step 1: Attaching a Data Disk to Your Alibaba Cloud ECS Instance
1. Log into Alibaba Cloud Console
Navigate over to your Alibaba Cloud Console, like a boss. Find the Elastic Compute Service (ECS) dashboard — your digital fortress.
2. Select Your Instance
Pick the server you're working on. Don't get distracted—your disk isn't going anywhere!
3. Add a New Data Disk
- Go to "Disks" under your server's management panel.
- Click "Create Disk"—think of this as summoning new storage from the cloud abyss.
- Choose the size and type (SSD is usually faster, HDD cheaper).
- Link it to your ECS instance and confirm your choices.
Voilà! Your new disk is now attached to your server, ready for configuration.
Step 2: Confirming the Disk is Recognized by Linux
1. SSH into Your Server
ssh user@your-server-ip
2. List All Disks
Run:
lsblk
This command lists all block devices. Your new disk will probably show up as /dev/vdX or /dev/nvmeXnY.
3. Double-Check
If you see your new disk, congrats! If not, give your server a moment or a gentle reboot, and try again.
Step 3: Prepare the Disk – Partitioning, Formatting, and Labeling
1. Creating a New Partition
Use fdisk for traditional MBR disks or gdisk for GPT. Here’s the classic fdisk trick:
sudo fdisk /dev/vdX
Follow the prompts to create a new primary partition. Don’t get intimidated; it’s like a choose-your-own-adventure with disk sectors.
2. Format the Partition
Choose your flavor of filesystem—ext4 is the default and often the most compatible:
sudo mkfs.ext4 /dev/vdX1
3. Creating a Mount Point
Create a directory where your disk lives:
sudo mkdir /mnt/data_disk
4. Mount the Disk
sudo mount /dev/vdX1 /mnt/data_disk
5. Set Automatic Mounting at Boot
Edit /etc/fstab by adding the line:
/dev/vdX1 /mnt/data_disk ext4 defaults,nofail 0 2
This way, your disk will wake up and greet you after every server reboot, like an eager puppy.
Step 4: Verify Everything Is Working
Alibaba Cloud payment methods Check Mounted Disks
df -h
You should see your new disk listed with its size and mounting point. If it's there, treat yourself to a pat on the back!
Test Write Permissions
sudo chown $(whoami):$(whoami) /mnt/data_disk
echo "Hello, Alibaba!" > /mnt/data_disk/test.txt
If the message saves without hitch, you're golden.
Extra Tips & Troubleshooting
Common Issues
- If your disk isn’t showing up in lsblk, double-check your attachment process in Alibaba Cloud console.
- If formatting seems to fail, ensure the partition isn't mounted elsewhere.
- Stuck at fstab? Check syntax errors and device names.
Alibaba Cloud payment methods Cleaning Up
Want to detach or reformat? Always unmount first:
sudo umount /mnt/data_disk
Conclusion
Mounting a data disk on Alibaba Cloud Linux is not as scary as a horror movie—it's more like assembling IKEA furniture: a bit confusing at first but ultimately satisfying when you see the final result. With these steps, your server's workspace just got a whole lot bigger and better prepared for your burgeoning data empire. So go forth, add disks, and conquer the cloud!

