Skip to content

ZFS-Pool - Do not use (sda & sdb) to create a pool!

Linux
  • Was ist passiert?

    root@pve:~# zpool status
      pool: ZFS-Pool
     state: DEGRADED
    status: One or more devices could not be used because the label is missing or
    	invalid.  Sufficient replicas exist for the pool to continue
    	functioning in a degraded state.
    action: Replace the device using 'zpool replace'.
       see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-4J
      scan: resilvered 841G in 01:52:53 with 0 errors on Sun Oct 17 10:18:42 2021
    config:
    
    	NAME                                          STATE     READ WRITE CKSUM
    	ZFS-Pool                                      DEGRADED     0     0     0
    	  mirror-0                                    DEGRADED     0     0     0
    	    ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K6XD2C26  ONLINE       0     0     0
    	    8992518921607088473                       UNAVAIL      0     0     0  was /dev/sdb1
    
    errors: No known data errors
    

    Ich hatte die Tage den ZFS-Pool für meinen Proxmox mit einer Devicebezeichnung /dev/sdb angelegt. Wie ich schon kurz danach begriffen hatte, keine gute Idee. Ich war aber in der Annahme, das das nicht so häufig passiert, das die Laufwerksbezeichnungen sich verschieben.

    Da ich heute das Gehäuse komplett fertig montiert habe, Laufwerke festgemacht usw. , habe ich bewusst kein SATA-Kabel angefasst, ausgesteckt usw. Es hat nichts geholfen, nach einen Neustart des Proxmox waren die Laufwerksbezeichnungen durcheinander.

    dev.png

    Ich habe zwei ZFS_Pools, der ZFS-Pool für den Proxmox und einen Pool, der an eine VM durchgereicht wird. Den hatte ich korrekt mit den IDs aus /dev/disk/by-id angelegt. Darum ist der auch noch intakt.

    root@debian1:~# zpool status
      pool: NAS
     state: ONLINE
      scan: resilvered 232K in 00:00:01 with 0 errors on Sun Oct 17 16:38:46 2021
    config:
    
    	NAME                                      STATE     READ WRITE CKSUM
    	NAS                                       ONLINE       0     0     0
    	  mirror-0                                ONLINE       0     0     0
    	    scsi-0QEMU_QEMU_HARDDISK_drive-scsi1  ONLINE       0     0     0
    	    scsi-0QEMU_QEMU_HARDDISK_drive-scsi2  ONLINE       0     0     0
    
    errors: No known data errors
    

    Ok, wie bekommen wir das gefixt? Der Fehler schreibt ja genau, was zu machen ist.

    ZFS zeigt uns genau die Ursache

    status: One or more devices could not be used because the label is missing or
        	invalid.  Sufficient replicas exist for the pool to continue
        	functioning in a degraded state.
    

    und das was man machen soll.

    action: Replace the device using 'zpool replace'.
           see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-4J
    

    Ich habe mich dafür entschieden, das hier zu machen.

     zpool replace test c0t0d1
    

    Ok, was brauche ich? Die ID der Platte.

    root@pve:/dev/disk/by-id# ls -lha
    total 0
    drwxr-xr-x 2 root root 860 Oct 18 09:03 .
    drwxr-xr-x 8 root root 160 Oct 18 09:03 ..
    lrwxrwxrwx 1 root root   9 Oct 18 09:03 ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K5PPSH52 -> ../../sdc
    lrwxrwxrwx 1 root root  10 Oct 18 09:03 ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K5PPSH52-part1 -> ../../sdc1
    lrwxrwxrwx 1 root root  10 Oct 18 09:03 ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K5PPSH52-part9 -> ../../sdc9
    lrwxrwxrwx 1 root root   9 Oct 18 09:03 ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K6XD2C26 -> ../../sda
    lrwxrwxrwx 1 root root  10 Oct 18 09:03 ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K6XD2C26-part1 -> ../../sda1
    lrwxrwxrwx 1 root root  10 Oct 18 09:03 ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K6XD2C26-part9 -> ../../sda9
    [..gekürzt..]
    

    zpool status zeigt mir an, welche Platte im Pool intakt ist.

    ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K6XD2C26
    

    Ok, dann brauche ich jetzt die andere

    ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K5PPSH52
    

    Soweit die Theorie. Nasse Hände? Ein wenig 🙂 Dann mal los....

    zpool replace ZFS-Pool ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K5PPSH52
    

    Ok, geht nicht.

    root@pve:/dev/disk/by-id# zpool replace ZFS-Pool ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K5PPSH52
    invalid vdev specification
    use '-f' to override the following errors:
    /dev/disk/by-id/ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K5PPSH52-part1 is part of active pool 'ZFS-Pool'
    

    Hmm, also nachdenken. Das Laufwerk muss raus aus dem Pool, also das hier 8992518921607088473

    root@pve:~# zpool detach ZFS-Pool 8992518921607088473
    

    Status danach

    root@pve:~# zpool status
      pool: ZFS-Pool
     state: ONLINE
      scan: resilvered 841G in 01:52:53 with 0 errors on Sun Oct 17 10:18:42 2021
    config:
    
    	NAME                                        STATE     READ WRITE CKSUM
    	ZFS-Pool                                    ONLINE       0     0     0
    	  ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K6XD2C26  ONLINE       0     0     0
    
    errors: No known data errors
    

    Gut, jetzt die richtige Platte wieder hinzufügen. Ich hatte erst noch einen Replace probiert, aber er meckert, logisch, über eine nicht vorhandene Platte im Pool. Also, wieder hinzufügen, so wie ich das am Anfang gemacht habe. Aber diesmal mit der richtigen ID.

    zpool attach ZFS-Pool ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K6XD2C26 ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K5PPSH52
    

    Kam nix, kein Fehler. Juhu! Kontrolle...

    root@pve:~# zpool status
      pool: ZFS-Pool
     state: ONLINE
    status: One or more devices is currently being resilvered.  The pool will
    	continue to function, possibly in a degraded state.
    action: Wait for the resilver to complete.
      scan: resilver in progress since Mon Oct 18 15:32:05 2021
    	52.7G scanned at 5.85G/s, 324K issued at 36K/s, 1.19T total
    	0B resilvered, 0.00% done, no estimated completion time
    config:
    
    	NAME                                          STATE     READ WRITE CKSUM
    	ZFS-Pool                                      ONLINE       0     0     0
    	  mirror-0                                    ONLINE       0     0     0
    	    ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K6XD2C26  ONLINE       0     0     0
    	    ata-WDC_WD40EZRZ-00GXCB0_WD-WCC7K5PPSH52  ONLINE       0     0     0
    
    errors: No known data errors
    

    Ok, der Pool wird wieder neu gespiegelt oder was auch immer 🙂 Fertig!!

    Merksatz

    NIE, NIE einen ZPoll mit Laufwerksbezeichnungen anlegen. Auch wenn das hunderte Webseiten so im Netz zeigen. NIEMALS! Immer die IDs benutzen!!

  • Hier kurz vor dem Abschluss der Spiegelung.

    d54abd23-aa52-482d-b9e1-52ece09106ec-grafik.png

    Und alles wieder gut und eine Menge gelernt 🤓

    594b6283-bbbe-4cec-8401-d57cce52012b-grafik.png

  • Proxmox 8.1 released

    Linux
    1
    0 Stimmen
    1 Beiträge
    97 Aufrufe
    Niemand hat geantwortet
  • 0 Stimmen
    4 Beiträge
    653 Aufrufe
    FrankMF

    Ich parke das mal hier, damit ich das nicht noch mal vergesse. Hat mich eben mal wieder eine Stunde gekostet 😞

    /etc/ansible/ansible.cfg

    [defaults] host_key_checking = False

    Edit -> https://linux-nerds.org/topic/1493/ansible-host_key_checking

  • 0 Stimmen
    9 Beiträge
    362 Aufrufe
    FrankMF

    Ergänzt um eine automatische Übernahme der Tags aus dem Forum. Man muss den Beiträgen in Mastodon ja auch Reichweite geben 🙂

  • Python & Redis-Datenbank

    Verschoben Linux
    3
    0 Stimmen
    3 Beiträge
    95 Aufrufe
    FrankMF

    Heute dann die nächste Herausforderung. Mein JSON soll so aussehen, damit ich das entsprechend erweitern kann.

    Stocks {0: {'stockname': 'Deutsche Telekom Aktie', 'wkn1': '4534543534', 'wkn2': 'sfsdfsdfsfdfd', 'quantity': 100}, 1: {'stockname': 'Henkel', 'wkn1': '4534543534', 'wkn2': 'sfsdfsdfsfdfd', 'quantity': 50}}

    Die Daten sollen wie oben schon ausprobiert, in einer Redis Datenbank liegen. So weit auch kein großes Problem. ABER, der Zugriff auf diese Daten war dann meine nächste Hürde 🙂

    Ok, ich habe also mehrere Einträge im JSON File bzw. in der Datenbank. Wie komme ich da nun wieder dran. Ein paar ☕ später dann die Lösung.

    Wie komme ich an den einzelnen Eintrag, also über den Index??

    r1.json().get('stocks', 1)

    Gibt als Ergebnis

    {'stockname': 'Henkel', 'wkn1': '4534543534', 'wkn2': 'sfsdfsdfsfdfd', 'quantity': 50}

    Ok, das passt schon mal. Somit kann man dann gewohnt auf die einzelnen Elemente zugreifen.

    print("TESTING", testing['stockname'])

    Ausgabe

    TESTING Henkel

    Ok, Teil 1 erledigt. Jetzt habe ich ja irgendwann mehrere Elemente in der Liste und brauch dann den letzten Index , um damit was machen zu können. Also, z.B. durch die Daten zu loopen.

    objkeys = r1.json().objkeys('stocks') print("Objkeys", objkeys)

    Ausgabe

    Objkeys ['0', '1']

    Ok, kommt eine Liste des Index zurück. Damit kann man arbeiten 😉

    Ich hatte dann zum Testen mittels einer while Schleife die Daten geladen, aber jetzt beim Tippen klingelt es und wir machen das schön mit enumerate 😉

    @staticmethod def load(): data = {} for count, value in enumerate(objkeys): testing = r1.json().get('stocks', count) data[count] = { "stockname": testing['stockname'], "wkn1": testing['wkn1'], "wkn2": testing['wkn2'], "quantity": testing['quantity']} return data

    Somit habe ich die Daten aus der Redis Datenbank in einem Objekt und kann damit arbeiten.

  • Pycharm & Docker

    Verschoben Linux
    1
    0 Stimmen
    1 Beiträge
    93 Aufrufe
    Niemand hat geantwortet
  • 0 Stimmen
    1 Beiträge
    2k Aufrufe
    Niemand hat geantwortet
  • 0 Stimmen
    1 Beiträge
    160 Aufrufe
    Niemand hat geantwortet
  • Proxmox - Backups

    Proxmox
    2
    0 Stimmen
    2 Beiträge
    349 Aufrufe
    FrankMF

    Ok, heute auf Twitter mitbekommen, das er aktualisiert hat.

    Der Inhalt des Ordners

    root@frank-mankel:~/pve-patches# ls -lha total 572K drwxr-xr-x 3 root root 4.0K Jul 29 16:27 . drwx------ 7 root root 4.0K Jul 29 16:27 .. drwxr-xr-x 8 root root 4.0K Jul 29 16:27 .git -rwxr-xr-x 1 root root 13K Jul 29 16:27 pve-2.2-diff-backup-addon -rwxr-xr-x 1 root root 14K Jul 29 16:27 pve-2.3-diff-backup-addon -rwxr-xr-x 1 root root 14K Jul 29 16:27 pve-3.0-diff-backup-addon -rwxr-xr-x 1 root root 14K Jul 29 16:27 pve-3.1-diff-backup-addon -rwxr-xr-x 1 root root 14K Jul 29 16:27 pve-3.2-diff-backup-addon -rwxr-xr-x 1 root root 14K Jul 29 16:27 pve-3.3-diff-backup-addon -rwxr-xr-x 1 root root 14K Jul 29 16:27 pve-3.4-14-diff-backup-addon -rwxr-xr-x 1 root root 14K Jul 29 16:27 pve-3.4-diff-backup-addon -rwxr-xr-x 1 root root 16K Jul 29 16:27 pve-4.0-diff-backup-addon -rwxr-xr-x 1 root root 16K Jul 29 16:27 pve-4.1-22-diff-backup-addon -rwxr-xr-x 1 root root 16K Jul 29 16:27 pve-4.1-diff-backup-addon -rwxr-xr-x 1 root root 16K Jul 29 16:27 pve-4.2-17-diff-backup-addon -rwxr-xr-x 1 root root 16K Jul 29 16:27 pve-4.2-diff-backup-addon -rwxr-xr-x 1 root root 16K Jul 29 16:27 pve-4.3-diff-backup-addon -rwxr-xr-x 1 root root 16K Jul 29 16:27 pve-4.4-13-diff-backup-addon -rwxr-xr-x 1 root root 16K Jul 29 16:27 pve-4.4-diff-backup-addon -rwxr-xr-x 1 root root 16K Jul 29 16:27 pve-5.0-diff-backup-addon -rwxr-xr-x 1 root root 20K Jul 29 16:27 pve-5.1-48-diff-backup-addon -rwxr-xr-x 1 root root 16K Jul 29 16:27 pve-5.1-diff-backup-addon -rwxr-xr-x 1 root root 16K Jul 29 16:27 pve-5.2-2-diff-backup-addon -rwxr-xr-x 1 root root 18K Jul 29 16:27 pve-5.3-9-diff-backup-addon -rwxr-xr-x 1 root root 18K Jul 29 16:27 pve-5.4-5-diff-backup-addon -rwxr-xr-x 1 root root 18K Jul 29 16:27 pve-6.0-1-diff-backup-addon -rwxr-xr-x 1 root root 18K Jul 29 16:27 pve-6.0-5-diff-backup-addon -rwxr-xr-x 1 root root 713 Jul 29 16:27 pve-verify-backups -rwxr-xr-x 1 root root 70K Jul 29 16:27 pve-xdelta3_3.0.5-1_amd64.deb -rwxr-xr-x 1 root root 70K Jul 29 16:27 pve-xdelta3_3.0.6-1_amd64.deb -rw-r--r-- 1 root root 6.7K Jul 29 16:27 README.md

    Meine Version

    00c8e918-7109-47bb-bd48-50958f632597-grafik.png

    Da hat der Patch natürlich nicht funktioniert.