方式是创建一个ebs卷,挂到机器上,然后将instance store中的数据copy到这个卷,最后对这个EBS卷进行备份。
注意: 在确保复制操作成功并完成之前,请保持两个卷都可用。在新 EBS 卷可用于您的实例之前,您可能需要进行其他配置工作。
具体步骤:
Make the volume available to your operating system, and create a compatible file system on the volume. To do so:
List all volumes. Here the EBS volume we attached is denoted as xvdf.
View file system on EBS volume
sudo file -s /dev/xvdf
Ideally it should not have any file system configured, as shown in image above. If you get a response as a Linux file system then you can skip next step.
Setup file system on EBS volume:
sudo mkfs -t ext4 /dev/xvdf
The above command will help format the EBS volume to a ext4 file system ideal for Linux instances. For Windows, refer to this link .
Create mount point/directory for EBS volume.
You can choose any location for mount directory, here its /opt.
Next, mount EBS volume with help of fstab. Keep in mind that before you make changes it recommended to back up your existing fstab file.
In fstab file, enter device name followed by mount point.
The last three fields on this line are the file system mount options, the dump frequency of the file system, and the order of file system checks done at boot time.
Once you’ve made the changes in the fstab file, now you can execute the following command to mount all the entries in the fstab file:
sudo mount -a
After successfully mounting the volume you should see following output for the df command:
Now transfer all your data to mount directory on EBS volume. You can use the rsync utility to transfer all the data on Linux instances:
sudo rsync -zvh /path-to-your-data.tar.gz /path-to-mount-directory
That’s it! This will transfer all your data. Once you’re done with the transfer you can unmount and detach the EBS volume. To unmount, use the following command:
sudo umount /dev/xvdf
Things to keep in mind: It’s a best practice to keep both volumes available until you’re sure that the copy operation has succeeded.
If you’re using Windows OS, refer to the following document to achieve same on an Windows instance store volume.
If you would like to continually back up data from ephemeral storage to EBS you can use tools such as rsync , lsyncd for Linux, and robocopy for Windows. You can also make automated backups of an EBS volume by taking snapshots.
参考: https://bluexp.netapp.com/blog/backing-up-ephemeral-storage-to-aws-ebs