maandag 24 oktober 2022

Till disk do us part


Mijn bescheiden homelab bestaat onder andere uit een i5 NUC met 64 GB RAM, een QNAP NAS met 4 TB aan opslag en een HP ProCurve-switch als verbindende schakel. De NUC is verantwoordelijk voor het rekenwerk en draait Windows Server 2019 Hyper-V Core, terwijl de NAS voornamelijk als opslag dient—al ben ik nog van plan om op termijn te ontdekken wat dat apparaat verder allemaal in huis heeft.

Na uitgezocht te hebben hoe je eenvoudig een iSCSI LUN kunt aanmaken op de NAS, was het tijd om mijn NUC aan het werk te zetten. Windows Server 2019 Hyper-V Core komt, zoals beloofd, zonder grafische interface, dus je bent vooral aangewezen op de command line. Gelukkig zijn er nog een paar bruikbare GUI-onderdelen beschikbaar, zoals Kladblok en het Configuratiescherm.

De eerste stap is het configureren van de iSCSI-initiator, die tegenwoordig standaard in Windows aanwezig is. Deze start je met het volgende commando:

C:\>iscsicpl

Afbeelding 1. iScscicpl. Klik Refresh. Klik Connect. Done.

Vervolgens heb ik eenvoudig de discovery uitgevoerd en de eerder aangemaakte LUN op mijn NAS gekoppeld. De verbinding kan eventueel nog beveiligd worden met CHAP-authenticatie, maar die stap heb ik voor nu overgeslagen.

Dan nu: hoe maken we hier een D:-schijf van? Antwoord: Diskpart!

C:\>diskpart

Microsoft DiskPart version 10.0.17763.1

Copyright (C) Microsoft Corporation.

On computer: 

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt

  --------  -------------  -------  -------  ---  ---

  Disk 0    Online          119 GB      0 B

  Disk 1    Offline        1024 GB  1024 GB

Okay, hoe krijgen we de nieuwe schijf nu online?

Simpel: via Diskpart. Start Diskpart vanuit de CLI en gebruik de volgende stappen:

DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> online disk

DiskPart successfully onlined the selected disk.

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt

  --------  -------------  -------  -------  ---  ---

  Disk 0    Online          119 GB      0 B

* Disk 1    Online         1024 GB  1024 GB

Nice! De schijf staat online — tijd om een partitie aan te maken.

DISKPART> create partition primary

DiskPart has encountered an error: The media is write protected.

See the System Event Log for more information.

Haha, precies — pets erop en door! 😄

DISKPART> attributes disk clear readonly

Disk attributes cleared successfully.

DISKPART> create partition primary

DiskPart succeeded in creating the specified partition.

DISKPART> list partition

  Partition ###  Type              Size     Offset

  -------------  ----------------  -------  -------

* Partition 1    Primary           1023 GB  1024 KB

Und jetzt, tijd voor wat meer volume.

DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info

  ----------  ---  -----------  -----  ----------  -------  ---------  --------

  Volume 0         System Rese  NTFS   Partition    549 MB  Healthy    System

  Volume 1     C                NTFS   Partition    118 GB  Healthy    Boot

* Volume 2                      RAW    Partition   1023 GB  Healthy

DISKPART> select volume 2

Volume 2 is the selected volume.

DISKPART> format fs=ntfs

  100 percent completed

DiskPart successfully formatted the volume.

**Dit duurde heel lang**. Nu is het tijd om de schijf te koppelen.

DISKPART> assign

DiskPart successfully assigned the drive letter or mount point.

DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info

  ----------  ---  -----------  -----  ----------  -------  ---------  --------

  Volume 0         System Rese  NTFS   Partition    549 MB  Healthy    System

  Volume 1     C                NTFS   Partition    118 GB  Healthy    Boot

* Volume 2     D                NTFS   Partition   1023 GB  Healthy

DISKPART> Exit

C:\>d:

D:\> YES!!!

Wil je het serieuze pad op met clustering of failover, of ga je voor de "vooral lekker klooien"-aanpak? Denk dus altijd na over de volgende stap. 


EmoticonEmoticon