Loading readme.md +2 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,8 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti DISK_SIZE: "256G" ``` This can also be used to resize the existing disk to a larger capacity without data loss. * ### 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: Loading run/disk.sh +14 −5 Original line number Diff line number Diff line Loading @@ -39,7 +39,9 @@ if [ -f "${DATA}" ]; then if [[ "${ALLOCATE}" == [Nn]* ]]; then # Resize file by changing its length truncate -s "${DATA_SIZE}" "${DATA}"; if ! truncate -s "${DATA_SIZE}" "${DATA}"; then error "Could not resize the file for the virtual disk." && exit 85 fi else Loading @@ -55,7 +57,9 @@ if [ -f "${DATA}" ]; then # Resize file by allocating more space if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then error "Could not allocate a file for the virtual disk." && exit 85 if ! truncate -s "${DATA_SIZE}" "${DATA}"; then error "Could not resize the file for the virtual disk." && exit 85 fi fi if [[ "${ALLOCATE}" == [Zz]* ]]; then Loading Loading @@ -84,7 +88,10 @@ if [ ! -f "${DATA}" ]; then if [[ "${ALLOCATE}" == [Nn]* ]]; then # Create an empty file truncate -s "${DATA_SIZE}" "${DATA}" if ! truncate -s "${DATA_SIZE}" "${DATA}"; then rm -f "${DATA}" error "Could not create a file for the virtual disk." && exit 87 fi else Loading @@ -98,8 +105,10 @@ if [ ! -f "${DATA}" ]; then # Create an empty file if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then if ! truncate -s "${DATA_SIZE}" "${DATA}"; then rm -f "${DATA}" error "Could not allocate a file for the virtual disk." && exit 87 error "Could not create a file for the virtual disk." && exit 87 fi fi if [[ "${ALLOCATE}" == [Zz]* ]]; then Loading run/install.sh +3 −1 Original line number Diff line number Diff line Loading @@ -179,8 +179,10 @@ SPACE=$(df --output=avail -B 1 "$TMP" | tail -n 1) (( SYSTEM_SIZE > SPACE )) && error "Not enough free space to create a 4 GB system disk." && exit 87 if ! fallocate -l "${SYSTEM_SIZE}" "${SYSTEM}"; then if ! truncate -s "${SYSTEM_SIZE}" "${SYSTEM}"; then rm -f "${SYSTEM}" && error "Could not allocate a file for the system disk." && exit 88 fi fi if [[ "${ALLOCATE}" == [Zz]* ]]; then info "Install: Preallocating 4 GB of diskspace..." Loading run/run.sh +2 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ trap 'error "Status $? while: ${BASH_COMMAND} (line $LINENO/$BASH_LINENO)"' ERR STORAGE="/storage" KERNEL=$(uname -r | cut -b 1) MINOR=$(uname -r | cut -d '.' -f2) ARCH=$(dpkg --print-architecture) VERS=$(qemu-system-x86_64 --version | head -n 1 | cut -d '(' -f 1) Loading Loading @@ -92,7 +93,7 @@ set -m ) set +m if (( KERNEL > 4 )); then if (( KERNEL > 5 )) || ( (( KERNEL == 5 )) && (( MINOR > 2 )) ); then pidwait -F "${_QEMU_PID}" & wait $! else tail --pid "$(cat "${_QEMU_PID}")" --follow /dev/null & wait $! Loading Loading
readme.md +2 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,8 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti DISK_SIZE: "256G" ``` This can also be used to resize the existing disk to a larger capacity without data loss. * ### 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: Loading
run/disk.sh +14 −5 Original line number Diff line number Diff line Loading @@ -39,7 +39,9 @@ if [ -f "${DATA}" ]; then if [[ "${ALLOCATE}" == [Nn]* ]]; then # Resize file by changing its length truncate -s "${DATA_SIZE}" "${DATA}"; if ! truncate -s "${DATA_SIZE}" "${DATA}"; then error "Could not resize the file for the virtual disk." && exit 85 fi else Loading @@ -55,7 +57,9 @@ if [ -f "${DATA}" ]; then # Resize file by allocating more space if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then error "Could not allocate a file for the virtual disk." && exit 85 if ! truncate -s "${DATA_SIZE}" "${DATA}"; then error "Could not resize the file for the virtual disk." && exit 85 fi fi if [[ "${ALLOCATE}" == [Zz]* ]]; then Loading Loading @@ -84,7 +88,10 @@ if [ ! -f "${DATA}" ]; then if [[ "${ALLOCATE}" == [Nn]* ]]; then # Create an empty file truncate -s "${DATA_SIZE}" "${DATA}" if ! truncate -s "${DATA_SIZE}" "${DATA}"; then rm -f "${DATA}" error "Could not create a file for the virtual disk." && exit 87 fi else Loading @@ -98,8 +105,10 @@ if [ ! -f "${DATA}" ]; then # Create an empty file if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then if ! truncate -s "${DATA_SIZE}" "${DATA}"; then rm -f "${DATA}" error "Could not allocate a file for the virtual disk." && exit 87 error "Could not create a file for the virtual disk." && exit 87 fi fi if [[ "${ALLOCATE}" == [Zz]* ]]; then Loading
run/install.sh +3 −1 Original line number Diff line number Diff line Loading @@ -179,8 +179,10 @@ SPACE=$(df --output=avail -B 1 "$TMP" | tail -n 1) (( SYSTEM_SIZE > SPACE )) && error "Not enough free space to create a 4 GB system disk." && exit 87 if ! fallocate -l "${SYSTEM_SIZE}" "${SYSTEM}"; then if ! truncate -s "${SYSTEM_SIZE}" "${SYSTEM}"; then rm -f "${SYSTEM}" && error "Could not allocate a file for the system disk." && exit 88 fi fi if [[ "${ALLOCATE}" == [Zz]* ]]; then info "Install: Preallocating 4 GB of diskspace..." Loading
run/run.sh +2 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ trap 'error "Status $? while: ${BASH_COMMAND} (line $LINENO/$BASH_LINENO)"' ERR STORAGE="/storage" KERNEL=$(uname -r | cut -b 1) MINOR=$(uname -r | cut -d '.' -f2) ARCH=$(dpkg --print-architecture) VERS=$(qemu-system-x86_64 --version | head -n 1 | cut -d '(' -f 1) Loading Loading @@ -92,7 +93,7 @@ set -m ) set +m if (( KERNEL > 4 )); then if (( KERNEL > 5 )) || ( (( KERNEL == 5 )) && (( MINOR > 2 )) ); then pidwait -F "${_QEMU_PID}" & wait $! else tail --pid "$(cat "${_QEMU_PID}")" --follow /dev/null & wait $! Loading