tencent cloud

Feedback

Attaching Cloud Disks

Last updated: 2023-12-21 21:15:02

    Overview

    You can attach elastic cloud disks to a CVM instance in the same availability zone as a data disk. Up to 20 data disks can be attached to a CVM instance.
    This document describes how to attach cloud disks to a CVM instance in the console and by using an API.
    Note:
    Some Linux CVMs may not recognize an elastic cloud disk. You must first enable the disk hot swapping feature in the CVM. For more information, see Enabling the disk hot swapping feature.

    Directions

    Attaching cloud disks in the CBS console

    1. Log in to the CBS console.
    2. On the cloud disk list page, select and attach the cloud disks. Note that you can only attach cloud disks in To be attached status.
    Attach a single cloud disk: Find the target cloud disk, and click More > Attach under the Operation column.
    Attach multiple cloud disks: Select the cloud disks, and click Attach above the cloud disk list to attach them in a batch.
    3. In the Attach to instance pop-up window, attach the disks to the instance.
    Select the target instance, and complete the parameters Attaching options.
    Unified expiry time with the instance (XXX)
    Enable monthly auto-renewal of the cloud disks (recommended)
    Attach directly
    4. Click Next. After attaching the cloud disk, you need to log in to the instance and initialize the disk.
    5. Click Attach now. If the status of the cloud disk changes to Attached, the attachment is successful.
    6. Perform the subsequent operations corresponding to different cloud disk capacities.
    Creation mode
    Cloud disk capacity
    Subsequent operations
    Manually created
    Cloud disk capacity < 2 TB
    Cloud disk capacity ≥ 2 TB
    Created from a snapshot
    Cloud disk capacity = Snapshot capacity
    Attach to Windows CVMs Log in to the instance, and go to Server ManagerStorageDisk Management to make the disk online.
    Attach to Linux CVMs: Log in to the instance, and run he command mount such as mount /dev/vdb /mnt, to make the disk usable.
    Snapshot capacity < Cloud disk capacity ≤ 2 TB or 2 TB < Snapshot capacity < Cloud disk capacity
    Snapshot capacity ≤ 2 TB < Cloud disk capacity
    If the snapshot uses a MBR partition,
    see Initializing cloud disks (≥2 TB) to repartition the disk with GPT. Note that this operation will delete the existing data.
    If the snapshot uses a GPT partition,

    Using the API to attach cloud disks

    You can use the AttachDisks API to attach cloud disks. For more information, see AttachDisks.

    Enabling the disk hot swapping feature

    All existing images already support attaching and detaching elastic cloud disks. To detach a cloud disk, you must first run the umount command in Linux CVM or perform offline operations in Windows CVM. Otherwise, the reattached elastic cloud disk may not be recognized.
    Note:
    Hot swapping is only recommended for CVMs with the following operating systems.
    Operating system
    Version
    CentOS
    5.11 64-bit
    5.11 32-bit
    5.8 64-bit
    5.8 32-bit
    Debian
    6.0.3 32-bit
    Ubuntu
    10.04 64-bit
    10.04 32-bit
    openSUSE
    12.3 64-bit
    12.3 32-bit
    
    2. Run the following command to add the driver.
    modprobe acpiphp
    Note:
    If you still need to load the acpiphp module after shutting down or re-starting the CVM, we recommend you run Step 3 to set the acpiphp module to autoload.
    3. (Optional) If you need to load the acpiphp module automatically after shutting down or re-starting the CVM, run the following command according to the operating system.
    CentOS 5 Series
    Debian 6 Series, Ubuntu 10.04 Series
    openSUSE 12.3 Series
    1. Run the following command to create and open the acpiphp.modules file.
    vi /etc/sysconfig/modules/acpiphp.modules
    2. Add the following content to the file, and save it.
    #!/bin/bash
    modprobe acpiphp >& /dev/null
    3. Run the following command to grant execute permissions on the file.
    chmod a+x /etc/sysconfig/modules/acpiphp.modules
    1. Run the following command to modify the file.
    vi /etc/modules
    2. Add the following content to the file, and save it.
    acpiphp
    1. Run the following command to modify the file.
    vi /etc/sysconfig/kernel
    2. Add the following content to the file, and save it.
    MODULES_LOADED_ON_BOOT="acpiphp"

    Attaching data disks automatically upon instance creation

    If you specify a custom image and data disk snapshot while creating a CVM instance, the cloud disk created at the same time is automatically attached to the CVM and can be read and written without being initialized by partitioning, formatting and other operations. However, the specified custom images and data disk snapshots must meet the following requirements.
    Windows instances
    Linux instances
    If you use a custom image to create a Windows CVM instance, the cloud disk created from the corresponding data disk snapshot will be automatically attached. The custom image and the data disk snapshot must meet the following requirements:
    The data disk must be formatted to ntfs or fat32 before you create a snapshot.
    The SAN policy in the custom image is onlineAll.

    Checking configurations

    Tencent Cloud provides pre-configured public images for Windows by default, but we still recommend that you perform the following steps to check configurations before creating a custom image. Run the following commands in order and check the returned results.
    diskpart
    san
    See below:
    
    
    If you use a custom image to create a Linux CVM instance, the cloud disk created from the corresponding data disk snapshot will be automatically attached. The custom image and the data disk snapshot must meet the following requirements:
    The data disk must be formatted and attached to the source CVM.
    Add the following commands to the /etc/rc.local file to configure the mount point of the data disk before creating a system disk on the system disk.
    mkdir -p <mount-point>
    mount <device-id> <mount-point>
    Note:
    Replace <mount-point> with the mount point of the file system, such as /mydata.
    Replace <device-id> with the partition path of the file system. For example, enter /dev/vdb if the file system has no partition, and /dev/vdb1 if the file system has partitions.
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support