#+title: Raspberry Pi & Storage Setup #+HTML_HEAD: #+HTML_HEAD: #+OPTIONS: H:6 * links - [[./toc.org][TOC - Home Computer]] * Raspberry Pi Information ** network | Category | Value | |------------+--------------| | IP address | 192.168.0.63 | | Hostname | ronberrypi | *** To Be Able to Ping the Raspberry Pi #+begin_src bash ping ronberrypi.local #+end_src ** users | username | password | groups | /mnt/storage | |-----------+--------------+----------------+-------------------------| | ronny | 2reishit2ara | sudo | | | website | 2reishit2ara | www-data, sudo | /var/www, /home/website | | ftpuser | 2reishit2ara | www-data, sudo | /home/ftpuser | | librarian | 2reishit2ara | | librarian | * connect with a vnc - [[https://www.youtube.com/watch?v=9fEnvDgxwbI][Raspberry Pi Headless Setup]] ** install using the video you should be able to connect directly without doing anything special ** connect tiger vnc - hostname: ronberrypi.local - then enter the username and password ** connect realvnc even easier * External Hard Drive Info ** fstab [[#id-fstab-file][see fstab entry for more details]] #+INCLUDE: "pi-storage.org::*current fstab" :only-contents t ** main storage drive This table keeps track of the Raspberry Pi's external storage setup. | category | value | |---------------+--------------------------------------| | device | /dev/sdb1 | | filesystem | ext4 | | label | storage | | mount point | /mnt/storage | | mount options | defaults,relatime,commit=600 | | UUID | 86ba0735-df14-425c-a037-1e397e89f9aa | *** Bind-Mount Information **** directory layout #+begin_src ├── home │ ├── librarian │ └── website ├── lost+found ├── srv │ ├── calibre-library │ ├── ftp │ └── n8n └── var └── www #+end_src **** layout binding details | Mounted From /mnt/storage | Mounted To | |---------------------------+----------------------| | home/website | /home/website | | home/librarian | /home/librarian | | var/www | /var/www | | srv/n8n | /srv/n8n | | srv/ftp | /srv/ftp | | srv/calibre-library | /srv/calibre-library | * commands used ** bind target directory to mount point #+begin_src sh sudo mount --bind /mnt/storage/ / #+end_src *** example - *target mount:* /mnt/storage/www - *bind directory:* /var/www *** making bind mounts persistent To ensure the mounts persist after a reboot, add the following lines to `/etc/fstab`: #+begin_src sh /mnt/storage/home/website /home/website none bind 0 0 /mnt/storage/home/librarian /home/librarian none bind 0 0 /mnt/storage/var/www /var/www none bind 0 0 /mnt/storage/srv/n8n /srv/n8n none bind 0 0 #+end_src ** Setup Commands These commands ensure everything is correctly prepared before binding. | Step | Command | |----------------------------------+----------------------------------------------------------------------------------------| | Ensure storage directories exist | `sudo mkdir -p /mnt/storage/website /mnt/storage/calibre /mnt/storage/www` | | Move existing data (if needed) | `sudo mv /home/website/* /mnt/storage/website/` | | Create bind directories | `sudo mkdir -p /home/website /home/calibre /var/www` | | Bind-mount directories | `sudo mount --bind /mnt/storage/website /home/website` | | Add to `/etc/fstab` | `echo "/mnt/storage/website /home/website none bind 0 0" \vert sudo tee -a /etc/fstab` | | Apply changes | `sudo mount -a` | | Verify mount status | `df -h \vert grep storage` | ** generally useful hard drive commands | Purpose | Command | |----------------------------------+------------------------------------| | Find the UUID | lsblk -f | | Check filesystem type | sudo blkid /dev/sda2 | | Remount drive without rebooting | sudo mount -o remount /mnt/storage | | Check if new options are applied | mount \vert grep storage | | Verify changes | cat /etc/fstab \vert grep storage | * fstab ** current fstab :PROPERTIES: :ID: id-fstab-file :END: #+begin_src conf proc /proc proc defaults 0 0 PARTUUID=a587d185-01 /boot/firmware vfat defaults 0 2 PARTUUID=a587d185-02 / ext4 defaults,noatime 0 1 UUID=86ba0735-df14-425c-a037-1e397e89f9aa /mnt/storage ext4 defaults,relatime,commit=600 0 2 UUID=649f82e9-cfc0-4725-b260-d40f413bd0c3 /mnt/git ext4 defaults,noatime 0 2 /mnt/storage/home/website /home/website none bind 0 0 /mnt/storage/var/www /var/www none bind 0 0 /mnt/storage/srv/ftp /srv/ftp none bind 0 0 /srv/ftp /home/ftpuser/ftp none bind 0 0 /mnt/storage/home/librarian /home/librarian none bind 0 0 /mnt/storage/srv/calibre-library /srv/calibre-library none bind 0 0 /mnt/storage/srv/n8n /srv/n8n none bind 0 0 /mnt/git /srv/git none bind 0 0 #+end_src ** Mount Options Available | Option | Description | |-------------------+------------------------------------------------------------------------------| | defaults | Uses the default options: `rw, suid, dev, exec, auto, nouser, async`. | | rw | Mounts the filesystem as **read/write** (default). | | ro | Mounts the filesystem as **read-only**. | | noexec | Prevents execution of binaries on the mounted filesystem. | | exec | Allows execution of binaries (default). | | nosuid | Blocks `setuid`/`setgid` binaries from running. | | nodev | Ignores device files (e.g., `/dev/null`) on this filesystem. | | noatime | **Disables access time updates** to improve performance. | | nodiratime | Disables directory access time updates (for performance). | | relatime | **Updates access time only if the file is modified**, balancing performance. | | strictatime | **Always updates access time** (not recommended for performance reasons). | | sync | Writes changes to disk **immediately** instead of caching them. | | async | Writes changes to disk **asynchronously** (default, better performance). | | commit=600 | Delays disk writes for **600 seconds (10 minutes)**, reducing wear. | | nofail | Allows booting even if the mount fails (useful for external drives). | | errors=remount-ro | If an error occurs, remounts the filesystem as **read-only**. | ** Performance Options | Performance Status | Mount Options | |---------------------------------------+-------------------------------------------| | Maximum Performance | defaults, noatime, nodiratime, commit=600 | | Accurate File Access Times | defaults, relatime, commit=600 | | Extra Safety in Case of Drive Failure | errors=remount-ro, nofail |