Linux-use: Unterschied zwischen den Versionen
Admin (Diskussion | Beiträge) |
Admin (Diskussion | Beiträge) |
||
| Zeile 1: | Zeile 1: | ||
= NVMe-Backup System - Konfigurationsdokumentation = | |||
== System-Übersicht == | |||
'''Server:''' STORE2 (Debian 13) | |||
'''Zweck:''' Tägliche vollständige OS-Level Disaster Recovery Backups | |||
'''Backup-Methode:''' rsync mit Hard Link Rotation und --one-file-system | |||
'''Backup-Größe:''' 125GB (vollständiges System inkl. Docker/Emby) | |||
== Hardware-Konfiguration == | |||
'''Quelle:''' NVMe System-Laufwerk (/) | |||
'''Ziel:''' <code>/mnt/nvme_backup</code> - 1TB HDD (<code>/dev/sdar1</code>, ext4, Label: <code>NVME_BACKUP</code>) | |||
'''Kapazität:''' ~6-7 Backup-Generationen (daily.0 bis daily.6) | |||
== Software-Komponenten == | |||
=== SystemD Services === | |||
* '''Service:''' <code>nvme-backup.service</code> - OneShot-Service für Backup-Ausführung | |||
* '''Timer:''' <code>nvme-backup.timer</code> - Tägliche Ausführung um 03:08 Uhr | |||
* '''Mail-Service:''' <code>nvme-backup-mail@.service</code> - Erfolgs-/Fehlermeldungen | |||
=== Scripts und Konfiguration === | |||
* '''Backup-Script:''' <code>/usr/local/sbin/nvme-backup</code> | |||
* '''Mail-Script:''' <code>/usr/local/sbin/nvme-backup-mailer</code> | |||
* '''Exclude-Liste:''' Im Script hardcodiert (siehe unten) | |||
== Backup-Strategie und Exclude-Konfiguration == | |||
=== rsync-Parameter === | |||
bash | |||
<code>rsync -aAXH --delete --numeric-ids --info=progress2 --one-file-system</code> | |||
=== Exclude-Liste (finale Konfiguration) === | |||
bash | |||
<code>RSYNC_EXCLUDES=( | |||
--exclude="$DST/*" ''# Backup-Ziel selbst'' | |||
--exclude="/proc/" ''# Kernel-Prozess-Dateisystem'' | |||
--exclude="/sys/" ''# Kernel-System-Dateisystem'' | |||
--exclude="/dev/" ''# Device-Dateien'' | |||
--exclude="/run/" ''# Runtime-Daten'' | |||
--exclude="/tmp/" ''# Temporäre Dateien'' | |||
--exclude="/data/" ''# RAID-Mount md125 (XFS)'' | |||
--exclude="/data2/" ''# RAID-Mount md126 (EXT4)'' | |||
--exclude="/lost+found" ''# Dateisystem-Recovery'' | |||
)</code> | |||
=== Backup-Inhalt (eingeschlossen) === | |||
* '''System:''' <code>/usr</code> (21GB), <code>/etc</code> (399MB), <code>/boot</code> (417MB) | |||
* '''Services:''' <code>/var</code> (42GB) - Docker, Emby, Logs, Systemdienste | |||
* '''Daten:''' <code>/home</code> (10.5GB), <code>/srv</code> (9.5GB), <code>/opt</code> (1.5GB) | |||
* '''Root:''' <code>/root</code> - Konfigurationen und Scripts | |||
== Mail-Benachrichtigungen == | |||
=== SMTP-Konfiguration === | |||
* '''Provider:''' GMX (mail.gmx.net:587, TLS) | |||
* '''Absender:''' dergagi@gmx.de | |||
* '''Empfänger:''' daniel.gareis@gmail.com | |||
* '''Authentifizierung:''' <code>/etc/msmtprc</code> (chmod 600) | |||
=== Benachrichtigungs-Szenarien === | |||
* '''Erfolg:''' "NVMe Backup SUCCESS" mit Timestamp | |||
* '''Fehler:''' "NVMe Backup FAILURE" mit Log-Verweis | |||
* '''rsync exit code 23:''' Als Erfolg gewertet (File vanished warnings) | |||
== Wartung und Troubleshooting == | |||
=== Service-Kontrolle === | |||
bash | |||
<code>systemctl status nvme-backup.service | |||
systemctl list-timers nvme-backup.timer | |||
journalctl -u nvme-backup.service --no-pager</code> | |||
=== Manueller Backup-Test === | |||
bash | |||
<code>systemctl start nvme-backup.service | |||
tail -f /mnt/nvme_backup/_logs/run-$(date +%Y-%m-%d)_*.log</code> | |||
=== Wichtige Dateipfade === | |||
* '''Logs:''' <code>/mnt/nvme_backup/_logs/run-YYYY-MM-DD_HH-MM-SS.log</code> | |||
* '''Mail-Debug:''' <code>/root/nvme-backup-mail-last.txt</code> | |||
* '''SMTP-Log:''' <code>/var/log/msmtp.log</code> | |||
== Kritische Konfigurationsdetails == | |||
=== --one-file-system Parameter === | |||
'''Essentiell für korrekten Betrieb.''' Verhindert, dass rsync den gemounteten RAID-Arrays folgt. Ohne diesen Parameter würden <code>/data</code> und <code>/data2</code> trotz Exclude-Liste gebackupt werden. | |||
=== Backup-Rotation === | |||
Script führt automatische Rotation durch: daily.0 → daily.1 → ... → daily.7 (dann Löschung) | |||
=== Performance-Charakteristika === | |||
* '''Vollbackup:''' ~125GB in 1,5 Stunden | |||
* '''CPU-Verbrauch:''' ~12 Minuten CPU-Zeit | |||
* '''Memory Peak:''' ~5GB während Backup | |||
* '''I/O-Rate:''' ~60-70MB/s nachhaltig | |||
Das System ist für Server mit separaten Daten-Mounts optimiert und bietet vollständige Wiederherstellbarkeit aller System-Services ohne manuelle Rekonfiguration. | |||
= HDD als NTFS unter Linux richtig formatieren = | = HDD als NTFS unter Linux richtig formatieren = | ||
Version vom 1. September 2025, 13:30 Uhr
NVMe-Backup System - Konfigurationsdokumentation
System-Übersicht
Server: STORE2 (Debian 13)
Zweck: Tägliche vollständige OS-Level Disaster Recovery Backups
Backup-Methode: rsync mit Hard Link Rotation und --one-file-system
Backup-Größe: 125GB (vollständiges System inkl. Docker/Emby)
Hardware-Konfiguration
Quelle: NVMe System-Laufwerk (/)
Ziel: /mnt/nvme_backup - 1TB HDD (/dev/sdar1, ext4, Label: NVME_BACKUP)
Kapazität: ~6-7 Backup-Generationen (daily.0 bis daily.6)
Software-Komponenten
SystemD Services
- Service:
nvme-backup.service- OneShot-Service für Backup-Ausführung - Timer:
nvme-backup.timer- Tägliche Ausführung um 03:08 Uhr - Mail-Service:
nvme-backup-mail@.service- Erfolgs-/Fehlermeldungen
Scripts und Konfiguration
- Backup-Script:
/usr/local/sbin/nvme-backup - Mail-Script:
/usr/local/sbin/nvme-backup-mailer - Exclude-Liste: Im Script hardcodiert (siehe unten)
Backup-Strategie und Exclude-Konfiguration
rsync-Parameter
bash
rsync -aAXH --delete --numeric-ids --info=progress2 --one-file-system
Exclude-Liste (finale Konfiguration)
bash
RSYNC_EXCLUDES=(
--exclude="$DST/*" # Backup-Ziel selbst
--exclude="/proc/" # Kernel-Prozess-Dateisystem
--exclude="/sys/" # Kernel-System-Dateisystem
--exclude="/dev/" # Device-Dateien
--exclude="/run/" # Runtime-Daten
--exclude="/tmp/" # Temporäre Dateien
--exclude="/data/" # RAID-Mount md125 (XFS)
--exclude="/data2/" # RAID-Mount md126 (EXT4)
--exclude="/lost+found" # Dateisystem-Recovery
)
Backup-Inhalt (eingeschlossen)
- System:
/usr(21GB),/etc(399MB),/boot(417MB) - Services:
/var(42GB) - Docker, Emby, Logs, Systemdienste - Daten:
/home(10.5GB),/srv(9.5GB),/opt(1.5GB) - Root:
/root- Konfigurationen und Scripts
Mail-Benachrichtigungen
SMTP-Konfiguration
- Provider: GMX (mail.gmx.net:587, TLS)
- Absender: dergagi@gmx.de
- Empfänger: daniel.gareis@gmail.com
- Authentifizierung:
/etc/msmtprc(chmod 600)
Benachrichtigungs-Szenarien
- Erfolg: "NVMe Backup SUCCESS" mit Timestamp
- Fehler: "NVMe Backup FAILURE" mit Log-Verweis
- rsync exit code 23: Als Erfolg gewertet (File vanished warnings)
Wartung und Troubleshooting
Service-Kontrolle
bash
systemctl status nvme-backup.service
systemctl list-timers nvme-backup.timer
journalctl -u nvme-backup.service --no-pager
Manueller Backup-Test
bash
systemctl start nvme-backup.service
tail -f /mnt/nvme_backup/_logs/run-$(date +%Y-%m-%d)_*.log
Wichtige Dateipfade
- Logs:
/mnt/nvme_backup/_logs/run-YYYY-MM-DD_HH-MM-SS.log - Mail-Debug:
/root/nvme-backup-mail-last.txt - SMTP-Log:
/var/log/msmtp.log
Kritische Konfigurationsdetails
--one-file-system Parameter
Essentiell für korrekten Betrieb. Verhindert, dass rsync den gemounteten RAID-Arrays folgt. Ohne diesen Parameter würden /data und /data2 trotz Exclude-Liste gebackupt werden.
Backup-Rotation
Script führt automatische Rotation durch: daily.0 → daily.1 → ... → daily.7 (dann Löschung)
Performance-Charakteristika
- Vollbackup: ~125GB in 1,5 Stunden
- CPU-Verbrauch: ~12 Minuten CPU-Zeit
- Memory Peak: ~5GB während Backup
- I/O-Rate: ~60-70MB/s nachhaltig
Das System ist für Server mit separaten Daten-Mounts optimiert und bietet vollständige Wiederherstellbarkeit aller System-Services ohne manuelle Rekonfiguration.
HDD als NTFS unter Linux richtig formatieren
Szenario: Raid-Platte geht noch, liefert aber sporadische Fehler in dmesg z.B. -> wird im Raid ersetzt -> ist dann "über" -> kann als Serien-Sammelplatte noch verwendet werden
Damit die Platte auch unter Windows richtig erkannt wird ist folgendes zu beachten:
Partitionstyp muss auf 0x07 (HPFS/NTFS/exFAT) stehen!
Partitionieren mit gdisk
sudo gdisk /dev/sdX
- erst alte Linux Raid Partiton löschen: d -> 1 -> w
n→ Neue Partition anlegen (Eingaben bestätigen oder (falls gewünscht) Start- und Endsektor anpassen)0700als Typ für NTFS setzen (wird ggf. vorgeschlagen, sonst nachfragen)w→ Schreiben und gdisk verlassen
Formatieren mit mkfs.ntfs
sudo mkfs.ntfs -f /dev/sdX1
Mounten mit
sudo mkdir -p /mnt/ntfs sudo mount -t ntfs-3g /dev/sdX1 /mnt/ntfs
Booten überhaupt !!!
Bios 12 ist OK. Kerne laufen beide auf 2.5Ghz.
Beide Karten sind OK und müssen auch beim Booten drin sein
Wenn die Laufwerke vom 4-Ch Sata-Controller ab sind, wir auch gebootet.
Dann können sie Hot-Geplugged werden -> geht :-)
Jetzt testen dass auch alle 27 (!) Laufwerke da sind.
/root/bin/diskserial_sort.sh
Dann weiter wie im Raidabschnitt beschrieben
mdadm --assemble --scan
Raid-Karten Kernel-Treiber nach Kernelupdate
cd /Nach_Kernelupdate/rr2340-linux-src-v1.7/product/rr2340/linux/
make clean make make install
Manuelles starten (nach Reboot automatisch)
modprobe rr2340
Grub und Root-Festplatte
in /boot/grub/menu.lst z.B.
kernel /boot/vmlinuz-2.6.31.14-0.6-desktop root=UUID=d06e4d6a-44d7-4f09-9ea3-a4cb8f120770 ...
UUID einer Festplatte herausfinden
blkid /dev/sdq8
Screen-Umgebung
Liste aller Screens
screen -ls
Starten
screen -S NAME
Detach
Strg-a d = detach
Reatach
screen -r NAME
ODER Wieder reingehen
screen -x NAME
Screens beenden
im Screen Strg-a k (wie kill)
Arch Linux AUR Pakete
- tarball herunterladen - nach /builds entpacken (tar -xzf xxxx.tar.gz) - dort makepkg - pacman -U xxxx.pkg.tar.xz
RAR unter Linux
RAR-Archiv testen
rar t xxxxx.rar
Wake-On-Lan
Netzwerkkarte in System->Gerätemanager erlauben und Magic Paket einstellen im Bios PCI aufwecken erlauben Mac-Adresse und Netzwerk-IP wissen
Uni
Linux-Konsolen-Befehl zum Aufwecken auf Uni-Rechner Big-Blue2 aus "Hibernate":
wol -i 132.187.33.255 90:e6:ba:43:c2:dc
Busfahrer an Uni:
wol -i 132.187.33.255 b8:ac:6f:67:e6:43
Brücknerstrasse
Aufwecken aus "Standby"
(Bachus)
wol -i 255.255.255.255 00:1e:8c:46:10:8c
(Myth intern)
wol -i 255.255.255.255 00:14:85:e8:10:4c
Myth PCIe
wol -i 255.255.255.255 00:e0:45:49:00:09
Tool um Windows um Remote-Verbindung schlafen zu legen PowerOff z.B. bei
http://www.chip.de/downloads/Poweroff_21571048.html
Linuxbefehl für OpenSuse um per Konsole zu suspenden:
pm-suspend
-> Vorsicht: Festplatten verhalten sich komisch
"HDIO_DRIVE_CMD(identify) failed: Invalid exchange"
bei
/root/bin/diskserial_sort.sh
Aufwecken über Fritzbox direkt problemlos möglich.
Remote-Desktop
Big-Blue: SSH auf wolf.physik.uni-wuerzburg.de mit Tunnel: 33889 auf Ziel 132.187.33.133:3389 Dann localhost:33889
Myth: dergagi.dyndns.org normal (ohne Angabe gilt Port 3389)
Bachus: dergagi.dyndns.org:33890
Ordnergröße in Konsole anzeigen
du -sh /home
Für Platzstatus auf Partitionen
df -h
DU-Meter für SuSE/Linux
KTrafficAnalyzer, z.B. über 1-Klick Installation bei http://software.opensuse.org/search
NTM http://netramon.sourceforge.net/eng/index.html
Bandwidth-Monitor für Console, z.B. auch Ubuntu
bwm-ng
bmon
Netzwerk-Geschwindkeit testen
Tool: iperf gibts für Linux, Windows, Mac Server (empfängt Testdaten)
iperf -s
Client (sendet Daten)
iperf -c 192.168.1.60 (Myth) ipfer -c 192.168.1.66 (Store)
Manuel RPM Pakete installieren
rpm -ihv nedit-5.5-31.8.x86_64.rpm
Locate auf Data/Data2
locate -i -d /data/locatedb "mein suchbegriff"
USB-Device mounten
mount -t ntfs-3g /dev/sdj5 /usb -o force
NTFS Linux
mount -t ntfs-3g /dev/sds1 /mo1
Opensuse: IP über DHCP erneuern
1. Open a terminal and su - to root. 2. Type ifconfig to show the current IP address that you received from DHCP. 3. Type dhcpcd -k to send the appropriate signals to dhcpcd. 4. Now bring the interface back up by typing ifup eth0. 5. Type ifconfig to show the new IP address.
System-Backup-Image von USB-Platte mounten
mount -o loop /media/Data5/store_root.img /mnt/loop/
Verzeichnisse synchronisieren
mit grsync
Devices neu einlesen im laufenden Betrieb ohne Reboot
blockdev --rereadpt /dev/sdx
Laufwerke am RocketRaid neu einlesen im laufenden Betrieb ohne Reboot
Kernelmodul da?
lsmod rr2340
Kernelmodul entfernen/löschen
rmmod rr2340
Kernelmodul wieder laden/starten
modprobe rr2340
KDE Remote Desktop
krdc -> Client
TightVNC -> Client
krfb -> Server (über Konsole z.B. mit Xming starten, wegen Grafik)
Port Forwarding im Router: Kontrolle unter: vi home/root/kde4/share/config/krfbrc
JDownloader
Installieren über Script von Homepage
1. wget must be installed on system! 2. Download jd.sh http://212.117.163.148/jd.sh 3. chmod +x jd.sh 4. start jd.sh -> ./jd.sh
Note: Open jd.sh to read Manual or change Settings!
Starten nach Installation:
java -jar /home/gagi/.jd/JDownloader.jar
One-Click Install auf Konsole
OCICLI <YMP URL>
Cronjobs
Liste
crontab -l
Einträge ändern
crontab -e
dort dann im vi editieren
Data Scrubbing, automatische Suche einmal im Monat nach BadBlocks
In short: Especially if you run a RAID5 array, trigger an active bad block check on a regular basis, or there is a high chance of hidden bad blocks making your RAID unusable during reconstruction.
Normally, RAID passively detects bad blocks. If a read error occurs, the data is reconstructed from the rest of the array, and the bad block is rewritten. If the block can not be rewritten, the defective disk is kicked out of the active array.
Once the defective drive is replaced, reconstruction will cause all blocks of the remaining drives to be read. If this process runs across a previously undetected bad block on the remaining drives, another drive will be marked as failed, making RAID5 unusable. The larger the disks, the higher the odds that passive bad block detection will be inadaquate. Therefore, with today's large disks it is important to actively perform data scrubbing on your array.
With a modern (>=2.6.16) kernel, this command will initiate a data consistency and bad block check, reading all blocks, checking them for consistency, and attempting to rewrite inconsistent blocks and bad blocks.
echo check >> /sys/block/md127/md/sync_action echo check >> /sys/block/md125/md/sync_action
You can monitor the progress of the check with:
watch -n .1 cat /proc/mdstat
You should have your array checked daily or weekly by adding the appropriate command to /etc/crontab.
Steht für jeden 8. des Monats in Crontab.
If you find yourself needlessly checking your array (like I was) and want to stop it safely, you can either stop the entire array, or:
echo idle >> /sys/block/md127/md/sync_action echo idle >> /sys/block/md125/md/sync_action
TigerVNC
Start Server
vncserver :1 vncserver :2
Kill Server
vncserver -kill :1
Port 5901
dergagi.selfhost.bz:5901 dergagi.selfhost.bz:5902
Auflösung ändern:
im VNC-Fenster (also schon remote)
xrandr -s 1920x1200
XTerm Benutzer wechseln:
su gagi
Autostart
in /etc/rc.local
su gagi -c "vncserver -geometry 1920x1080 -alwaysshared -localhost -dpi 96 :1"
RSYNC volles Systembackup
rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/data","/data2","/suse","/rsync-backup"} / /rsync-backup/