Using a Raspberry PI as a MinIO cloud storage server with immutable worm lock enabled
vi /etc/dhcpcd.conf
interface wlan0
static ip_address=192.168.1.125/24
static routers=192.168.1.99
static domain_name_servers=209.18.47.62
fdisk -l | egrep 'Disk \/|Disk model:'
Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram1: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram2: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram3: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram4: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram5: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram6: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram7: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram8: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram9: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram10: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram11: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram12: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram13: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram14: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram15: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/mmcblk0: 119.08 GiB, 127865454592 bytes, 249737216 sectors
Disk /dev/sda: 460.27 GiB, 494206451712 bytes, 965246976 sectors
Disk model: SanDisk 3.2Gen1
Disk /dev/sdb: 460.27 GiB, 494206451712 bytes, 965246976 sectors
Disk model: SanDisk 3.2Gen1
parted /dev/sda
GNU Parted 3.4
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted) print
Model: USB SanDisk 3.2Gen1 (scsi)
Disk /dev/sda: 494GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
mkpart primary xfs 1MB 235520MB
mkpart extended xfs 235520MB 471040MB
p
Model: USB SanDisk 3.2Gen1 (scsi) Disk /dev/sda: 494GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 236GB 236GB xfs primary 2 236GB 471GB 236GB xfs extended (parted) quit Information: You may need to update /etc/fstab.
….repeat same steps above for /dev/sdbapt-get install lvm2
pvcreate /dev/sda1
pvcreate /dev/sda2
pvcreate /dev/sdb1
pvcreate /dev/sdb2
vgcreate xfsminio_vg1 /dev/sda1
vgcreate xfsminio_vg2 /dev/sda2
vgcreate xfsminio_vg3 /dev/sdb1
vgcreate xfsminio_vg4 /dev/sdb2
lvcreate -L +219G -n xfsminio_1 xfsminio_vg1
lvcreate -L +219G -n xfsminio_2 xfsminio_vg2
lvcreate -L +219G -n xfsminio_3 xfsminio_vg3
lvcreate -L +219G -n xfsminio_4 xfsminio_vg4
apt-get install xfsprogs
modprobe -v xfs
grep xfs /proc/filesystems
lsmod | grep xfs
modinfo xfs
filename: /lib/modules/5.15.61-v8+/kernel/fs/xfs/xfs.ko.xz
license: GPL
description: SGI XFS with ACLs, security attributes, realtime, quota, no debug enabled
author: Silicon Graphics, Inc.
alias: fs-xfs
srcversion: 7DF29575A772E2F414B4380
depends:
intree: Y
name: xfs
vermagic: 5.15.61-v8+ SMP preempt mod_unload modversions aarch64
root@cloudy:~#
mkfs.xfs /dev/xfsminio_vg1/xfsminio_1
mkfs.xfs /dev/xfsminio_vg2/xfsminio_2
mkfs.xfs /dev/xfsminio_vg3/xfsminio_3
mkfs.xfs /dev/xfsminio_vg4/xfsminio_4
cd /
mkdir xfsminio_1 xfsminio_2 xfsminio_3 xfsminio_4
mount /dev/xfsminio_vg1/xfsminio_1 /xfsminio_1
mount /dev/xfsminio_vg2/xfsminio_2 /xfsminio_2
mount /dev/xfsminio_vg3/xfsminio_3 /xfsminio_3
mount /dev/xfsminio_vg4/xfsminio_4 /xfsminio_4
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 117G 3.4G 109G 3% /
devtmpfs 3.7G 0 3.7G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 1.6G 1.3M 1.6G 1% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
/dev/mmcblk0p1 255M 31M 225M 12% /boot
tmpfs 782M 20K 782M 1% /run/user/1000
/dev/mapper/xfsminio_vg1-xfsminio_1 219G 1.6G 218G 1% /xfsminio_1
/dev/mapper/xfsminio_vg2-xfsminio_2 219G 1.6G 218G 1% /xfsminio_2
/dev/mapper/xfsminio_vg3-xfsminio_3 219G 1.6G 218G 1% /xfsminio_3
/dev/mapper/xfsminio_vg4-xfsminio_4 219G 1.6G 218G 1% /xfsminio_4
blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="29F5-65C4" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="f5b253a5-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="cbe4d267-24de-4402-9a4b-1413a1da5eb8" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="f5b253a5-02"
/dev/sda1: UUID="kmLqPd-02U8-tGhA-FJz8-gqCo-WuEk-qG9zZm" TYPE="LVM2_member" PARTLABEL="primary" PARTUUID="5b2886f1-f0ef-47f8-9cb0-edd03402348e"
/dev/sda2: UUID="fI5Urx-Zrce-FWq0-Mf38-3Weg-OSPd-oOXeJP" TYPE="LVM2_member" PARTLABEL="extended" PARTUUID="ca789999-6ebd-4ce4-a45b-ed88185a2e5f"
/dev/sdb1: UUID="roesK1-xCyi-7aIV-PDmJ-K9ho-Un3M-FW8vs0" TYPE="LVM2_member" PARTLABEL="primary" PARTUUID="a7bff4b9-8e21-4796-80fe-8beaa2392247"
/dev/sdb2: UUID="Ksp7wC-RWyM-Dmn1-ApGf-C1a2-SF7P-29ngKP" TYPE="LVM2_member" PARTLABEL="extended" PARTUUID="a7f6eaef-2064-4775-8abf-fb7502559ff6"
/dev/mapper/xfsminio_vg1-xfsminio_1: UUID="5e5b405f-d8d7-4ca7-852e-41728f583a9b" BLOCK_SIZE="512" TYPE="xfs"
/dev/mapper/xfsminio_vg2-xfsminio_2: UUID="b90e8b54-a0f8-4d9b-b3bb-3cd7f545f338" BLOCK_SIZE="512" TYPE="xfs"
/dev/mapper/xfsminio_vg3-xfsminio_3: UUID="e1b47735-8601-4434-82c0-1fbff8c506fa" BLOCK_SIZE="512" TYPE="xfs"
/dev/mapper/xfsminio_vg4-xfsminio_4: UUID="669bc36b-6669-48d5-9f1c-9c07b4678962" BLOCK_SIZE="512" TYPE="xfs"
echo 'UUID=5e5b405f-d8d7-4ca7-852e-41728f583a9b /xfsminio_1 xfs defaults 1 1' >> /etc/fstab
echo 'UUID=b90e8b54-a0f8-4d9b-b3bb-3cd7f545f338 /xfsminio_2 xfs defaults 1 1' >> /etc/fstab
echo 'UUID=e1b47735-8601-4434-82c0-1fbff8c506fa /xfsminio_3 xfs defaults 1 1' >> /etc/fstab
echo 'UUID=669bc36b-6669-48d5-9f1c-9c07b4678962 /xfsminio_4 xfs defaults 1 1' >> /etc/fstab
cd /usr/bin
wget https://dl.minio.io/server/minio/release/linux-arm/minio
wget https://dl.minio.io/client/mc/release/linux-arm/mc
chmod 755 minio
chmod 755 mc
wget https://github.com/minio/certgen/releases/latest/download/certgen-linux-arm64
mkdir /root/.minio/certs
cd /root/.minio/certs
/root/certgen-linux-arm64 -host cloudy,192.168.1.125
ls -l
total 20
-rw------- 1 root root 241 Sep 20 20:22 private.key <------ certgen created this
-rw-r--r-- 1 root root 700 Sep 20 20:22 public.crt <------ certgen created this
root@cloudy:~/.minio/certs#
/usr/bin/minio server --address ":443" --console-address ":44683" /xfsminio_1 /xfsminio_2 /xfsminio_3 /xfsminio_4
Create a MinIO server startup script to ease starting and stopping the MinIO server. We'll also point to this script later with a systemd service to start MinIO server at boot time.
vi startminio.sh
chmod +x startminio.sh
/root/startminio.sh
./startminio.sh
MinIO Object Storage Server
Copyright: 2015-2022 MinIO, Inc.
License: GNU AGPLv3
Version: RELEASE.2022-09-17T00-09-45Z (go1.18.6 linux/arm)
Status: 4 Online, 0 Offline.
API: https://192.168.1.125 https://127.0.0.1
RootUser: cloudburst
RootPass: f1rLH1MYEdSLvVWJDko0
Console: https://192.168.1.125:44683 https://127.0.0.1:44683
RootUser: cloudburst
RootPass: f1rLH1MYEdSLvVWJDko0
Command-line: https://docs.min.io/docs/minio-client-quickstart-guide
$ mc alias set myminio https://192.168.1.125 cloudburst f1rLH1MYEdSLvVWJDko)
Documentation: https://docs.min.io
mc config host add cos https://cloudy cloudburst f1rLH1MYEdSLvVWJDdo0 --api S3v4
mc: Configuration written to `/root/.mc/config.json`. Please update your access credentials.
mc: Successfully created `/root/.mc/share`.
mc: Initialized share uploads `/root/.mc/share/uploads.json` file.
mc: Initialized share downloads `/root/.mc/share/downloads.json` file.
Fingerprint of cos public key: bd521fce31116bc4ecc579fd137b77ffae316c974c115b4cc97cb529ccea88b6
Confirm public key y/N:
Added `cos` successfully.
mc mb --debug -l cos/wormbucket
mc:
Host: cloudy
User-Agent: MinIO (linux; arm) minio-go/v7.0.36 mc/RELEASE.2022-09-16T09-16-47Z
Content-Length: 0
Authorization: AWS4-HMAC-SHA256 Credential=cloudburst/20220921/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-bucket-object-lock-enabled;x-amz-content-sha256;x-amz-date, Signature=**REDACTED**
X-Amz-Bucket-Object-Lock-Enabled: true
X-Amz-Content-Sha256: UNSIGNED-PAYLOAD
X-Amz-Date: 20220921T004013Z
Accept-Encoding: gzip
mc:
Content-Length: 0
Accept-Ranges: bytes
Content-Security-Policy: block-all-mixed-content
Date: Wed, 21 Sep 2022 00:40:13 GMT
Location: /wormbucket
Server: MinIO
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
Vary: Accept-Encoding
X-Amz-Request-Id: 1716B943E035127B
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
mc:
mc:
mc:
mc:
Bucket created successfully `cos/wormbucket`.
systemctl list-units | grep 'xfsminio_' | awk '{ print $1 }'
xfsminio_1.mount
xfsminio_2.mount
xfsminio_3.mount
xfsminio_4.mount
chmod 755 minio.service
systemctl enable minio.service
ps -ef | grep minio
systemctl start minio.service
ps -ef | grep minio | grep -v grep
root 2040 1 0 13:29 ? 00:00:00 /bin/bash /root/startminio.sh
root 2041 2040 27 13:29 ? 00:00:01 /usr/bin/minio server --address :443 /xfsminio_1 /xfsminio_2 /xfsminio_3 /xfsminio_4
systemctl enable minio.service
Created symlink /etc/systemd/system/multi-user.target.wants/minio.service → /etc/systemd/system/minio.service.
vi /etc/ssh/sshd_config
systemctl restart ssh
apt-get install ufw
ufw status verbose
ufw allow 2222
ufw allow 443
ufw allow 44683
ufw status verbose
chown 550 vgap_on.sh
chown 550 vgap_off.sh
chmod 644 vgap*
systemctl enable vgapon.service
Created symlink /etc/systemd/system/multi-user.target.wants/vgapon.service → /etc/systemd/system/vgapon.service.
root@cloudy:/etc/systemd/system#systemctl enable vgapon.timer
Created symlink /etc/systemd/system/timers.target.wants/vgapon.timer → /etc/systemd/system/vgapon.timer.
root@cloudy:/etc/systemd/system#systemctl enable vgapoff.service
Created symlink /etc/systemd/system/multi-user.target.wants/vgapoff.service → /etc/systemd/system/vgapoff.service.
root@cloudy:/etc/systemd/system#systemctl enable vgapoff.timer
Created symlink /etc/systemd/system/timers.target.wants/vgapoff.timer → /etc/systemd/system/vgapoff.timer.
systemctl status vgapon.service
● vgapon.service - Compact memory
Loaded: loaded (/etc/systemd/system/vgapon.service; enabled; vendor preset: enabled)
Active: inactive (dead)
systemctl status vgapon.timer
● vgapon.timer - Logs some system statistics to the systemd journal
Loaded: loaded (/etc/systemd/system/vgapon.timer; enabled; vendor preset: enabled)
Active: inactive (dead)
Trigger: n/a
Triggers: ● cmpctmem.service
systemctl status vgapoff.service
● vgapoff.service - Compact memory
Loaded: loaded (/etc/systemd/system/vgapoff.service; enabled; vendor preset: enabled)
Active: inactive (dead)
systemctl status vgapoff.timer
● vgapoff.timer - Logs some system statistics to the systemd journal
Loaded: loaded (/etc/systemd/system/vgapoff.timer; enabled; vendor preset: enabled)
Active: inactive (dead)
Trigger: n/a
Triggers: ● cmpctmem.service
systemctl start vgapon.service
systemctl start vgapoff.sh