How to Attach and Mount Volumes on Linux Cloud Servers

  • Last Created On Sep 26, 2025
  • 36
0 0



Cloud servers often use block storage volumes (EBS in AWS, Managed Disks in Azure, Cinder volumes in OpenStack) for additional storage. Knowing how to attach, format, and mount these volumes is critical for scaling storage and managing persistent data.

This guide will cover:
✅ Attaching volumes in the cloud
✅ Detecting and formatting new volumes
✅ Mounting manually and auto-mounting on boot
✅ Best practices for cloud deployments


🔍 Step 1: Attach the Volume from Cloud Console

  • AWS EC2: Attach an EBS volume via EC2 Console → “Attach Volume” → select instance.

  • Azure VM: Attach a Managed Disk via Azure Portal → “Attach existing disk”.

  • OpenStack: Use Horizon → Volumes → “Attach to Instance”.

Once attached, reboot is usually not required, but some cloud providers require rescans for new devices.


💡 Step 2: Detect the Volume in Linux

SSH into your instance and check new disks:

lsblk

Example output:

xvda   8:0    0   20G  0 disk
└─xvda1 8:1   0   20G  0 part /
xvdf   202:0  0   50G  0 disk

Here, xvdf is the newly attached volume.


🛠️ Step 3: Format the Volume

If it’s a new volume, create a filesystem (example with ext4):

sudo mkfs -t ext4 /dev/xvdf

Check the filesystem:

sudo file -s /dev/xvdf

💾 Step 4: Create a Mount Point & Mount

1️⃣ Create mount directory:

sudo mkdir -p /mnt/data

2️⃣ Mount volume:

sudo mount /dev/xvdf /mnt/data

3️⃣ Verify:

df -h

🔄 Step 5: Auto-Mount on Reboot

1️⃣ Get UUID of the volume:

blkid /dev/xvdf

2️⃣ Edit /etc/fstab:

UUID=xxxx-xxxx  /mnt/data  ext4  defaults,nofail  0  2
  • nofail ensures instance boots even if volume is temporarily missing (useful for cloud volumes).


⚡ Step 6: Mount Options for Cloud Best Practices

  • noatime → improves performance by not updating access times.

  • discard → enables TRIM for SSDs (if supported).

  • Example fstab line:

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

🧪 Step 7: Real-World Use Cases

✔️ AWS EC2 → Attach a 500 GB EBS volume for database storage
✔️ Azure VM → Attach multiple Managed Disks in RAID 0 for high-performance workloads
✔️ OpenStack → Attach Cinder volumes to scale web server storage


✅ Step 8: Verify & Monitor

  • Check mounted volumes:

df -h
  • Monitor I/O usage:

iostat -x 5
  • Ensure proper permissions for applications:

sudo chown -R appuser:appgroup /mnt/data

🔚 Conclusion

Attaching and mounting cloud volumes is essential for scalable Linux deployments in AWS, Azure, OpenStack, or other clouds.

  • Detect new volumes with lsblk

  • Format and mount with mkfs + mount

  • Auto-mount using UUID in /etc/fstab with nofail for reliability

  • Apply mount options for performance and safety

🚀 With these steps, your cloud servers can easily expand storage, handle databases, and manage persistent workloads safely.



Views: 36

Recent Articles

  • Detecting Rootkits on Linux: Using rkhun...
    21
  • Load Balancing on Linux Cloud Servers Us...
    21
  • High Availability (HA) on Linux Cloud Se...
    22
  • How to Set Up a Firewall on Linux Cloud...
    22
  • How to Attach and Mount Volumes on Linux...
    36

Popular Articles

  • How to Fix “Error Establishing Database...
    238
  • How to Create a Linux Swap File (Step-by...
    46
  • How to Secure SSH Access on Linux Server...
    42
  • How to Attach and Mount Volumes on Linux...
    36
  • Timeshift Installation and Configuration...
    36
!-- Floating WhatsApp Button --> WhatsApp Chat