409 lines
8.5 KiB
Markdown
409 lines
8.5 KiB
Markdown
# VTL Linux - Configuration Examples
|
|
|
|
## mhvtl Device Configuration
|
|
|
|
### Basic LTO-5 Library Setup
|
|
|
|
```conf
|
|
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
|
|
```
|
|
|
|
### Multi-Drive LTO-6/7/8 Setup
|
|
|
|
```conf
|
|
VERSION: 5
|
|
|
|
Library: 20 CHANNEL: 00 TARGET: 00 LUN: 00
|
|
Vendor identification: IBM
|
|
Product identification: 03584L32
|
|
Unit serial number: XYZZY_B
|
|
NAA: 20:22:33:44:ab:cd:ef:00
|
|
Home directory: /opt/mhvtl
|
|
Backoff: 400
|
|
|
|
Drive: 10 CHANNEL: 00 TARGET: 01 LUN: 00
|
|
Library ID: 20 Slot: 01
|
|
Vendor identification: IBM
|
|
Product identification: ULT3580-TD6
|
|
Unit serial number: XYZZY_B1
|
|
NAA: 20:22:33:44:ab:cd:ef:01
|
|
Compression: factor 3 enabled 1
|
|
Compression type: lzo
|
|
Backoff: 400
|
|
|
|
Drive: 11 CHANNEL: 00 TARGET: 02 LUN: 00
|
|
Library ID: 20 Slot: 02
|
|
Vendor identification: IBM
|
|
Product identification: ULT3580-TD7
|
|
Unit serial number: XYZZY_B2
|
|
NAA: 20:22:33:44:ab:cd:ef:02
|
|
Compression: factor 3 enabled 1
|
|
Compression type: lzo
|
|
Backoff: 400
|
|
|
|
Drive: 12 CHANNEL: 00 TARGET: 03 LUN: 00
|
|
Library ID: 20 Slot: 03
|
|
Vendor identification: IBM
|
|
Product identification: ULT3580-TD8
|
|
Unit serial number: XYZZY_B3
|
|
NAA: 20:22:33:44:ab:cd:ef:03
|
|
Compression: factor 3 enabled 1
|
|
Compression type: lzo
|
|
Backoff: 400
|
|
```
|
|
|
|
## iSCSI Target Configuration
|
|
|
|
### Basic Target with CHAP Authentication
|
|
|
|
```conf
|
|
<target iqn.2024-01.com.vtl-linux:vtl.drive0>
|
|
backing-store /dev/sg1
|
|
initiator-address ALL
|
|
incominguser vtl-user vtl-password
|
|
write-cache on
|
|
</target>
|
|
```
|
|
|
|
### Target with IP Restrictions
|
|
|
|
```conf
|
|
<target iqn.2024-01.com.vtl-linux:vtl.drive0>
|
|
backing-store /dev/sg1
|
|
initiator-address 192.168.1.0/24
|
|
initiator-address 10.0.0.50
|
|
incominguser backup-server secure-password-here
|
|
write-cache on
|
|
</target>
|
|
```
|
|
|
|
### Multiple Targets for Different Clients
|
|
|
|
```conf
|
|
<target iqn.2024-01.com.vtl-linux:vtl.client1>
|
|
backing-store /dev/sg1
|
|
initiator-address 192.168.1.100
|
|
incominguser client1 password1
|
|
write-cache on
|
|
</target>
|
|
|
|
<target iqn.2024-01.com.vtl-linux:vtl.client2>
|
|
backing-store /dev/sg2
|
|
initiator-address 192.168.1.101
|
|
incominguser client2 password2
|
|
write-cache on
|
|
</target>
|
|
|
|
<target iqn.2024-01.com.vtl-linux:vtl.changer>
|
|
backing-store /dev/sg0
|
|
initiator-address 192.168.1.0/24
|
|
incominguser vtl-admin admin-password
|
|
device-type changer
|
|
</target>
|
|
```
|
|
|
|
### Target with Mutual CHAP
|
|
|
|
```conf
|
|
<target iqn.2024-01.com.vtl-linux:vtl.secure>
|
|
backing-store /dev/sg1
|
|
initiator-address 192.168.1.100
|
|
incominguser vtl-user vtl-password
|
|
outgoinguser initiator-user initiator-password
|
|
write-cache on
|
|
</target>
|
|
```
|
|
|
|
## Kernel Tuning
|
|
|
|
### High-Performance Network Configuration
|
|
|
|
```conf
|
|
net.core.rmem_max = 268435456
|
|
net.core.wmem_max = 268435456
|
|
net.core.rmem_default = 33554432
|
|
net.core.wmem_default = 33554432
|
|
net.ipv4.tcp_rmem = 4096 87380 134217728
|
|
net.ipv4.tcp_wmem = 4096 65536 134217728
|
|
net.ipv4.tcp_congestion_control = bbr
|
|
net.ipv4.tcp_mtu_probing = 1
|
|
net.core.netdev_max_backlog = 10000
|
|
net.ipv4.tcp_no_metrics_save = 1
|
|
net.ipv4.tcp_timestamps = 1
|
|
net.ipv4.tcp_sack = 1
|
|
net.ipv4.tcp_window_scaling = 1
|
|
|
|
net.core.default_qdisc = fq
|
|
```
|
|
|
|
### Storage-Optimized Configuration
|
|
|
|
```conf
|
|
vm.swappiness = 1
|
|
vm.dirty_ratio = 10
|
|
vm.dirty_background_ratio = 3
|
|
vm.vfs_cache_pressure = 50
|
|
|
|
kernel.sched_migration_cost_ns = 5000000
|
|
kernel.sched_autogroup_enabled = 0
|
|
```
|
|
|
|
## Backup Software Integration
|
|
|
|
### Bacula Configuration
|
|
|
|
```conf
|
|
Autochanger {
|
|
Name = VTL-Library
|
|
Device = Drive-0, Drive-1, Drive-2, Drive-3
|
|
Changer Command = "/usr/lib/bacula/scripts/mtx-changer %c %o %S %a %d"
|
|
Changer Device = /dev/sg0
|
|
}
|
|
|
|
Device {
|
|
Name = Drive-0
|
|
Media Type = LTO-5
|
|
Archive Device = /dev/nst0
|
|
AutomaticMount = yes
|
|
AlwaysOpen = yes
|
|
RemovableMedia = yes
|
|
RandomAccess = no
|
|
AutoChanger = yes
|
|
Drive Index = 0
|
|
Maximum Spool Size = 10G
|
|
Spool Directory = /var/spool/bacula
|
|
}
|
|
|
|
Device {
|
|
Name = Drive-1
|
|
Media Type = LTO-5
|
|
Archive Device = /dev/nst1
|
|
AutomaticMount = yes
|
|
AlwaysOpen = yes
|
|
RemovableMedia = yes
|
|
RandomAccess = no
|
|
AutoChanger = yes
|
|
Drive Index = 1
|
|
Maximum Spool Size = 10G
|
|
Spool Directory = /var/spool/bacula
|
|
}
|
|
```
|
|
|
|
### Amanda Configuration
|
|
|
|
```conf
|
|
tapedev "chg-robot:/dev/sg0"
|
|
tpchanger "chg-robot"
|
|
changerfile "/var/lib/amanda/vtl/changer"
|
|
changerdev "/dev/sg0"
|
|
|
|
tapetype LTO-5
|
|
define tapetype LTO-5 {
|
|
comment "LTO-5 Virtual Tape"
|
|
length 1500000 mbytes
|
|
filemark 0 kbytes
|
|
speed 140000 kps
|
|
}
|
|
|
|
labelstr "^VTL-[0-9][0-9]*$"
|
|
autolabel "VTL-%%%" EMPTY VOLUME_ERROR
|
|
```
|
|
|
|
### Veritas Backup Exec (Windows)
|
|
|
|
1. Configure iSCSI initiator to connect to VTL server
|
|
2. In Backup Exec, go to Storage → Configure Storage
|
|
3. Select "Tape Drive" → "Detect and configure"
|
|
4. Backup Exec will auto-detect the tape library
|
|
5. Configure media sets and backup jobs
|
|
|
|
## Network Configuration Examples
|
|
|
|
### Static IP Configuration (NetworkManager)
|
|
|
|
```bash
|
|
nmcli con add type ethernet con-name vtl-network ifname eth0 \
|
|
ipv4.addresses 192.168.1.100/24 \
|
|
ipv4.gateway 192.168.1.1 \
|
|
ipv4.dns "8.8.8.8,8.8.4.4" \
|
|
ipv4.method manual
|
|
|
|
nmcli con up vtl-network
|
|
```
|
|
|
|
### Bonded Network Interface
|
|
|
|
```bash
|
|
nmcli con add type bond con-name bond0 ifname bond0 mode active-backup
|
|
nmcli con add type ethernet con-name bond0-slave1 ifname eth0 master bond0
|
|
nmcli con add type ethernet con-name bond0-slave2 ifname eth1 master bond0
|
|
nmcli con mod bond0 ipv4.addresses 192.168.1.100/24 \
|
|
ipv4.gateway 192.168.1.1 \
|
|
ipv4.method manual
|
|
nmcli con up bond0
|
|
```
|
|
|
|
### VLAN Configuration
|
|
|
|
```bash
|
|
nmcli con add type vlan con-name vlan100 ifname eth0.100 dev eth0 id 100
|
|
nmcli con mod vlan100 ipv4.addresses 192.168.100.100/24 \
|
|
ipv4.method manual
|
|
nmcli con up vlan100
|
|
```
|
|
|
|
## Firewall Configuration
|
|
|
|
### UFW (Ubuntu/Debian)
|
|
|
|
```bash
|
|
ufw allow from 192.168.1.0/24 to any port 3260 proto tcp
|
|
ufw allow 22/tcp
|
|
ufw enable
|
|
```
|
|
|
|
### firewalld (RHEL/CentOS)
|
|
|
|
```bash
|
|
firewall-cmd --permanent --add-port=3260/tcp
|
|
firewall-cmd --permanent --add-service=ssh
|
|
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port="3260" protocol="tcp" accept'
|
|
firewall-cmd --reload
|
|
```
|
|
|
|
### iptables
|
|
|
|
```bash
|
|
iptables -A INPUT -p tcp -s 192.168.1.0/24 --dport 3260 -j ACCEPT
|
|
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
|
|
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
|
iptables -A INPUT -j DROP
|
|
iptables-save > /etc/iptables/rules.v4
|
|
```
|
|
|
|
## Monitoring Scripts
|
|
|
|
### Tape Usage Monitor
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
|
|
MHVTL_DIR="/opt/mhvtl"
|
|
THRESHOLD=80
|
|
|
|
usage=$(df -h "$MHVTL_DIR" | awk 'NR==2 {print $5}' | sed 's/%//')
|
|
|
|
if [ "$usage" -gt "$THRESHOLD" ]; then
|
|
echo "WARNING: VTL storage usage at ${usage}%"
|
|
echo "Consider adding more disk space or removing old tapes"
|
|
fi
|
|
|
|
echo "Current tape inventory:"
|
|
ls -lh "$MHVTL_DIR"/*.data 2>/dev/null | wc -l
|
|
```
|
|
|
|
### iSCSI Connection Monitor
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
|
|
echo "Active iSCSI connections:"
|
|
netstat -tn | grep :3260 | grep ESTABLISHED | wc -l
|
|
|
|
echo ""
|
|
echo "Connection details:"
|
|
netstat -tn | grep :3260 | grep ESTABLISHED
|
|
```
|
|
|
|
## Systemd Service Customization
|
|
|
|
### Custom mhvtl Service with Resource Limits
|
|
|
|
```ini
|
|
[Unit]
|
|
Description=mhvtl Virtual Tape Library
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=forking
|
|
ExecStartPre=/sbin/modprobe mhvtl
|
|
ExecStart=/usr/bin/vtltape
|
|
ExecStart=/usr/bin/vtllibrary
|
|
ExecStop=/usr/bin/killall vtltape vtllibrary
|
|
Restart=on-failure
|
|
RestartSec=5s
|
|
|
|
CPUQuota=50%
|
|
MemoryLimit=2G
|
|
IOWeight=500
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
```
|
|
|
|
### Auto-restart on Failure
|
|
|
|
```ini
|
|
[Service]
|
|
Restart=always
|
|
RestartSec=10s
|
|
StartLimitInterval=200
|
|
StartLimitBurst=5
|
|
```
|
|
|
|
## Maintenance Scripts
|
|
|
|
### Tape Cleanup Script
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
|
|
MHVTL_DIR="/opt/mhvtl"
|
|
DAYS_OLD=90
|
|
|
|
echo "Removing tapes older than $DAYS_OLD days..."
|
|
find "$MHVTL_DIR" -name "*.data" -mtime +$DAYS_OLD -delete
|
|
|
|
echo "Remaining tapes:"
|
|
ls -lh "$MHVTL_DIR"/*.data 2>/dev/null | wc -l
|
|
```
|
|
|
|
### Configuration Backup Script
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
|
|
BACKUP_DIR="/backup/vtl-config"
|
|
DATE=$(date +%Y%m%d-%H%M%S)
|
|
|
|
mkdir -p "$BACKUP_DIR"
|
|
|
|
tar -czf "$BACKUP_DIR/vtl-config-$DATE.tar.gz" \
|
|
/etc/mhvtl/ \
|
|
/etc/tgt/conf.d/ \
|
|
/etc/sysctl.d/99-vtl.conf \
|
|
/etc/systemd/system/mhvtl.service
|
|
|
|
echo "Backup saved to: $BACKUP_DIR/vtl-config-$DATE.tar.gz"
|
|
|
|
find "$BACKUP_DIR" -name "vtl-config-*.tar.gz" -mtime +30 -delete
|
|
```
|