Files
vtl-appliance/dist/adastra-vtl-installer/scripts/fix-mhvtl-config.sh
Othman H. Suseno 01080498af feat: Major VTL System Upgrade (Auth, Monitoring, CLI, Installer)
- Web UI:
  - Added secure Authentication system (Login, 2 Roles: Admin/Viewer)
  - Added System Monitoring Dashboard (Health, Services, Power Mgmt)
  - Added User Management Interface (Create, Delete, Enable/Disable)
  - Added Device Mapping view in iSCSI tab (lsscsi output)
- Backend:
  - Implemented secure session management (auth.php)
  - Added power management APIs (restart/shutdown appliance)
  - Added device mapping API
- CLI:
  - Created global 'vtl' management tool
  - Added scripts for reliable startup (vtllibrary fix)
- Installer:
  - Updated install.sh with new dependencies (tgt, sudoers, permissions)
  - Included all new components in build-installer.sh
- Docs:
  - Consolidated documentation into docs/ folder
2025-12-09 18:15:36 +00:00

68 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# Fix MHVTL configuration to properly map drives to library
# Problem: Drive IDs must follow convention: Library_ID + Slot_Number
# For Library 10, drives should be 11, 12, 13, 14 (not 00, 01, 02, 03)
echo "Fixing MHVTL configuration..."
# Stop mhvtl service first
echo "Stopping mhvtl service..."
systemctl stop mhvtl
# Wait for processes to stop
sleep 2
# Backup current configuration
cp /etc/mhvtl/device.conf /etc/mhvtl/device.conf.backup-$(date +%Y%m%d-%H%M%S)
cp /etc/mhvtl/library_contents.10 /etc/mhvtl/library_contents.10.backup-$(date +%Y%m%d-%H%M%S)
# Fix device.conf: Change Drive IDs from 00,01,02,03 to 11,12,13,14
echo "Updating device.conf..."
sed -i 's/^Drive: 00 /Drive: 11 /' /etc/mhvtl/device.conf
sed -i 's/^Drive: 01 /Drive: 12 /' /etc/mhvtl/device.conf
sed -i 's/^Drive: 02 /Drive: 13 /' /etc/mhvtl/device.conf
sed -i 's/^Drive: 03 /Drive: 14 /' /etc/mhvtl/device.conf
# Fix library_contents.10: Map drive slots to correct drive IDs
echo "Updating library_contents.10..."
sed -i 's/^Drive 1: 00$/Drive 1: 11/' /etc/mhvtl/library_contents.10
sed -i 's/^Drive 2: 01$/Drive 2: 12/' /etc/mhvtl/library_contents.10
sed -i 's/^Drive 3: 02$/Drive 3: 13/' /etc/mhvtl/library_contents.10
sed -i 's/^Drive 4: 03$/Drive 4: 14/' /etc/mhvtl/library_contents.10
# Remove old lock files
rm -f /var/lock/mhvtl/mhvtl* 2>/dev/null || true
# Verify changes
echo ""
echo "=== Updated device.conf ==="
grep -E "^(Library|Drive):" /etc/mhvtl/device.conf
echo ""
echo "=== Updated library_contents.10 ==="
head -10 /etc/mhvtl/library_contents.10
echo ""
# Start mhvtl service
echo "Starting mhvtl service..."
systemctl start mhvtl
# Wait for devices to initialize
sleep 3
# Check status
echo ""
echo "=== MHVTL Service Status ==="
systemctl status mhvtl --no-pager -l
echo ""
echo "=== Running Processes ==="
ps aux | grep -E "(vtltape|vtllibrary)" | grep -v grep
echo ""
echo "=== SCSI Devices ==="
lsscsi -g
echo ""
echo "Fix completed!"