Unverified Commit 6f4ea819 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

feat: New disk pass-through method (#714)

parent 6d162744
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -114,12 +114,9 @@ docker run -it --rm --name dsm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMI
   It is possible to pass-through disk devices directly by adding them to your compose file in this way:

  ```yaml
  environment:
    DEVICE2: "/dev/sda"
    DEVICE3: "/dev/sdb"
  devices:
    - /dev/sda
    - /dev/sdb
    - /dev/disk/by-uuid/12345-12345-12345-12345-12345:/dev/disk2
    - /dev/disk/by-uuid/45678-45678-45678-45678-45678:/dev/disk3
  ```

  Please note that the device needs to be totally empty (without any partition table) otherwise DSM does not always format it into a volume.
+5 −0
Original line number Diff line number Diff line
@@ -527,6 +527,11 @@ DISK4_FILE="/storage4/data4"
: "${DEVICE3:=""}"
: "${DEVICE4:=""}"

[ -z "$DEVICE" ] && [ -b "/dev/disk1" ] && DEVICE="/dev/disk1"
[ -z "$DEVICE2" ] && [ -b "/dev/disk2" ] && DEVICE2="/dev/disk2"
[ -z "$DEVICE3" ] && [ -b "/dev/disk3" ] && DEVICE3="/dev/disk3"
[ -z "$DEVICE4" ] && [ -b "/dev/disk4" ] && DEVICE4="/dev/disk4"

if [ -n "$DEVICE" ]; then
  addDevice "$DEVICE" "device" "3" "0xc" || exit $?
else
+3 −3
Original line number Diff line number Diff line
#!/usr/bin/env bash
set -Eeuo pipefail

info () { printf "%b%s%b" "\E[1;34m❯ \E[1;36m" "$1" "\E[0m\n"; }
error () { printf "%b%s%b" "\E[1;31m❯ " "ERROR: $1" "\E[0m\n" >&2; }
warn () { printf "%b%s%b" "\E[1;31m❯ " "Warning: $1" "\E[0m\n" >&2; }
info () { printf "%b%s%b" "\E[1;34m❯ \E[1;36m" "${1:-}" "\E[0m\n"; }
error () { printf "%b%s%b" "\E[1;31m❯ " "ERROR: ${1:-}" "\E[0m\n" >&2; }
warn () { printf "%b%s%b" "\E[1;31m❯ " "Warning: ${1:-}" "\E[0m\n" >&2; }

trap 'error "Status $? while: $BASH_COMMAND (line $LINENO/$BASH_LINENO)"' ERR