sudo raspi-configsudo systemctl enable ssh
sudo systemctl start sshhostname -Issh pi@[raspberrypi_ip_address]sudo dphys-swapfile swapoffsudo nano /etc/dphys-swapfileCONF_SWAPSIZE=2048sudo dphys-swapfile setupsudo dphys-swapfile swaponsudo rebootsudo apt update
sudo apt upgradecurl -sSL https://get.docker.com | shsudo usermod -aG docker $USERlogoutgroupsdocker run hello-worldsudo apt update
sudo apt upgradesudo apt install docker-compose -ydocker-compose versionsudo docker compose up -dsudo apt remove --autoremove docker-composesudo apt update
sudo apt upgradesudo docker pull portainer/portainer-ce:latestsudo docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latesthostname -Ihttp://[PIIPADDRESS]:9000sudo apt update
sudo apt upgradewget -O - https://raw.githubusercontent.com/OpenMediaVault-Plugin-Developers/installScript/master/install | sudo bashsudo reboothostname -Ihttp://[PIIPADDRESS]:80nano setddns.py#!/usr/bin/python3
import requests
import logging
import time
from urllib.request import urlopen
logging.basicConfig(filename='ddns.log', level=logging.DEBUG, filemode='a', format='%(asctime)s - %(message)s')
username = 'youruserddns'
password = 'yourpasswordddns'
hostname = 'subdomain.yourdomain.com'
old_ip = ''
while True:
try:
my_ip = urlopen('https://domains.google.com/checkip').read()
except:
logging.debug('CATCHED AN ERROR... RETRYING IN 10 SECONDS')
time.sleep(10)
else:
if my_ip != old_ip:
url = 'https://{}:{}@domains.google.com/nic/update?hostname={}'.format(username, password, hostname)
response = requests.post(url)
output = response.content.decode('utf-8')
if 'good' in output or 'nochg' in output:
old_ip = my_ip
logging.debug('-- OUTPUT FOR UPDATE: '+ hostname +' --')
logging.debug('Response from DDNS update: '+ output)
time.sleep(10)sudo -i
nano /etc/rc.local#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
python3 /path/to/file/setddns.py
exit 0
sudo reboot- NTFS: This file system is developed by Microsoft in the early 90s. All new versions of Windows operating systems will support this file system. Theoretically, NTFS can support hard drives up to just under 16 EB. The individual file size is capped at just under 256 TB, at least in Windows 8 and Windows 10, as well as in some newer Windows Server versions. When it comes to supporting, this file system is universally supported. Although it’s developed by Microsoft, it is supported by most Linux distributions and Mac.
- EXT4: This file system is developed based on the older Minix filesystem, A file system being used by Linux systems for ages. The higher maximum volume size it supports is 1 EB. That’s, again, a mathematical number. I know all these numbers don’t bother you like many of us. After all, who is going to use such a gigantic drive at home with Raspberry Pi!
sudo parted
(parted) print allSelect the drive to format and create new partitions. Type the ‘select’ command with the drive path.
(parted) select /dev/sdaCreate a fresh GPT partition table by typing ‘mklabel gpt’ command. You will get a warning to wipe out all your drive. Type ‘yes’ to continue. Please bear in mind, that it’s just a partition table, not the partitions.
(parted) mklabel gpt(parted) printCreate three partitions on this drive using ‘mkpart’ command: data-nas, and data-all. Type ‘mkpart’ command to create a new partition. It asks four simple questions to create a partition. Your partition will be created upon supplying the answers. Just pay attention to the commands we used to create three partitions. You can create partitions in a single line command as well, as we show in the below screenshot.
(parted) mkpart data-nas ext4 0% 50%
(parted) mkpart data-all ext4 50% 100%(parted) qYou can’t use the partitions until you format them. Let’s use mkfs commands to format the partitions. Different versions of mkfs commends are there to format NTFS and EXT4 file systems. In this command -L specifies the label of the drive, and -Q specifies quick format, which takes the partition name as a parameter. Note: EXT4 doesn’t take -Q as it doesn’t support the quick format.
sudo mkfs.ext4 -L data-nas /dev/sda1
sudo mkfs.ext4 -L data-all /dev/sda2sudo rebootChange the directory to /mnt.
cd /mntCreate two directories named ‘data-nas’ and ‘data-all’ under /mnt.
sudo mkdir data-nas
sudo mkdir data-allLet’s now give our pi user ownership of this folder by running the command below.
sudo chown -R pi:pi /mnt/data-nas
sudo chown -R pi:pi /mnt/data-allMount the partitions using the mount command. Note: This is just a temp mount. It is not going to work after reboot.
sudo mount /dev/sda1 /mnt/data-nas
sudo mount /dev/sda2 /mnt/data-allDo you remember the fstab? It’s a file system table. This is where you can mount a partition forever. Open the /etc/fstab file and see how it looks. You can only see the SD card at this time.
cat /etc/fstabYou need to add those two partitions to /etc/fstab to mount permanently. Before that, make a note of PARTUUID value of the two partitions.
sudo blkidUse your choice of a text editor to edit and add the partition information in the /etc/fstab. You can add the two lines representing each line for a partition. Write this information separated by TAB.
sudo blkidPARTUUID=VALUE
Mount path
File System
default or default, notime: The word ‘notime’ just tells us to keep track of the access time along with created and modified time.
0
0Open fstab
sudo nano /etc/fstabAdd the partition information. Examples
PARTUUID=8c8816b4-13d5-4345-8410-85263b3c5891 /mnt/data-gitea ext4 defaults,noatime 0 0
PARTUUID=6d56b35f-d771-4be0-9ae2-d4faf98e2326 /mnt/data-all ext4 defaults,noatime 0 0sudo rebootssh-keygencat ~/.ssh/id_rsa.pub