Проверка выравнивания раздела с PowerCLI

Я - вполне уверенный perfmon, не может сделать этого, но Вы могли записать 'запланированную задачу', чтобы проверить и послать по электронной почте на предупреждении.

Это сказало, что я не уверен, что это - лучший способ иметь дело с этой проблемой - причина состоит в том, что можно быть ТАК вне памяти, что Вы не можете выполнить задачу или электронную почту, я настоятельно рекомендовал бы, чтобы Вы использовали другую машину, чтобы посмотреть на эту машину, проверить, что это - память (и возможно несколько другой статистики) и предупреждение оттуда. Таким образом, Вы сможете предупредить на этих ошибках или даже если машина падает.

Если у Вас нет инфраструктуры, чтобы иметь эту 'машину предупреждения', на выделенной машине Вы могли рассмотреть наличие двух машин, перепроверяющих друг друга.Надеюсь, это поможет.

5
задан 28 October 2013 в 22:34
1 ответ

Well, I see you've commented out the line that attempts to do the actual arithmetic. Your code as it is right now says "if partition starting offset = 65536 then partition is aligned".

That's not how it works. Partitions have all sorts of starting offsets. The WMI class returns 2 partitions on my laptop right now, neither of which have a starting offset of 65536.

Secondly, even if you uncommented the line above it, the one where it divides the starting offset by 65536 and compares the remainder to the Decimal data type... that's not how it works either. Don't use the Decimal type.

PS C:\> 1 -Is [Decimal]
False
PS C:\> 1.23 -Is [Decimal]
False

They both evaluate to false. That's not going to tell whether the division resulted in a remainder or not.

Give this a whirl:

Foreach($_ In Get-WMIObject Win32_DiskPartition | Select Name, BlockSize, NumberofBlocks, StartingOffset, @{n='Alignment';e={$_.StartingOffset/$_.BlockSize}}) { $_ }

Name           : Disk #0, Partition #0
BlockSize      : 512
NumberofBlocks : 614400
StartingOffset : 1048576
Alignment      : 2048

Name           : Disk #0, Partition #1
BlockSize      : 512
NumberofBlocks : 487778304
StartingOffset : 315621376
Alignment      : 616448

If Alignment is a whole number, you're good. If it's a decimal, alignment is wrong.

Here's a good article on partition alignment:

http://technet.microsoft.com/en-us/library/dd758814(v=SQL.100).aspx

By the way, this is not something you typically need to worry about on Windows 2008+ VMs. Windows can handle its own partition alignment. Windows 2003 and below, maybe.

4
ответ дан 3 December 2019 в 01:45

Теги

Похожие вопросы