TheKoguryo's Tech Blog

 Version 2024.10.18

Warning

This content has been generated by machine translation. The translations are automated and have not undergone human review or validation.

8.4 Snapshot for backup

You can create a Snapshot of the File System based on the time it was executed. You can recover files or all of them from the created Snapshot.

Snapshot #1

  1. Connect to the tested VM.

  2. Copy one file to the mounted file system.

    [opc@examplelinuxinstance ~]$ cd /mnt/FSS-Storage/
    [opc@examplelinuxinstance FSS-Storage]$wget https://github.com/oracle/oci-cli/releases/download/v3.4.2/oci-cli-3.4.2-Oracle-Linux-7.9-Offline.zip
    ...
    
    2022-01-14 06:04:59 (6.24 MB/s) - ‘oci-cli-3.4.2-Oracle-Linux-7.9-Offline.zip’ saved [42528311/42528311]
    
    [opc@examplelinuxinstance FSS-Storage]$ ls -la
    total 43025
    drwxrwxrwx. 2 root root        3 Jan 14 06:04 .
    drwxr-xr-x. 3 root root       25 Jan 14 01:59 ..
    drwxrwxrwx. 2 root root        0 Jan 14 06:05 .snapshot
    -rw-r--r--. 1 root root       19 Jan 14 02:18 hello1.txt
    -rw-rw-r--. 1 opc  opc        19 Jan 14 05:50 hello2.txt
    -rw-rw-r--. 1 opc  opc  42528311 Jan 13 16:38 oci-cli-3.4.2-Oracle-Linux-7.9-Offline.zip
    
  3. Go to the OCI Console in the web browser and go to the detailed screen of the file system created earlier.

  4. Go to Resources > Snapshots in the lower left.

  5. Click Create Snapshot to create a Snapshot.

    image-20220114151435082

  6. Snapshot creation screen

    image-20220114151504371

  7. Confirm creation

    image-20220114151624241

  8. Check in Compute Instance

    Snapshots and files created in the .snapshot folder just below the mounted path are displayed.

    [opc@examplelinuxinstance FSS-Storage]$ ls -la .snapshot/
    total 2
    drwxrwxrwx. 3 root root 1 Jan 14 06:16 .
    drwxrwxrwx. 2 root root 3 Jan 14 06:04 ..
    drwxrwxrwx. 2 root root 3 Jan 14 06:04 Snapshot-20220114-0614-39
    [opc@examplelinuxinstance FSS-Storage]$ ls -la .snapshot/Snapshot-20220114-0614-39/
    total 43025
    drwxrwxrwx. 2 root root        3 Jan 14 06:04 .
    drwxrwxrwx. 3 root root        1 Jan 14 06:17 ..
    -rw-r--r--. 1 root root       19 Jan 14 02:18 hello1.txt
    -rw-rw-r--. 1 opc  opc        19 Jan 14 05:50 hello2.txt
    -rw-rw-r--. 1 opc  opc  42528311 Jan 13 16:38 oci-cli-3.4.2-Oracle-Linux-7.9-Offline.zip
    

Snapshot #2

  1. Copy one more file to the mounted file system from the connected Compute Instance.

    [opc@examplelinuxinstance FSS-Storage]$ wget https://github.com/oracle/oci-cli/releases/download/v3.4.2/oci-cli-3.4.2-Oracle-Linux-8-Offline.zip
    ...
    2022-01-14 06:18:36 (4.57 MB/s) - ‘oci-cli-3.4.2-Oracle-Linux-8-Offline.zip’ saved [42528311/42528311]
    
    [opc@examplelinuxinstance FSS-Storage]$ ls -la
    total 86033
    drwxrwxrwx. 2 root root        4 Jan 14 06:18 .
    drwxr-xr-x. 3 root root       25 Jan 14 01:59 ..
    drwxrwxrwx. 3 root root        1 Jan 14 06:18 .snapshot
    -rw-r--r--. 1 root root       19 Jan 14 02:18 hello1.txt
    -rw-rw-r--. 1 opc  opc        19 Jan 14 05:50 hello2.txt
    -rw-rw-r--. 1 opc  opc  42528311 Jan 13 16:38 oci-cli-3.4.2-Oracle-Linux-7.9-Offline.zip
    -rw-rw-r--. 1 opc  opc  42528311 Jan 13 16:39 oci-cli-3.4.2-Oracle-Linux-8-Offline.zip
    
  2. Go to the OCI Console in your web browser and create another snapshot.

  3. Confirm creation of the second snapshot

    image-20220114152039582

  4. Check on Compute Instance

    You can see the snapshots and files created in the .snapshot folder.

    [opc@examplelinuxinstance FSS-Storage]$ ls -la .snapshot/
    total 2
    drwxrwxrwx. 4 root root 2 Jan 14 06:21 .
    drwxrwxrwx. 2 root root 4 Jan 14 06:18 ..
    drwxrwxrwx. 2 root root 3 Jan 14 06:04 Snapshot-20220114-0614-39
    drwxrwxrwx. 2 root root 4 Jan 14 06:18 Snapshot-20220114-0620-02
    [opc@examplelinuxinstance FSS-Storage]$ ls -ls .snapshot/Snapshot-20220114-0614-39/
    total 43024
        8 -rw-r--r--. 1 root root       19 Jan 14 02:18 hello1.txt
        8 -rw-rw-r--. 1 opc  opc        19 Jan 14 05:50 hello2.txt
    43008 -rw-rw-r--. 1 opc  opc  42528311 Jan 13 16:38 oci-cli-3.4.2-Oracle-Linux-7.9-Offline.zip
    [opc@examplelinuxinstance FSS-Storage]$ ls -ls .snapshot/Snapshot-20220114-0620-02/
    total 86032
        8 -rw-r--r--. 1 root root       19 Jan 14 02:18 hello1.txt
        8 -rw-rw-r--. 1 opc  opc        19 Jan 14 05:50 hello2.txt
    43008 -rw-rw-r--. 1 opc  opc  42528311 Jan 13 16:38 oci-cli-3.4.2-Oracle-Linux-7.9-Offline.zip
    43008 -rw-rw-r--. 1 opc  opc  42528311 Jan 13 16:39 oci-cli-3.4.2-Oracle-Linux-8-Offline.zip
    
  5. Snapshots are read-only folders that can be recovered by making a full copy of the files in the Snapshot or a specific Snapshot.

    [opc@examplelinuxinstance FSS-Storage]$ cd .snapshot/Snapshot-20220114-0620-02/
    [opc@examplelinuxinstance Snapshot-20220114-0620-02]$ ls -la
    total 86033
    drwxrwxrwx. 2 root root        4 Jan 14 06:18 .
    drwxrwxrwx. 4 root root        2 Jan 14 06:22 ..
    -rw-r--r--. 1 root root       19 Jan 14 02:18 hello1.txt
    -rw-rw-r--. 1 opc  opc        19 Jan 14 05:50 hello2.txt
    -rw-rw-r--. 1 opc  opc  42528311 Jan 13 16:38 oci-cli-3.4.2-Oracle-Linux-7.9-Offline.zip
    -rw-rw-r--. 1 opc  opc  42528311 Jan 13 16:39 oci-cli-3.4.2-Oracle-Linux-8-Offline.zip
    [opc@examplelinuxinstance Snapshot-20220114-0620-02]$ rm -rf oci-cli-3.4.2-Oracle-Linux-8-Offline.zip
    rm: cannot remove ‘oci-cli-3.4.2-Oracle-Linux-8-Offline.zip’: Read-only file system
    


As an individual, this article was written with my personal time. There may be errors in the content of the article, and the opinions in the article are personal opinions.

Last updated on 14 Jan 2022