Initial commit: Adastra VTL Linux Distribution- Complete build system for VTL-focused Linux distro- mhvtl integration with 4 LTO drives and media changer- iSCSI target configuration for network connectivity- Automated installation and configuration scripts- Comprehensive documentation (architecture, installation, configuration)- Systemd service files and kernel tuning- Quick start wizard for easy setup

This commit is contained in:
Othman Suseno
2025-12-08 17:16:34 +00:00
commit fc2fb763f5
12 changed files with 1759 additions and 0 deletions

104
scripts/configure-iscsi.sh Executable file
View File

@@ -0,0 +1,104 @@
#!/bin/bash
set -e
echo "=========================================="
echo " iSCSI Target Configuration Script"
echo "=========================================="
echo ""
if [ "$EUID" -ne 0 ]; then
echo "Error: This script must be run as root"
exit 1
fi
TGT_CONFIG_DIR="/etc/tgt/conf.d"
ISCSI_IQN_BASE="iqn.2024-01.com.vtl-linux"
echo "[1/4] Installing iSCSI target software..."
apt-get update
apt-get install -y tgt
echo "[2/4] Configuring iSCSI targets..."
mkdir -p "$TGT_CONFIG_DIR"
cat > "$TGT_CONFIG_DIR/vtl-targets.conf" << 'EOF'
<target iqn.2024-01.com.vtl-linux:vtl.lun0>
backing-store /dev/sg1
initiator-address ALL
incominguser vtl-user vtl-password
write-cache on
</target>
<target iqn.2024-01.com.vtl-linux:vtl.lun1>
backing-store /dev/sg2
initiator-address ALL
incominguser vtl-user vtl-password
write-cache on
</target>
<target iqn.2024-01.com.vtl-linux:vtl.lun2>
backing-store /dev/sg3
initiator-address ALL
incominguser vtl-user vtl-password
write-cache on
</target>
<target iqn.2024-01.com.vtl-linux:vtl.lun3>
backing-store /dev/sg4
initiator-address ALL
incominguser vtl-user vtl-password
write-cache on
</target>
<target iqn.2024-01.com.vtl-linux:vtl.changer>
backing-store /dev/sg0
initiator-address ALL
incominguser vtl-user vtl-password
device-type changer
</target>
EOF
echo "[3/4] Configuring firewall..."
if command -v ufw &> /dev/null; then
ufw allow 3260/tcp
ufw reload
elif command -v firewall-cmd &> /dev/null; then
firewall-cmd --permanent --add-port=3260/tcp
firewall-cmd --reload
else
iptables -A INPUT -p tcp --dport 3260 -j ACCEPT
iptables-save > /etc/iptables/rules.v4
fi
echo "[4/4] Starting iSCSI target service..."
systemctl enable tgt
systemctl restart tgt
sleep 2
echo ""
echo "=========================================="
echo " iSCSI Target Configuration Complete!"
echo "=========================================="
echo ""
echo "Available targets:"
tgt-admin --show
echo ""
echo "Connection information:"
echo " - Port: 3260"
echo " - IQN Base: $ISCSI_IQN_BASE"
echo " - Username: vtl-user"
echo " - Password: vtl-password"
echo ""
echo "Client connection examples:"
echo ""
echo "Linux:"
echo " iscsiadm -m discovery -t st -p <SERVER_IP>:3260"
echo " iscsiadm -m node --login"
echo ""
echo "Windows:"
echo " iscsicli QAddTargetPortal <SERVER_IP>"
echo " iscsicli ListTargets"
echo " iscsicli LoginTarget <target_name> T * * * * * * * * * * * * * * * <username> <password>"
echo ""

133
scripts/install-mhvtl.sh Executable file
View File

@@ -0,0 +1,133 @@
#!/bin/bash
set -e
echo "=========================================="
echo " mhvtl Installation Script"
echo "=========================================="
echo ""
if [ "$EUID" -ne 0 ]; then
echo "Error: This script must be run as root"
exit 1
fi
MHVTL_VERSION="1.6-7"
MHVTL_DIR="/opt/mhvtl"
MHVTL_CONFIG="/etc/mhvtl"
echo "[1/5] Installing build dependencies..."
apt-get update
apt-get install -y \
build-essential \
git \
zlib1g-dev \
libibverbs-dev \
libconfig-dev \
libssl-dev \
uuid-dev \
linux-headers-$(uname -r) \
mt-st \
mtx \
lsscsi \
sg3-utils
echo "[2/5] Downloading mhvtl source..."
cd /tmp
if [ -d "mhvtl" ]; then
rm -rf mhvtl
fi
git clone https://github.com/markh794/mhvtl.git
cd mhvtl
echo "[3/5] Building mhvtl..."
make
echo "[4/5] Installing mhvtl..."
make install
echo "[5/5] Configuring mhvtl..."
mkdir -p "$MHVTL_DIR"
mkdir -p "$MHVTL_CONFIG"
if [ ! -f "$MHVTL_CONFIG/device.conf" ]; then
cat > "$MHVTL_CONFIG/device.conf" << 'EOF'
VERSION: 5
Library: 10 CHANNEL: 00 TARGET: 00 LUN: 00
Vendor identification: STK
Product identification: L700
Unit serial number: XYZZY_A
NAA: 10:22:33:44:ab:cd:ef:00
Home directory: /opt/mhvtl
Backoff: 400
Drive: 00 CHANNEL: 00 TARGET: 01 LUN: 00
Library ID: 10 Slot: 01
Vendor identification: IBM
Product identification: ULT3580-TD5
Unit serial number: XYZZY_A1
NAA: 10:22:33:44:ab:cd:ef:01
Compression: factor 3 enabled 1
Compression type: lzo
Backoff: 400
Drive: 01 CHANNEL: 00 TARGET: 02 LUN: 00
Library ID: 10 Slot: 02
Vendor identification: IBM
Product identification: ULT3580-TD5
Unit serial number: XYZZY_A2
NAA: 10:22:33:44:ab:cd:ef:02
Compression: factor 3 enabled 1
Compression type: lzo
Backoff: 400
Drive: 02 CHANNEL: 00 TARGET: 03 LUN: 00
Library ID: 10 Slot: 03
Vendor identification: IBM
Product identification: ULT3580-TD6
Unit serial number: XYZZY_A3
NAA: 10:22:33:44:ab:cd:ef:03
Compression: factor 3 enabled 1
Compression type: lzo
Backoff: 400
Drive: 03 CHANNEL: 00 TARGET: 04 LUN: 00
Library ID: 10 Slot: 04
Vendor identification: IBM
Product identification: ULT3580-TD6
Unit serial number: XYZZY_A4
NAA: 10:22:33:44:ab:cd:ef:04
Compression: factor 3 enabled 1
Compression type: lzo
Backoff: 400
EOF
fi
if [ ! -f "$MHVTL_CONFIG/library_contents.10" ]; then
/usr/bin/mktape -l 10 -s 100 -m /opt/mhvtl -t LTO5 -d 20
fi
modprobe mhvtl
systemctl daemon-reload
systemctl enable mhvtl
systemctl start mhvtl
echo ""
echo "=========================================="
echo " mhvtl Installation Complete!"
echo "=========================================="
echo ""
echo "Configuration:"
echo " - Config directory: $MHVTL_CONFIG"
echo " - Data directory: $MHVTL_DIR"
echo " - Library: STK L700 (ID: 10)"
echo " - Drives: 4x LTO-5/6 drives"
echo " - Media: 20 LTO-5 tapes"
echo ""
echo "Check status:"
echo " systemctl status mhvtl"
echo " lsscsi -g"
echo " mtx -f /dev/sg0 status"
echo ""

114
scripts/post-install.sh Executable file
View File

@@ -0,0 +1,114 @@
#!/bin/bash
set -e
echo "=========================================="
echo " VTL Linux Post-Install Setup"
echo "=========================================="
echo ""
if [ "$EUID" -ne 0 ]; then
echo "Error: This script must be run as root"
exit 1
fi
echo "[1/5] Applying system optimizations..."
if [ -f "/tmp/sysctl-vtl.conf" ]; then
cp /tmp/sysctl-vtl.conf /etc/sysctl.d/99-vtl.conf
sysctl -p /etc/sysctl.d/99-vtl.conf
fi
echo "[2/5] Installing mhvtl..."
if [ -f "/usr/local/bin/install-mhvtl.sh" ]; then
bash /usr/local/bin/install-mhvtl.sh
else
echo "Warning: mhvtl installation script not found"
fi
echo "[3/5] Configuring iSCSI targets..."
if [ -f "/usr/local/bin/configure-iscsi.sh" ]; then
bash /usr/local/bin/configure-iscsi.sh
else
echo "Warning: iSCSI configuration script not found"
fi
echo "[4/5] Setting up monitoring..."
cat > /usr/local/bin/vtl-status << 'EOF'
#!/bin/bash
echo "=========================================="
echo " VTL System Status"
echo "=========================================="
echo ""
echo "=== mhvtl Status ==="
systemctl status mhvtl --no-pager | head -n 10
echo ""
echo "=== SCSI Devices ==="
lsscsi -g
echo ""
echo "=== Library Status ==="
if [ -e /dev/sg0 ]; then
mtx -f /dev/sg0 status 2>/dev/null || echo "Library not ready"
fi
echo ""
echo "=== iSCSI Targets ==="
tgt-admin --show
echo ""
echo "=== Network Interfaces ==="
ip -br addr
echo ""
echo "=== Disk Usage ==="
df -h /opt/mhvtl 2>/dev/null || echo "/opt/mhvtl not mounted"
echo ""
EOF
chmod +x /usr/local/bin/vtl-status
echo "[5/5] Creating welcome message..."
cat > /etc/motd << 'EOF'
__ _______ _ _ _
\ \ / /_ _| | | | (_)
\ \ / / | | | | | | _ _ __ _ ___ __
\ \/ / | | | | | | | | '_ \| | | \ \/ /
\ / _| |_| |____ | |___| | | | | |_| |> <
\/ |_____|______||_____|_|_| |_|\__,_/_/\_\
Virtual Tape Library Distribution v1.0
========================================
Quick Commands:
vtl-status - Show VTL system status
systemctl status mhvtl - Check mhvtl service
lsscsi -g - List SCSI devices
tgt-admin --show - Show iSCSI targets
Default Credentials:
User: vtladmin / Password: vtladmin
Root: root / Password: vtlroot
iSCSI Authentication:
Username: vtl-user
Password: vtl-password
========================================
EOF
echo ""
echo "=========================================="
echo " Post-Install Setup Complete!"
echo "=========================================="
echo ""
echo "Next steps:"
echo " 1. Configure network settings"
echo " 2. Change default passwords"
echo " 3. Customize mhvtl configuration in /etc/mhvtl/"
echo " 4. Update iSCSI targets in /etc/tgt/conf.d/"
echo " 5. Run 'vtl-status' to verify setup"
echo ""