Session log: D2TESTNAS VM build, NAS migration, rsync sync fix
Built Debian 13 VM replacement for aging ReadyNAS, deployed rsync-based sync script to AD2, transferred data, completed IP cutover to 192.168.0.9. Includes setup scripts, sync fixes, and comprehensive session logs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
369
projects/dataforth-dos/d2testnas-vm/README.md
Normal file
369
projects/dataforth-dos/d2testnas-vm/README.md
Normal file
@@ -0,0 +1,369 @@
|
||||
# D2TESTNAS VM Replacement
|
||||
|
||||
Replacement for Netgear ReadyNAS RN10400 (D2TESTNAS) used in Dataforth DOS 6.22
|
||||
test infrastructure. The new system is a Debian 13 (Trixie) VM running on Hyper-V
|
||||
with BTRFS for snapshots, Samba with SMB1 for DOS compatibility, and rsync daemon
|
||||
for AD2 bidirectional sync.
|
||||
|
||||
---
|
||||
|
||||
## 1. Hyper-V VM Creation
|
||||
|
||||
Run these PowerShell commands on the Hyper-V host as Administrator.
|
||||
|
||||
```powershell
|
||||
# --- Configuration ---
|
||||
$VMName = "D2TESTNAS"
|
||||
$VMPath = "D:\Hyper-V\VMs"
|
||||
$VHDPath = "D:\Hyper-V\VMs\D2TESTNAS\Virtual Hard Disks"
|
||||
$ISOPath = "D:\ISOs\debian-13-netinst-amd64.iso" # Download from https://www.debian.org/devel/debian-installer/
|
||||
$SwitchName = "Dataforth-Bridge" # Your existing vSwitch for 192.168.0.0/24
|
||||
|
||||
# --- Create VM ---
|
||||
New-VM -Name $VMName `
|
||||
-Path $VMPath `
|
||||
-MemoryStartupBytes 2GB `
|
||||
-Generation 2 `
|
||||
-SwitchName $SwitchName
|
||||
|
||||
# --- Configure VM ---
|
||||
Set-VM -Name $VMName `
|
||||
-ProcessorCount 2 `
|
||||
-DynamicMemory `
|
||||
-MemoryMinimumBytes 1GB `
|
||||
-MemoryMaximumBytes 4GB `
|
||||
-AutomaticStartAction Start `
|
||||
-AutomaticStartDelay 30 `
|
||||
-AutomaticStopAction ShutDown
|
||||
|
||||
# --- Create OS disk (40 GB) ---
|
||||
New-VHD -Path "$VHDPath\os.vhdx" -SizeBytes 40GB -Dynamic
|
||||
Add-VMHardDiskDrive -VMName $VMName -Path "$VHDPath\os.vhdx"
|
||||
|
||||
# --- Create DATA disk (200 GB, or match current NAS capacity) ---
|
||||
# This disk will be formatted as BTRFS and mounted at /data
|
||||
New-VHD -Path "$VHDPath\data.vhdx" -SizeBytes 200GB -Dynamic
|
||||
Add-VMHardDiskDrive -VMName $VMName -Path "$VHDPath\data.vhdx"
|
||||
|
||||
# --- Attach Debian ISO ---
|
||||
Add-VMDvdDrive -VMName $VMName -Path $ISOPath
|
||||
|
||||
# --- Set boot order: DVD first (for install), then disk ---
|
||||
$dvd = Get-VMDvdDrive -VMName $VMName
|
||||
$disk = Get-VMHardDiskDrive -VMName $VMName | Where-Object { $_.Path -like "*os.vhdx" }
|
||||
Set-VMFirmware -VMName $VMName -BootOrder $dvd, $disk
|
||||
|
||||
# --- Disable Secure Boot (Debian needs "Microsoft UEFI Certificate Authority") ---
|
||||
Set-VMFirmware -VMName $VMName -EnableSecureBoot Off
|
||||
|
||||
# --- Start VM ---
|
||||
Start-VM -Name $VMName
|
||||
vmconnect localhost $VMName
|
||||
```
|
||||
|
||||
Adjust `$SwitchName` to match whatever virtual switch bridges to the 192.168.0.0/24
|
||||
Dataforth network. If you do not have one, create it:
|
||||
|
||||
```powershell
|
||||
# Create external vSwitch bridged to the physical NIC on the Dataforth network
|
||||
New-VMSwitch -Name "Dataforth-Bridge" -NetAdapterName "Ethernet 2" -AllowManagementOS $true
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. Debian Installation Notes
|
||||
|
||||
During the Debian 13 (Trixie) netinst installation:
|
||||
|
||||
1. **Language/Region:** English, United States, UTF-8
|
||||
2. **Hostname:** `D2TESTNAS`
|
||||
3. **Domain:** leave blank
|
||||
4. **Root password:** `Paper123!@#-nas`
|
||||
5. **User account:** Skip creating a normal user (or create one for admin use)
|
||||
6. **Partitioning - IMPORTANT:**
|
||||
- Use "Manual" partitioning
|
||||
- **Disk 1 (40 GB, /dev/sda):** OS disk
|
||||
- 512 MB EFI System Partition (ESP)
|
||||
- 1 GB /boot (ext4)
|
||||
- Remainder: / (ext4)
|
||||
- (No swap partition -- Hyper-V dynamic memory handles this; or add 2 GB swap)
|
||||
- **Disk 2 (200 GB, /dev/sdb):** Data disk
|
||||
- Use entire disk as a single partition
|
||||
- **Format as BTRFS**
|
||||
- Mount point: **/data**
|
||||
7. **Software selection:**
|
||||
- Deselect "Debian desktop environment" and all desktop options
|
||||
- Select "SSH server"
|
||||
- Select "standard system utilities"
|
||||
- Do NOT select any web server or print server
|
||||
8. **GRUB:** Install to /dev/sda
|
||||
|
||||
After reboot, verify you can SSH in, then proceed to post-install.
|
||||
|
||||
---
|
||||
|
||||
## 3. Post-Install Setup
|
||||
|
||||
SSH into the new VM (use the DHCP address shown at the console):
|
||||
|
||||
```bash
|
||||
ssh root@<dhcp-ip-address>
|
||||
```
|
||||
|
||||
Transfer and run the setup script:
|
||||
|
||||
```bash
|
||||
# From your workstation (PowerShell/bash):
|
||||
scp setup-d2testnas.sh root@<dhcp-ip-address>:/root/
|
||||
|
||||
# On the VM:
|
||||
chmod +x /root/setup-d2testnas.sh
|
||||
/root/setup-d2testnas.sh
|
||||
```
|
||||
|
||||
The script will:
|
||||
- Install samba, rsync, btrfs-progs, and supporting packages
|
||||
- Set hostname to D2TESTNAS
|
||||
- Create BTRFS subvolumes (/data/test, /data/datasheets)
|
||||
- Write /etc/samba/smb.conf with SMB1 (CORE protocol) support
|
||||
- Create Samba users ts-1 through ts-50 (null passwords) and engineer
|
||||
- Write /etc/rsyncd.conf and /etc/rsyncd.secrets
|
||||
- Install BTRFS snapshot cron jobs
|
||||
- Configure SSH for root login with password
|
||||
- Enable and start all services
|
||||
- Run verification checks
|
||||
- Display cutover instructions
|
||||
|
||||
---
|
||||
|
||||
## 4. Testing Before Cutover
|
||||
|
||||
While the VM is still on a DHCP address (not 192.168.0.9), verify all services
|
||||
work. Use the DHCP IP in place of 192.168.0.9 for these tests.
|
||||
|
||||
### Test SMB from Windows
|
||||
|
||||
```cmd
|
||||
net use Z: \\<dhcp-ip>\test
|
||||
dir Z:\
|
||||
net use Z: /delete
|
||||
```
|
||||
|
||||
### Test rsync from AD2
|
||||
|
||||
```powershell
|
||||
$env:RSYNC_PASSWORD = "IQ203s32119"
|
||||
rsync --list-only rsync://rsync@<dhcp-ip>/test/
|
||||
```
|
||||
|
||||
### Test SSH
|
||||
|
||||
```bash
|
||||
ssh root@<dhcp-ip>
|
||||
# Password: Paper123!@#-nas
|
||||
```
|
||||
|
||||
### Test BTRFS Snapshots
|
||||
|
||||
```bash
|
||||
# On the VM:
|
||||
btrfs-snapshot.sh create hourly
|
||||
btrfs-snapshot.sh list
|
||||
ls /data/.snapshots/
|
||||
```
|
||||
|
||||
### Test from DOS Machine (optional, requires temporary IP or hosts hack)
|
||||
|
||||
If you can temporarily set a DOS machine to use the DHCP IP, test the T: drive
|
||||
mapping. Otherwise, wait for cutover.
|
||||
|
||||
---
|
||||
|
||||
## 5. Data Migration
|
||||
|
||||
Before cutover, copy all data from the old NAS to the new VM:
|
||||
|
||||
```bash
|
||||
# On the new VM, pull everything from the old NAS:
|
||||
RSYNC_PASSWORD=IQ203s32119 rsync -avz --progress \
|
||||
rsync://rsync@192.168.0.9/test/ /data/test/
|
||||
```
|
||||
|
||||
This may take a while depending on data volume. Run it multiple times -- rsync
|
||||
is incremental and will only transfer changes on subsequent runs.
|
||||
|
||||
For the datasheets share, copy via SMB or SCP from the old NAS:
|
||||
|
||||
```bash
|
||||
# If rsync module exists for datasheets:
|
||||
RSYNC_PASSWORD=IQ203s32119 rsync -avz rsync://rsync@192.168.0.9/datasheets/ /data/datasheets/
|
||||
|
||||
# Otherwise, mount the old NAS share temporarily:
|
||||
apt-get install -y cifs-utils
|
||||
mkdir -p /mnt/old-nas
|
||||
mount -t cifs //192.168.0.9/datasheets /mnt/old-nas -o guest,vers=1.0
|
||||
rsync -avz /mnt/old-nas/ /data/datasheets/
|
||||
umount /mnt/old-nas
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. Cutover Checklist
|
||||
|
||||
Perform these steps during a maintenance window when no DOS machines are running
|
||||
tests.
|
||||
|
||||
### Pre-Cutover
|
||||
|
||||
- [ ] All data migrated from old NAS (run rsync one final time)
|
||||
- [ ] All services verified on new VM (SMB, rsync, SSH)
|
||||
- [ ] BTRFS snapshots working (run `btrfs-snapshot.sh list`)
|
||||
- [ ] Notify engineers: maintenance window, expect brief T: drive outage
|
||||
|
||||
### Cutover Steps
|
||||
|
||||
1. **Stop the AD2 sync script** (disable scheduled task on AD2 temporarily)
|
||||
|
||||
2. **Final data sync** from old NAS to new VM:
|
||||
```bash
|
||||
RSYNC_PASSWORD=IQ203s32119 rsync -avz rsync://rsync@192.168.0.9/test/ /data/test/
|
||||
```
|
||||
|
||||
3. **Power off the old ReadyNAS** (192.168.0.9)
|
||||
|
||||
4. **Assign static IP to new VM:**
|
||||
```bash
|
||||
# On the new VM:
|
||||
# Edit /etc/network/interfaces to use static config:
|
||||
cat > /etc/network/interfaces << 'EOF'
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
address 192.168.0.9
|
||||
netmask 255.255.255.0
|
||||
gateway 192.168.0.254
|
||||
dns-nameservers 192.168.0.27 192.168.0.6 192.168.1.254
|
||||
EOF
|
||||
|
||||
# Replace "eth0" with actual interface name shown by: ip link show
|
||||
systemctl restart networking
|
||||
```
|
||||
|
||||
5. **Verify IP assignment:**
|
||||
```bash
|
||||
ip addr show
|
||||
ping -c 3 192.168.0.254
|
||||
```
|
||||
|
||||
6. **Re-enable AD2 sync script** (re-enable scheduled task)
|
||||
|
||||
7. **Test from AD2:**
|
||||
```powershell
|
||||
$env:RSYNC_PASSWORD = "IQ203s32119"
|
||||
rsync --list-only rsync://rsync@192.168.0.9/test/
|
||||
```
|
||||
|
||||
8. **Test from Windows:**
|
||||
```cmd
|
||||
net use T: \\D2TESTNAS\test
|
||||
dir T:\
|
||||
```
|
||||
|
||||
9. **Test from DOS machine:** Boot one test station and verify T: drive maps
|
||||
and NWTOC.BAT runs successfully.
|
||||
|
||||
10. **Create baseline snapshot:**
|
||||
```bash
|
||||
btrfs-snapshot.sh create daily
|
||||
```
|
||||
|
||||
### Post-Cutover
|
||||
|
||||
- [ ] Monitor /var/log/samba/ for connection issues
|
||||
- [ ] Monitor /var/log/rsyncd.log for sync activity
|
||||
- [ ] Verify AD2 sync runs successfully (check sync status file)
|
||||
- [ ] Verify BTRFS snapshot cron is creating snapshots (check after 1 hour)
|
||||
- [ ] Update credentials.md with any changes to the NAS entry
|
||||
- [ ] Keep old ReadyNAS powered off but available for 2 weeks as fallback
|
||||
|
||||
### Rollback Plan
|
||||
|
||||
If critical issues arise during cutover:
|
||||
|
||||
1. Power off the new VM
|
||||
2. Power on the old ReadyNAS
|
||||
3. Wait 2 minutes for ReadyNAS to boot and claim 192.168.0.9
|
||||
4. Verify DOS machines can map T: drive
|
||||
5. Re-enable AD2 sync task
|
||||
|
||||
---
|
||||
|
||||
## 7. Maintenance Reference
|
||||
|
||||
### Service Management
|
||||
|
||||
```bash
|
||||
systemctl status smbd nmbd rsync ssh
|
||||
systemctl restart smbd # Restart Samba file server
|
||||
systemctl restart nmbd # Restart NetBIOS name service
|
||||
systemctl restart rsync # Restart rsync daemon
|
||||
```
|
||||
|
||||
### Snapshot Management
|
||||
|
||||
```bash
|
||||
btrfs-snapshot.sh list # Show all snapshots
|
||||
btrfs-snapshot.sh create hourly # Manual hourly snapshot
|
||||
btrfs-snapshot.sh create daily # Manual daily snapshot
|
||||
btrfs-snapshot.sh prune # Clean up old snapshots per retention policy
|
||||
```
|
||||
|
||||
Snapshots are browsable at `/data/.snapshots/` and via the `\\D2TESTNAS\snapshots`
|
||||
SMB share (read-only). To restore a file from a snapshot:
|
||||
|
||||
```bash
|
||||
# Find the file in a snapshot:
|
||||
ls /data/.snapshots/daily_2026-03-12_00-01-00/TS-01/LOGS/
|
||||
|
||||
# Copy it back:
|
||||
cp /data/.snapshots/daily_2026-03-12_00-01-00/TS-01/LOGS/5BLOG/DATA.DAT /data/test/TS-01/LOGS/5BLOG/
|
||||
```
|
||||
|
||||
### Log Files
|
||||
|
||||
| Log | Purpose |
|
||||
|-----|---------|
|
||||
| /var/log/samba/log.* | Samba per-client logs |
|
||||
| /var/log/rsyncd.log | rsync daemon transfers |
|
||||
| /var/log/btrfs-snapshots.log | Snapshot create/prune activity |
|
||||
| /var/log/auth.log | SSH login attempts |
|
||||
|
||||
### Samba User Management
|
||||
|
||||
```bash
|
||||
# Add a new station user with null password:
|
||||
useradd --system --no-create-home --shell /usr/sbin/nologin ts-51
|
||||
smbpasswd -a -n ts-51
|
||||
smbpasswd -e ts-51
|
||||
|
||||
# Change engineer password:
|
||||
smbpasswd engineer
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 8. Architecture Comparison
|
||||
|
||||
| Feature | Old (ReadyNAS RN10400) | New (Debian 13 VM) |
|
||||
|---------|----------------------|-------------------|
|
||||
| OS | Netgear ReadyNAS Linux | Debian 13 (Trixie) |
|
||||
| Filesystem | BTRFS | BTRFS |
|
||||
| SMB | SMB1 (CORE) | SMB1 (CORE) via Samba |
|
||||
| rsync | rsync daemon, port 873 | rsync daemon, port 873 |
|
||||
| Snapshots | 80+ BTRFS (not browsable) | Automated, browsable via SMB |
|
||||
| NetBIOS/WINS | nmbd | nmbd |
|
||||
| Management | Web UI (limited) | SSH + CLI (full control) |
|
||||
| Backup | BTRFS snapshots only | BTRFS snapshots + Hyper-V checkpoints |
|
||||
| Hardware | Physical appliance | Virtual machine (portable, resizable) |
|
||||
Reference in New Issue
Block a user