Back up local disk files regularly with Cloud Backup, OSS, or cloud disks and NAS to prevent data loss.
This topic applies only to backing up files on a local disk. If your local disk stores a database and you need to back up the database, see Back up self-managed databases on ECS.
Method 1: Use Cloud Backup
|
Scenario |
Limit |
Benefit |
Billing |
|
Cloud Backup supports regular backup of files or directories on ECS instances (such as local disks or self-managed Oracle/MySQL/SQL Server databases) and data restoration when needed. Suitable for scenarios that require highly reliable backup. See Advantages of Cloud Backup? |
|
|
You are charged for file backup software usage and storage capacity. See ECS file backup fees. |
Procedure
-
Preparations.
-
Cloud Backup is supported in the region of the local disk. See Supported regions.
-
Cloud Assistant Agent is installed on the instance.
ImportantInstances purchased after December 1, 2017 include Cloud Assistant Agent by default. If not installed, see Install Cloud Assistant Agent.
-
-
Log on to the Cloud Backup console and select the region of the local disk.
-
In the navigation pane on the left, choose . On the ECS Instances tab, find the instance equipped with the local disk and click Backup in the Actions column.

-
On the Create Backup Plan panel, configure parameters as prompted and click OK.
Note the following configurations. For other parameters, see Create a backup plan to periodically back up ECS files:
-
Backup Folder Rule: Select Specified Folders.
-
Source Paths: The absolute path of the local disk data to back up. You can enter multiple paths. For rules, see the prompts.
-
Backup Policy: Select a policy that specifies the backup time, cycle, and retention period. If no policy exists, create one first. See Create a backup policy.
When the scheduled backup time arrives, the system runs the backup job. If the Status shows Completed, the backup is done. You can view backup points in the backup history.

-
Related operations
-
Restore data: After backing up data to a cloud backup vault, you can restore files from historical backup points if they are missing or corrupted. See Restore ECS files.
-
Browse and download backup files: See Browse and download backup files.
Method 2: Back up to OSS
Use ossutil and crontab to schedule automated backups from a local disk to OSS.
|
Scenario |
Features |
Billing |
|
Suitable for large-scale data backup that requires low cost and high reliability. See Benefits. |
Requires a custom script. |
OSS storage fees apply. See Storage fees. |
This is a basic example with limitations. Enhance it to meet your specific business requirements.
For example, full backup each time increases storage usage, and packaging entire directories into ZIP files reduces backup speed. Consider custom backup policies such as:
-
Incremental or differential backups: Back up only modified data since the last backup to improve efficiency.
-
Block backup: Divide data into blocks by directory structure or file type before backup.
Procedure
-
Preparations.
-
Activate OSS and create a bucket. See Create a bucket.
-
Obtain the OSS bucket name, OSS endpoint, and data path of the local disk to back up.
-
-
Log on to the ECS instance.
-
Install ossutil and configure the access credentials.
ImportantThe ECS instance must have Internet access to download ossutil. See How do I enable Internet access for an ECS instance?
-
Install ossutil.
sudo yum install unzip -y sudo -v ; curl https://gosspublic.alicdn.com/ossutil/install.sh | sudo bash -
Configure ossutil access credentials.
Create a
.ossutilconfigfile in the user directory and add the credentials.sudo -i # Switch to the root user. If the current user does not have sudo permissions, use other logon methods or grant the permissions. cat <<EOF > /root/.ossutilconfig [Credentials] language=EN endpoint=YourEndpoint accessKeyID=YourAccessKeyId accessKeySecret=YourAccessKeySecret EOFReplace
YourEndpoint,YourAccessKeyId, andYourAccessKeySecretwith your actual values.
-
-
Set up scheduled backup.
-
Install the compression tool. In this example,
zipis used.sudo yum install zip -
Create the backup script. In this example, the script is named backup_to_oss.sh.
-
-
Grant execute permissions and test the script.
sudo chmod +x /home/backup_to_oss.sh ./backup_to_oss.shVerify that the script runs correctly and data is uploaded to OSS.
-
Open the crontab editor with
crontab -eand add a schedule entry. For example, to run the backup at 02:00 daily:0 2 * * * /home/backup_to_oss.sh/home/backup_to_oss.sh: Replace with the actual script path. -
Configure additional settings as needed.
-
Download backup data
Download backup data from OSS through the console or ossutil. See Simple download.
Method 3: Back up to a cloud disk or NAS
Compress local disk data into a ZIP package and back it up to a cloud disk or NAS file system on a schedule.
|
Scenario |
Features |
Billing |
|
Requires a custom script. |
|
This is a basic example with limitations. Enhance it to meet your specific business requirements.
For example, full backup each time increases storage usage, and packaging entire directories into ZIP files reduces backup speed. Consider custom backup policies such as:
-
Incremental or differential backups: Back up only modified data since the last backup to improve efficiency.
-
Block backup: Divide data into blocks by directory structure or file type before backup.
Procedure
-
Preparations.
-
Create and attach a data disk to the instance, or mount a NAS file system.
See Guide to creating and using disks or Create a NAS file system and mount it to an ECS instance.
-
Obtain the mount path of the cloud disk or NAS file system, and the data path of the local disk to back up.
-
-
Set up scheduled backup.
-
Log on to the ECS instance.
-
Install the ZIP tool. In the following example, Alibaba Cloud Linux is used.
sudo yum install zip -
Create the backup script. In this example, the script is stored at /home/backup_script.sh.
Create and save the script:
vim /home/backup_script.sh -
Save the script and grant execute permissions.
sudo chmod +x /home/backup_script.sh/home/backup_script.sh: Replace with the actual script path. -
Open the crontab editor with
crontab -eand add a schedule entry. For example, to run the backup at 02:00 daily:0 2 * * * /home/backup_script.sh/home/backup_script.sh: Replace with the actual script path. -
-
Download backup data
-
Cloud disk: See Upload or download files.
-
NAS file system: See Migrate data from a NAS file system to an on-premises storage system.
References
-
Migrate data from a local disk to another ECS instance
Migrate all data from instances with local disks to another ECS instance with cloud disks in a few clicks. See Migrate servers to ECS instances.
-
Handle local disk damages
If a local disk is damaged, Alibaba Cloud triggers a system event and sends notifications with countermeasures. See O&M scenarios and system events for instances equipped with local disks.