Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
shell [22/09/2022 - 10:44] – thommie4 | shell [25/12/2024 - 17:00] (aktuell) – [Shell Basics] thommie_netzwissen.de | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== Shell und Dateisysteme | + | ====== Shell Basics |
- | http:// | + | [[http:// |
[[https:// | [[https:// | ||
- | [[http://www.linux-services.org/ | + | ===== GB keyboard ===== |
+ | |||
+ | {{ | ||
===== Screen ===== | ===== Screen ===== | ||
Zeile 46: | Zeile 48: | ||
Einfügen eines Passwort hashes | Einfügen eines Passwort hashes | ||
- | |||
< | < | ||
- | thommie@odysseus3: | + | |
- | > print crypt.crypt(' | + | thommie@odysseus3: |
$6$SALTsalt$0[hashwert] | $6$SALTsalt$0[hashwert] | ||
+ | |||
</ | </ | ||
- | ===== Platte voll - grösste Dateien/ | + | ===== update-alternatives |
- | { find ocdata/ -type f -name "*.*" | + | [[https://manpages.ubuntu.com/ |
+ | ===== Random string erzeugen ===== | ||
< | < | ||
- | | + | tr -dc A-Za-z0-9 </ |
</ | </ | ||
- | Danach die Dateien in eine Datei kopieren und gezielt löschen | + | ===== Links ===== |
- | < | + | '' |
- | xargs rm -r < delete.txt | + | |
- | </code> | + | |
+ | ===== | ||
- | ==== Out of inodes ==== | + | Alle Dateien älter als 365 Tage finden |
- | Eine Platte kann auch wegen wegen ausgegangener inodes voll sein "no space left on device" | + | < |
- | Dann zuerst inode Status prüfen mit df -i. Danach auflisten, welches Verzeichnis die meisten Inodes belegt: | + | find / |
+ | </ | ||
- | '' | + | Mit löschen: |
- | + | ||
- | Siehe [[https:// | + | |
- | + | ||
- | Wenn es zu viele Einzel-Dateien sind, kommt bei rm -rf eventuell dieser Fehler | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | In diesem Fall diee Dateien einzeln finden und übergeben: | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | Danach müsste alles wieder OK sein: | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | ===== Access Control Lists ACL ===== | + | |
- | + | ||
- | siehe [[https:// | + | |
- | + | ||
- | setzen | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | Settings lesen | + | |
- | + | ||
- | '' | + | |
- | '' | + | |
- | ===== BTRFS ===== | + | |
- | + | ||
- | Standard-Datei-System bei OpenSUSE und SLES | + | |
- | + | ||
- | ==== Platte läuft mit Snapshots voll ==== | + | |
- | + | ||
- | Die Grundeinstellungen stehen in / | + | |
- | + | ||
- | Im akuten Fall: | + | |
- | + | ||
- | ''/ | + | |
- | + | ||
- | und | + | |
- | + | ||
- | ''/ | + | |
- | + | ||
- | ==== btrfs Maintenance ==== | + | |
- | + | ||
- | There is btrfsmaintenance package that should be installed by default that provides cron script. Somewhat interesting implementation is, these cron scripts are not installed directly but there is a service that does it. And *this* service is disabled by default | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | and check / | + | |
- | + | ||
- | It is configurable in / | + | |
- | + | ||
- | I enabled it now (with the default config), which created cron.weekly/ | + | |
- | + | ||
- | Alte Snapshots auf einen Satz löschen: | + | |
< | < | ||
- | for i in `seq 2309 2605`; do snapper | + | find / |
</ | </ | ||
- | ==== Weitere BTRFS Kommandos ==== | + | Luxus Variante mit Backup |
- | Füllgrad feststellen: | + | < |
+ | # | ||
+ | path="/ | ||
+ | timestamp=$(date +%Y%m%d_%H%M%S) | ||
+ | filename=log_$timestamp.txt | ||
+ | log=$path$filename | ||
+ | days=7 | ||
- | '' | + | START_TIME=$(date +%s) |
- | Snapshots auflisten | + | find $path -maxdepth 1 -name " |
- | '' | + | echo " |
- | Snapshot Diffs anzeigen | ||
- | '' | + | ... code for backup ...or any other operation .... >> $log |
- | Bestimmten Snapshot löschen | ||
- | '' | + | END_TIME=$(date +%s) |
- | Älteren Snapshot aktivieren | + | ELAPSED_TIME=$(( $END_TIME |
- | + | ||
- | '' | + | |
- | + | ||
- | ==== BTRFS Dateisystem reparieren ==== | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | ==== Hohe Last durch BTRFS quota ==== | + | |
- | + | ||
- | [[https:// | + | |
- | + | ||
- | [[https:// | + | |
- | + | ||
- | ===== Software RAID Reparatur ===== | + | |
- | + | ||
- | Ablauf bei Plattentausch | + | |
- | + | ||
- | RAID Array anzeigen | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | und | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | Platte aus Array entfernen | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | Ganzes Array stoppen | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | ===== XFS ===== | + | |
- | + | ||
- | XFS Fehler können unter OpenSuse zum emergency mode führen. Fix: | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | Wenn das xfs Log überschrieben werden kann | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | Doku: [[http:// | + | |
- | + | ||
- | ===== LUKS ===== | + | |
- | + | ||
- | Basisinfo: [[https:// | + | |
- | + | ||
- | [[https:// | + | |
- | + | ||
- | **Vor LEAP: Image *.img reparieren** | + | |
- | + | ||
- | Die *.key Datei ist auch verschlüsselt, | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | Danach fsck auf / | + | |
- | + | ||
- | Mit luksclose wird das Image geschlossen | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | **Ab Leap werden normale LUKS Partitionen benutzt.** | + | |
- | + | ||
- | ==== LUKS Partitionen ab OpenSUSE Leap ==== | + | |
- | + | ||
- | Die Partition wird über ein Loop Setup ins Dateisystem gemountet: | + | |
- | < | + | |
- | + | ||
- | dev/ | + | |
- | / | + | |
- | tmpfs 3.2G | + | |
+ | echo " | ||
+ | echo " | ||
</ | </ | ||
- | Die Zuordnung des gemappten Partition zur Partition auf der Platte steht in in / | + | ===== sed ===== |
+ | replace " | ||
< | < | ||
- | cr-auto-1 | ||
+ | < | ||
</ | </ | ||
- | Die Befehle für cryptsetup funktionieren nur an der Originalpartition: | + | trim string and remove newlines |
< | < | ||
- | odysseus3: | + | < |
- | LUKS header information for / | + | |
- | + | ||
- | Version: | + | |
- | Cipher name: aes | + | |
- | Cipher mode: xts-plain64 | + | |
- | Hash spec: | + | |
- | Payload offset: 4096 | + | |
- | MK bits: 256 | + | |
- | MK digest: | + | |
- | MK salt: e2 b4 a9 e0 c3 89 84 e6 cc 6f cb d0 fc da 3a 92 | + | |
- | ce 52 95 ce c4 ca fa 65 7b bf 06 a8 ea 8a 03 3e | + | |
- | MK iterations: | + | |
- | UUID: | + | |
- | + | ||
- | Key Slot 0: ENABLED | + | |
- | Iterations: | + | |
- | Salt: f1 de c8 30 e1 80 5e eb 66 93 0d 03 b6 9a ee 90 | + | |
- | 75 5b a5 29 1c 50 17 79 18 b9 4d 5f c2 82 61 38 | + | |
- | Key material offset: | + | |
- | AF stripes: | + | |
- | Key Slot 1: ENABLED | + | |
- | Iterations: | + | |
- | Salt: 89 fc dd 4c 1c f9 6f ff b2 4e 2e 40 03 a7 a4 5f | + | |
- | de 7a 7a 08 3e 72 16 58 b2 5f 24 c8 b6 87 86 c0 | + | |
- | Key material offset: | + | |
- | AF stripes: | + | |
- | Key Slot 2: DISABLED | + | |
- | Key Slot 3: DISABLED | + | |
- | Key Slot 4: DISABLED | + | |
- | Key Slot 5: DISABLED | + | |
- | Key Slot 6: DISABLED | + | |
- | Key Slot 7: DISABLED | + | |
</ | </ | ||
- | Passphrase hinzufügen: | ||
- | < | + | ===== Alte Kernels raus schmeissssen ===== |
- | cryptsetup luksAddKey / | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | Passphrase in Slot gezielt ändern: | + | |
< | < | ||
- | cryptsetup luksChangeKey / | + | uname -mrs = current kernel |
- | + | dpkg --list | egrep -i --color ' | |
- | </ | + | aptitude purge linux-image-5.10.0-{18, |
- | + | update-grub | |
- | Passphrase entfernen | + | reboot |
< | < | ||
- | cryptsetup luksKillSlot / | ||
- | |||
- | </ | ||
- |