Use WMI and Powershell to check and see if disk is Virtual, local or SAN

PS N:\> Get-WmiObject Win32_DiskDrive | % {
>>   $disk = $_
>>   $partitions = “ASSOCIATORS OF ” +
>>                 “{Win32_DiskDrive.DeviceID=’$($disk.DeviceID)’} ” +
>>                 “WHERE AssocClass = Win32_DiskDriveToDiskPartition”
>>   Get-WmiObject -Query $partitions | % {
>>     $partition = $_
>>     $drives = “ASSOCIATORS OF ” +
>>               “{Win32_DiskPartition.DeviceID=’$($partition.DeviceID)’} ” +
>>               “WHERE AssocClass = Win32_LogicalDiskToPartition”
>>     Get-WmiObject -Query $drives | % {
>>       New-Object -Type PSCustomObject -Property @{
>>         Disk        = $disk.DeviceID
>>         DiskSize    = $disk.Size
>>         DiskModel   = $disk.Model
>>         Partition   = $partition.Name
>>         RawSize     = $partition.Size
>>         DriveLetter = $_.DeviceID
>>         VolumeName  = $_.VolumeName
>>         Size        = $_.Size
>>         FreeSpace   = $_.FreeSpace
>>       }
>>     }
>>   }
>> }
>>

results

DiskSize    : 53694627840
RawSize     : 53560279040
FreeSpace   : 52996517888
Disk        : \\.\PHYSICALDRIVE7
DriveLetter : E:
DiskModel   : NETAPP LUN C-Mode  Multi-Path Disk Device
VolumeName  : Sys DB
Size        : 53560274944
Partition   : Disk #7, Partition #0

DiskSize    : 53686402560
RawSize     : 53552742400
FreeSpace   : 48738844672
Disk        : \\.\PHYSICALDRIVE1
DriveLetter : D:
DiskModel   : VMware Virtual disk SCSI Disk Device
VolumeName  : Bin
Size        : 53552738304
Partition   : Disk #1, Partition #0

via the Internet

Advertisements

Delete volumes, relationships, snapshots, snapvaults, snapmirrors in NetApp cDot

anystor300::*> volume delete -vserver anyvsrv001_esxh -volume T2C0_vol1320_someipms325_Export -disable-offline-check true

Error: command failed: Volume “T2C0_vol1320_someipms325_Export” in Vserver “anyvsrv001_esxh” is the source endpoint of one or more SnapMirror relationships. Before you
delete the volume, you must release the source information of the SnapMirror relationships using “snapmirror release”. To display the destinations to be used in the
“snapmirror release” commands, use the “snapmirror list-destinations -source-vserver anyvsrv001_esxh -source-volume T2C0_vol1320_someipms325_Export” command.

anystor300::*> snapmirror list-destinations -source-vserver anyvsrv001_esxh -source-volume T2C0_vol1320_someipms325_Export
Progress
Source             Destination         Transfer   Last         Relationship
Path         Type  Path         Status Progress   Updated      Id
———– —– ———— ——- ——— ———— —————
anyvsrv001_esxh:T2C0_vol1320_someipms325_Export
DP    somevsrv001_esxh:T2C0_lun1026_someipms325_Export_vol
Idle    –         –            2a3a0416-40f0-11e5-9b65-123478563412

anystor300::*> snapmirror release -source-vserver anyvsrv001_esxh -source-volume T2C0_vol1320_someipms325_Export *
[Job 39418] Job succeeded: SnapMirror Release Succeeded
1 entry was acted on.

anystor300::*> volume delete -vserver anyvsrv001_esxh -volume T2C0_vol1320_someipms325_Export -disable-offline-check true

Warning: Are you sure you want to delete volume “T2C0_vol1320_someipms325_Export” in Vserver “anyvsrv001_esxh” ? {y|n}: y
[Job 39419] Job succeeded: Successful

Delete NetApp snapshots older than a certain data with PowerShell

PS N:\> $45days = (get-date).AddDays(-45)

 

PS N:\> Get-Ncvol | Get-NcSnapshot | where-object {($_.created -lt $45days -and $_.Name -Notlike “*snapmirror*”) -and $_.Name -Notlike “*Consistency*” -and $_.Name -notlike “*clone*”} | remove-ncsnapshot -whatif

 

Reference:

Linux drive resize example

593 vgdisplay

594  fdisk -l

595  fdisk /dev/sda

599  shutdown -r now

600  df -h

601  fdisk -l

602  fdisk /dev/sda

603  fdisk -l

604  pvcreate /dev/sda3

605  vgdisplay

606  vgextend vg_someserver /dev/sda3

607  vgdisplay vg_someserver | grep “Free”

608  lvdisplay

610  lvextend -L+79G /dev/vg_someserver/lv_root

611  df -h

612  lvdisplay

613  df -h /

614  resize2fs /dev/vg_someserver/lv_root

615  df -h