Todas as coleções
Volumes
How to backup volumes in BCOS?
How to backup volumes in BCOS?

Learn how to create backups of the associated volumes on your machine and how to restore them when needed.

Luiz Fernando Justino Silva avatar
Escrito por Luiz Fernando Justino Silva
Updated over a week ago

In previous post How to apply volumes to instances in BCOS? We have seen how to attach and mount volumes on instances in BCOS.

 Now let's look at how to backup these volumes and restore them later.

 Access the console of the machine where the volume is mounted, get it superuser permission, and list the mount point to view volume usage:

Example:

  • Super user permission: sudo -i.

  • List mount point: df -h.

Note that the volume usage in the example is at 3%.

Copy some files to the attached volume for demonstration, in the example, the files will be copied to /etc, then list the mount point files and then use the mount point to view the change:

Example:

  • Copy files to mount point: cp -r /etc/ /mnt/.

  • List the mount point files: ls -lh /mnt.

  • List mount point usage: df -h.

Note that the volume usage in the example is at 4%.

In Project / Volumes / Volumes on the volume actions button select Create Backup, enter a name for the backup, and click in Create Volume Backup:

Example

  • Backup name: bkp-01.

Now let's simulate an accidental deletion on the folders to the volume attached to the machine.

Access the machine console again, delete the / etc folder previously copied to the volume, list the files, and check volume usage:

Example:

  • Delete the /etc: rm -rf /mnt/etc.

  • List the mount point files: ls -lh /mnt.

  • List mount point usage: df -h.

Note that the /etc folder has been deleted and volume usage has returned to 3%.

Now, let's restore the volume to recover the removed /etc folder, so unmount the machine volume and list its use:

Example:

  • Unmount volume: umount /mnt.

  • List mount point usage: df -h.

Note that the /mnt volume has been unmounted and is not shown in the list.

Again in Project / Volumes / Volumes on the volume actions button select Manage Attachments, then click in Detach Volume, confirm by clicking in Detach Volume again:

Now to restore the backup go to Project / Volumes / Backups on the backup actions button click in Restore Backup, select the volume you want to restore (in the example vol-data01) and confirm by clicking in Restore Volume Backup:

Again in Project / Volumes / Volumes on the volume actions button select Manage Attachments, then click in Attach Volume to associate it with the instance again:

Access the machine console, mount the volume, list the files at the mount point, and check disk usage:

Example:

  • Mount volume: mount -t ext3 /dev/vdb /mnt.

  • List the mount point files: ls -lh /mnt.

  • List mount point usage: df -h.

Note that the /etc folder that had been deleted was recovered by the backup restore action.

In the next post How to create snapshots in BCOS?, we will learn how to create snapshots of instances.

Respondeu à sua pergunta?