Share this page : facebooktwitterlinkedinmailfacebooktwitterlinkedinmail

This page, I will note some command work on the simple volume, virtual disk, iscsi disk.

Create simple volume

 

1. (Get-disk) Display the disks(virtual or physical) general information

PS C:\> Get-Disk 
 
Number Friendly Name                      OperationalStatus  Total Size Partition Style 
------ -------------                      -----------------  ---------- --------------- 
0      ATA ST3250310NS SCSI Disk Device   Online             232.83 GB  MBR 
4      Microsoft Storage Space Device     Offline            2 TB       RAW

Write down the number of the disk you want to work with. we take the number 4 as a example here.

2. You will use this information with the Initialize-Disk cmdlet as follows:

PS C:\> Initialize-Disk -Number 4

By default, the Initialize-Disk cmdlet creates a GUID Partition Table (GPT) type of disk, If you want to, you can use the –PartitionStyle parameter, which can be followed by mbr or gpt.

GPT will automatically install the EFI System Partition (ESP), which contains the boot loader, EFI drivers, and all other necessary files for booting the system (such as boot.ini, HAL, and NT Loader). It utilizes the GUID Partition Table rather than the master boot record. The ESP is 1% of the drive capacity, or a minimum size of 100MB and a maximum size of 1,000MB.

So the GPT partition has to be at least 100MB.

3. create new partion by New-Partition cmdlet as follows:

PS C:\> New-Partition -DiskNumber 4 -UseMaximumSize -AssignDriveLetter 
 
   Disk Number: 4 
 
PartitionNumber  DriveLetter Offset     Size Type 
---------------  ----------- ------     ---- ---- 
2                E           135266304  2 TB Basic

 

4. Write down the Drive Letter from the last line of the output. Once you create the new volume,  you can use the Format-Volume cmdlet to format it as follows:

PS C:\> Format-Volume -DriveLetter E -FileSystem NTFS

Storage Pool

 

1.  Begin by using the Get-StoragePool cmdlet to display a list of storage pools on the server:

PS C:\> Get-StoragePool 
 
FriendlyName     OperationalStatus   HealthStatus    IsPrimordial       IsReadOnly 
------------     -----------------   ------------    ------------       ---------- 
Primordial       OK                  Healthy         True               False

2. Next, use the Get-PhysicalDisk cmdlet to display a list of physical disks connected to the
server:

PS C:\> Get-PhysicalDisk 
 
FriendlyName     CanPool    OperationalStatus  HealthStatus   Usage         Size 
------------     -------    -----------------  ------------   -----         ---- 
PhysicalDisk0    False      OK                 Healthy        Auto-Select   232.83 GB 
PhysicalDisk1    True       OK                 Healthy        Auto-Select   232.83 GB 
PhysicalDisk2    True       OK                 Healthy        Auto-Select   232.83 GB 
PhysicalDisk3    True       OK                 Healthy        Auto-Select   232.83 GB

Only disks that have their CanPool property set to True are available for assigning to new storage pools you create

3. Use Get-PhysicalDisk again to assign such disks to a variable $phydisks:

PS C:\> $phydisks = (Get-PhysicalDisk | where CanPool -eq True)

4. Next, use the Get-StorageSubSystem cmdlet to display the available storage subsystem on the server:

PS C:\> Get-StorageSubSystem 
 
FriendlyName                      HealthStatus               OperationalStatus 
------------                      ------------               ----------------- 
Storage Spaces on HOST7           Healthy                    OK

Assign the object that is the output from this command to another variable $subsystem:

PS C:\> $subsystem = (Get-StorageSubSystem)

5. Now use the New-StoragePool cmdlet to create the new storage pool as follows:

PS C:\> New-StoragePool -FriendlyName "Archive Pool" ` 
-StorageSubSystemFriendlyName $subsystem.FriendlyName -PhysicalDisks $phydisks 
 
FriendlyName    OperationalStatus   HealthStatus   IsPrimordial   IsReadOnly 
------------    -----------------   ------------   ------------   ---------- 
Archive Pool    OK                  Healthy        False          False

Note that the $subsystem.FriendlyName in the preceding command represents the value of the FriendlyName property of the $subsystem variable  In other words, it represents the friendly name of the storage subsystem

6. Finally, you can use Get-StoragePool again to verify the result:

PS C:\> Get-StoragePool 
 
FriendlyName    OperationalStatus   HealthStatus    IsPrimordial   IsReadOnly 
------------    -----------------   ------------    ------------   ---------- 
Primordial      OK                  Healthy         True           False 
Archive Pool    OK                  Healthy         False          False

7. Create  virtual disk  by New-VirtualDisk cmdlet :

PS C:\> New-VirtualDisk -StoragePoolFriendlyName "Archive Pool" ` 
-FriendlyName "Archive Disk" -ResiliencySettingName Mirror -ProvisioningType Thin ` 
-Size 2TB 
 
FriendlyName ResiliencySettingName OperationalStatus  HealthStatus IsManualAttach Size 
------------ -------------------   -----------------  ------------ -------------- ---- 
Archive Disk Mirror                OK                 Healthy      False          2 TB

 

8. You can create volume like simple volume from the virtual disk, go here.

Iscsi disk

First of all, make sure you can ping the Target Server.

Check here to learn add ISCSI target in target server.

Type “iscsicpl” to open a GUI or use powershell:

1. Begin by using the Get-IscsiTarget cmdlet to display a list of available targets that have been discovered on the target portal.

Write down the ” NodeAddress    : iqn.1991-05.com.microsoft:<target-server>-<request-host>-target ” part for step 2. for example:

“iqn.1991-05.com.microsoft:fileserver1-readonlydc1-target”

2. Connect to the target server:

Connect-IscsiTarget cmdlet and specify the IQN of target fabrikam-db like this:

PS C:\> Connect-IscsiTarget -NodeAddress ` 
"iqn.1991-05.com.microsoft:fileserver1-readonlydc1-target"

Verify by the Get-iscsiconnection.

The IsConnected property in the preceding command output indicates that your   connection attempt succeeded, but the value of the IsPersistent property indicates that your connection won’t persist across reboots.

To fx this, you can use the Register-IscsiSession   cmdlet with the SessionIdentifer taken from the preceding command output:
PS C:\> Register-IscsiSession -SessionIdentifier "fffffa80144a8020-4000013700000006"

Then we can go to the step same as create simple volume.