Skip to content

Commit bf82eb8

Browse files
committed
several updates
- change block-volume-backup-and-restore from txt to md - change trim-showcase from txt to md
1 parent 67f79f8 commit bf82eb8

File tree

3 files changed

+215
-221
lines changed

3 files changed

+215
-221
lines changed
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# License
2+
3+
Copyright (c) 2023 Oracle and/or its affiliates.
4+
5+
Licensed under the Universal Permissive License (UPL), Version 1.0.
6+
7+
See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/folder-structure/LICENSE) for more details.
8+
9+
10+
# Showcase manual block volume backup and restore
11+
12+
## Information
13+
- [Mounting an Object Storage Bucket as File System on Oracle Linux](https://blogs.oracle.com/cloud-infrastructure/post/mounting-an-object-storage-bucket-as-file-system-on-oracle-linux)
14+
- [OCI Compute - How to Install s3fs-fuse on Oracle Linux 8 (Doc ID 2938554.1)](https://support.oracle.com/epmos/faces/DocumentDisplay?id=2938554.1)
15+
16+
## Prepare your environment
17+
- set up your individual "operate" instance
18+
- An Oracle enterprise Linux server with Command Line Interface (*see [Set up your Server with Resilience by default using CLI](https://gitlab.com/hmielimo/cloud-resilience-by-default/#set-up-your-server-with-resilience-by-default-using-cli) for details*)
19+
- create and attach block volume: e.g. backup-test (*50GB*)
20+
- create a bucket e.g. backup-test
21+
22+
## Set needed variables (*please adjust variables to your needs before past into your terminal*)
23+
~~~
24+
DEVICEoPATH1=/dev/oracleoci/oraclevdc
25+
DEVICEoPATH2=/dev/oracleoci/oraclevdc1
26+
MYoSOURCE1=/dev/sdb
27+
MYoSOURCE2=/dev/sdb1
28+
DATAoDIR=/mnt/MyBlockVolume.backup-test
29+
OBJECTDATAoDIR=/mnt/MyObjectStorage.backup-test
30+
BUCKEToNAME=backup-test
31+
MYoREGION=<region>
32+
MYoNAMESPACE=<your_namespace>
33+
MYoSECREToKEY=<your_secret_key>
34+
MYoACCESSoKEY=<your_access_key>
35+
~~~
36+
37+
## Format and mount block volume
38+
~~~
39+
sudo umount ${DATAoDIR}
40+
sudo mkdir ${DATAoDIR}
41+
sudo fdisk -l
42+
sudo fdisk ${MYoSOURCE1}
43+
44+
n add a new partition
45+
p primary (0 primary, 0 extended, 4 free)
46+
Partition number (1-4, default 1):
47+
First sector (2048-419430399, default 2048):
48+
Last sector, +sectors or +size{K,M,G,T,P} (2048-419430399, default 419430399): +1G
49+
w write table to disk and exit
50+
51+
sudo mkfs -t ext4 ${DEVICEoPATH2}
52+
sudo mount ${DEVICEoPATH2} ${DATAoDIR}
53+
sudo chown -R opc:opc ${DATAoDIR}
54+
ls -lah ${DATAoDIR}
55+
sudo mount | grep ${DATAoDIR}
56+
lsblk
57+
~~~
58+
59+
## Update fstab
60+
~~~
61+
sudo vi /etc/fstab
62+
/dev/oracleoci/oraclevdc1 /mnt/MyBlockVolume.backup-test ext4 defaults,_netdev,noatime 0 2
63+
~~~
64+
65+
## Mounting an Object Storage Bucket as File System
66+
~~~
67+
# Generate Secret Key: <your_secret_key>
68+
69+
sudo yum update
70+
sudo dnf upgrade
71+
sudo dnf search epel
72+
73+
sudo dnf clean all
74+
sudo dnf repolist all
75+
sudo dnf install oracle-epel-release-el8
76+
77+
sudo tee /etc/yum.repos.d/ol8-epel.repo<<EOF
78+
[ol8_developer_EPEL]
79+
name= Oracle Linux \$releasever EPEL (\$basearch)
80+
baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/developer/EPEL/\$basearch/
81+
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
82+
gpgcheck=1
83+
enabled=1
84+
EOF
85+
sudo dnf makecache
86+
sudo dnf repolist all
87+
88+
sudo yum install s3fs-fuse
89+
90+
echo ${MYoACCESSoKEY}:${MYoSECREToKEY} > ${HOME}/.passwd-s3fs
91+
chmod 600 ${HOME}/.passwd-s3fs
92+
cat ${HOME}/.passwd-s3fs
93+
sudo rm -fr ${OBJECTDATAoDIR}
94+
sudo mkdir ${OBJECTDATAoDIR}
95+
sudo chown -R opc:opc ${OBJECTDATAoDIR}
96+
sudo umount ${OBJECTDATAoDIR}
97+
s3fs ${BUCKEToNAME} ${OBJECTDATAoDIR} -o endpoint=${MYoREGION} -o passwd_file=${HOME}/.passwd-s3fs -o url=https://${MYoNAMESPACE}.compat.objectstorage.${MYoREGION}.oraclecloud.com/ -o nomultipart -o use_path_request_style
98+
ls -lah ${OBJECTDATAoDIR}
99+
sudo mount | grep ${OBJECTDATAoDIR}
100+
sudo mount | grep ${DATAoDIR}
101+
~~~
102+
103+
## Create a Set of test data
104+
~~~
105+
touch ${DATAoDIR}/test.tmp
106+
touch ${OBJECTDATAoDIR}/test.tmp
107+
108+
tee ${DATAoDIR}/test.txt<<EOF
109+
This is a testfile located in a block volume.
110+
EOF
111+
112+
tee ${OBJECTDATAoDIR}/test.txt<<EOF
113+
This is a testfile located in object storage.
114+
EOF
115+
116+
cat ${DATAoDIR}/test.txt
117+
cat ${OBJECTDATAoDIR}/test.txt
118+
119+
ls -lah ${DATAoDIR}
120+
ls -lah ${OBJECTDATAoDIR}
121+
~~~
122+
123+
## Backup block volume (*here only a partition for testing purposes*)
124+
~~~
125+
sudo umount ${DATAoDIR}
126+
sudo dd if=${MYoSOURCE} conv=sync,noerror bs=128M | gzip -c > ${OBJECTDATAoDIR}/my-disk.image.gz
127+
ls -lah ${OBJECTDATAoDIR}/my-disk.image.gz
128+
~~~
129+
130+
## Delete ${DATAoDIR}/test.txt
131+
~~~
132+
sudo mount ${DEVICEoPATH} ${DATAoDIR}
133+
ls -lah ${DATAoDIR}
134+
rm ${DATAoDIR}/test.txt
135+
ls -lah ${DATAoDIR}
136+
~~~
137+
138+
## Restore
139+
~~~
140+
sudo umount ${DATAoDIR}
141+
gunzip -c ${OBJECTDATAoDIR}/my-disk.image.gz | sudo dd of=${MYoSOURCE}
142+
~~~
143+
144+
## Test if restore was successful
145+
~~~
146+
sudo mount ${DEVICEoPATH} ${DATAoDIR}
147+
ls -lah ${DATAoDIR}
148+
~~~

cloud-infrastructure/storage/block-storage/asset/block-volume-backup-and-restore.txt

Lines changed: 0 additions & 155 deletions
This file was deleted.

0 commit comments

Comments
 (0)