Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mount a volume inside a qube to /mnt/removable
#!/bin/bash
if [ -z "$1" ] || [ -z "$2" ]; then
echo "${0} QUBE VOLUME"
exit 2
fi
set -xeu -o pipefail
volume=$(qvm-block | awk "/${2}/{print \$1}")
UUID=$(sudo blkid /dev/mapper/${2} -sUUID -ovalue)
qvm-start --skip-if-running $1
# check if it's already mounted
if ! qvm-block | grep "$2" | awk '{print $3}'|grep -q "$1"; then
qvm-block attach $1 $volume
fi
qvm-run -p $1 "sudo mount UUID=${UUID} /mnt/removable"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.