Last active
May 14, 2022 08:59
-
-
Save skarlekar/4eaf0c3176d99f3fd3485f2c9f014e57 to your computer and use it in GitHub Desktop.
Raspberry Pi Commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find the device name using fdisk -l | |
# For example: /dev/sda | |
sudo fdisk -l | |
# Format the disk using fdisk | |
sudo fdisk /dev/sda | |
#Use the following commands shortcuts in fdisk: | |
#Create a new partition table : g (for GPT, use help for other format) | |
#Create a new partition : n | |
#You can keep the default values for a single partition | |
#Confirm with Y to remove the signature | |
#And finally write and exit fdisk: w | |
# Format the partition | |
sudo mkfs.ext4 /dev/sda1 #Best | |
# or | |
sudo mkfs.vfat /dev/sda1 #Only allows 4GB largest file size | |
# or | |
sudo mkfs.ntfs /dev/sda1 | |
## Mount the drive | |
# Create a new folder | |
sudo mkdir /media/ssd | |
# Manually mount the drive | |
sudo mount -t ext4 -o defaults /dev/sda1 /media/ssd | |
# Allow user pi to read/write/update | |
sudo chown -R pi:pi /media/ssd | |
# Unmount | |
sudo umount /media/ssd | |
## Auto mount on boot | |
# Get the UUID of the device using blkid or ls -l /dev/disk/by-uuid/ | |
sudo blkid | |
# Insert the following line at the end of /etc/fstab | |
# UUID=<uuid-from-earlier> /media/usb ext4 defaults 0 | |
# Do not enter quotes around the UUID | |
sudo vi /etc/fstab | |
# Example | |
UUID=c80fd6f4-4447-4fe0-a330-9b16a79a73f9 /media/ssd ext4 defaults 0 | |
# Reboot | |
sudo reboot now | |
# Keep your fingers crossed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find the device name using fdisk -l | |
# For example: /dev/sda | |
sudo fdisk -l | |
# Format the disk using fdisk | |
sudo fdisk /dev/sda | |
#Use the following commands shortcuts in fdisk: | |
#Create a new partition table : g (for GPT, use help for other format) | |
#Create a new partition : n | |
#You can keep the default values for a single partition | |
#Confirm with Y to remove the signature | |
#And finally write and exit fdisk: w | |
# Format the partition | |
sudo mkfs.ext4 /dev/sda1 #Best | |
# or | |
sudo mkfs.vfat /dev/sda1 #Only allows 4GB largest file size | |
# or | |
sudo mkfs.ntfs /dev/sda1 | |
## Mount the drive | |
# Create a new folder | |
sudo mkdir /media/usb | |
# Manually mount the drive | |
sudo mount -t ext4 -o defaults /dev/sda1 /media/usb | |
# Allow user pi to read/write/update | |
sudo chown -R pi:pi /media/usb | |
# Unmount | |
sudo umount /media/usb | |
## Auto mount on boot | |
# Get the UUID of the device using blkid or ls -l /dev/disk/by-uuid/ | |
sudo blkid | |
# Insert the following line at the end of /etc/fstab | |
# UUID=<uuid-from-earlier> /media/usb ext4 defaults 0 | |
# Do not enter quotes around the UUID | |
sudo vi /etc/fstab | |
# Example | |
UUID=c80fd6f4-4447-4fe0-a330-9b16a79a73f9 /media/usb ext4 defaults 0 | |
# Reboot | |
sudo reboot now | |
# Keep your fingers crossed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Node passwords are stored in the controller at: | |
sudo cat /var/lib/rancher/k3s/server/cred/node-passwd | |
# Node password are stored in the node at: | |
sudo vi /var/lib/rancher/k3s/agent/node-password.txt | |
# Issue: When a node is reimaged after an accident, rejoining was causing an issue where the sudo systemctl status k3s-agent | |
# was giving the following error. | |
# "Node password rejected, contents of '/var/lib/rancher/k3s/agent/node-password.txt" | |
# Copy pasting the node passwords from the controller to the server helped resolve this issue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the hard disk parameters | |
sudo apt-get install hdparm | |
sudo hdparm -tT /dev/sda | |
# Result | |
# /dev/sda: | |
# Timing cached reads: 1816 MB in 2.00 seconds = 908.34 MB/sec | |
# Timing buffered disk reads: 1096 MB in 3.00 seconds = 364.89 MB/sec | |
# Get the operating temperature of Raspberry Pi | |
vcgencmd measure_temp | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install the packages that is required to setup Samba by running the following command | |
sudo apt-get install samba samba-common-bin | |
# Create a folder that we will share | |
mkdir /media/ssd/shared | |
sudo chmod -R 777 /media/ssd/shared | |
# Modify the samba config file | |
sudo vi /etc/samba/smb.conf | |
# Within this file, add the following to the bottom. This text defines various details of our share. | |
[pi-nfs] | |
path = /media/ssd/shared | |
writeable=Yes | |
create mask=0777 | |
directory mask=0777 | |
public=no | |
# [pi-nfs]” – This defines the share itself, the text between the brackets is the point at which you will access the share. For example, ours will be at the following address: //raspberrypi/pimylifeupshare | |
# “path” – This option is the path to the directory on your Raspberry Pi that you want to be shared. | |
# “writeable” – When this option is set to “Yes“, it will allow the folder to be writable. | |
# “create mask” and “directory mask” – This option defines the maximum permissions for both files and folders. Setting this to 0777 allows users to read, write, and execute. | |
# “public” – If this is set to “no” the Pi will require a valid user to grant access to the shared folders. | |
# creating a Samba user called “pi” with the password set to your choice | |
sudo smbpasswd -a pi | |
# Start the samba service to start whenever the pi starts with: | |
sudo systemctl restart smbd | |
## Connect to the samba share on Mac by going to: | |
smb://my-pi-ip/pi-nfs | |
############################################# | |
## Connect to the samba share on another Pi | |
# Create a directory to mount the network file share in that folder | |
sudo mkdir /mnt/nfs | |
# Mount the nfs using the following | |
sudo mount -t cifs -o username=pi,password="your-samba-password",uid=pi,gid=pi //my-pi-ip/pi-nfs /mnt/nfs | |
# Unmount the file share using | |
sudo umount //my-pi-ip/nfs | |
# To Automount the network shares everytime on boot | |
sudo vi /etc/fstab | |
# Add the following line at the end of the file | |
//my-pi-ip/pi-nfs /mnt/nfs cifs username=pi,password="your-samba-password",uid=pi,gid=pi 0 0 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reference: https://github.com/christianbaun/ossperf/wiki/Minio-on-a-Raspberry-Pi-3-with-Raspbian-(Debian-Jessie-8.0) | |
wget https://dl.minio.io/server/minio/release/linux-arm/minio | |
chmod +x minio | |
./minio server --address ":8080" /media/ssd/minio-data/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment