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

feat: Set NOCOW flag for btrfs

feat: Set NOCOW flag for btrfs
parents 932c23af d66be1a2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,6 +18,6 @@ services:
        ports:
            - 5000:5000
        volumes:
            - /opt/dsm:/storage
            - /var/dsm:/storage
        restart: on-failure
        stop_grace_period: 2m
+5 −5
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ services:
    ports:
      - 5000:5000
    volumes:
      - /opt/dsm:/storage
      - /var/dsm:/storage
    restart: on-failure
    stop_grace_period: 2m
```
@@ -65,14 +65,14 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti

  * ### How do I change the location of the virtual disk?

    To change the virtual disk's location from the default Docker volume, include the following bind mount in your compose file:
    To change the location of the virtual disk, include the following bind mount in your compose file:

    ```yaml
    volumes:
      - /home/user/data:/storage
      - /var/dsm:/storage
    ```

    Replace the example path `/home/user/data` with the desired storage folder.
    Replace the example path `/var/dsm` with the desired storage folder.

  * ### How do I add multiple disks?

@@ -170,7 +170,7 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
      - 'c *:* rwm'
    ```

    Please note that even if you don't need DHCP, it's still recommended to enable this feature as it prevents NAT issues and increases performance by using a `macvtap` interface.
    Please note that even if you don't want DHCP, it's still recommended to enable this feature as it prevents NAT issues and increases performance by using a `macvtap` interface. In that case just set a static IP from the DSM control panel after you enabled this mode.

  * ### How do I passthrough the GPU?

+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ if [[ "$ARCH" == "amd64" && "$KVM" != [Nn]* ]]; then

  if [ -n "$KVM_OPTS" ]; then
    if ! grep -qE '^flags.* (sse4_2)' /proc/cpuinfo; then
      error "Your host CPU does not has the SSE4.2 instruction set that Virtual DSM requires to boot."
      error "Your host CPU does not have the SSE4.2 instruction set that Virtual DSM requires to boot."
      error "Disable KVM by setting KVM=N to emulate a compatible CPU, at the cost of performance."
      [[ "$DEBUG" != [Yy1]* ]] && exit 89
    fi
+9 −8
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ set -Eeuo pipefail
: ${DISK_CACHE:='none'}         # Caching mode, can be set to 'writeback' for better performance
: ${DISK_DISCARD:='on'}         # Controls whether unmap (TRIM) commands are passed to the host.
: ${DISK_ROTATION:='1'}         # Rotation rate, set to 1 for SSD storage and increase for HDD
: ${DISK_FLAGS:='nocow=on'}     # Specify the options for use with the qcow2 format

BOOT="$STORAGE/$BASE.boot.img"
SYSTEM="$STORAGE/$BASE.system.img"
@@ -137,12 +138,12 @@ convertDisk() {

  case "$DST_FMT" in
    qcow2)
      CONV_FLAGS="$CONV_FLAGS -c"
      CONV_FLAGS="$CONV_FLAGS -c -o $DISK_FLAGS"
      ;;
  esac

  # shellcheck disable=SC2086
  qemu-img convert $CONV_FLAGS -f "$SOURCE_FMT" -O "$DST_FMT" -- "$SOURCE_FILE" "$DST_FILE"
  qemu-img convert -f "$SOURCE_FMT" $CONV_FLAGS -O "$DST_FMT" -- "$SOURCE_FILE" "$DST_FILE"
}

createDisk() {
@@ -186,7 +187,7 @@ createDisk() {
      fi
      ;;
    qcow2)
      if ! qemu-img create -f "$DISK_FMT" -- "$DISK_FILE" "$DISK_SPACE" ; then
      if ! qemu-img create -f "$DISK_FMT" -o "$DISK_FLAGS" -- "$DISK_FILE" "$DISK_SPACE" ; then
        rm -f "$DISK_FILE"
        error "$FAIL" && exit 70
      fi
+2 −2
Original line number Diff line number Diff line
@@ -5,8 +5,8 @@ set -Eeuo pipefail

QEMU_PORT=7100
QEMU_TIMEOUT=50
QEMU_PID=/run/qemu.pid
QEMU_COUNT=/run/qemu.count
QEMU_PID="/run/qemu.pid"
QEMU_COUNT="/run/qemu.count"

rm -f "$QEMU_PID"
rm -f "$QEMU_COUNT"
Loading