Skip to content

Commit

Permalink
feat: Mount block device
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Oct 10, 2023
1 parent eacb9dc commit 5e3d4e8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions run/disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ if [ -f "${DATA2}" ]; then
-drive file=${DATA2},if=none,id=drive-userdata2,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \
-device scsi-hd,bus=hw-userdata2.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata2,id=userdata2,rotation_rate=${DISK_ROTATION},bootindex=4"

else

[ -d "/storage2" ] && error "Disk image ${DATA2} does not exist! Use an empty file of at least 6 GB." && exit 53

fi

DATA3="/storage3/data.img"
Expand All @@ -174,11 +178,17 @@ if [ -f "${DATA3}" ]; then
-drive file=${DATA3},if=none,id=drive-userdata3,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \
-device scsi-hd,bus=hw-userdata3.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata3,id=userdata3,rotation_rate=${DISK_ROTATION},bootindex=5"

else

[ -d "/storage3" ] && error "Disk image ${DATA3} does not exist! Use an empty file of at least 6 GB." && exit 54

fi

DEVICE="/device"
: ${DEVICE:=''} # Docker variable to passthrough a block device, like /dev/vdc1.

if [ -n "${DEVICE}" ]; then

if [ -d "${DEVICE}" ]; then
[ ! -b "${DEVICE}" ] && error "Device ${DEVICE} cannot be found! Please add it to the 'devices' section of your compose file." && exit 55

DISK_OPTS="${DISK_OPTS} \
-device virtio-scsi-pci,id=hw-userdata4,bus=pcie.0,addr=0xf \
Expand Down

0 comments on commit 5e3d4e8

Please sign in to comment.