Search notes:

harddisk

Measuring IO Performance

With PowerShell

param (
    [int   ] $sizeInMB    = 100,
    [int   ] $chunkSizeMB =  10,
    [string] $filePath    = "$env:temp\file"
)

$chunkSizeBytes = $chunkSizeMB * 1MB

$bytesToWrite = $sizeInMB * 1MB
$chunks = [math]::Ceiling($bytesToWrite / $chunkSizeBytes)

$byteArray = new-object byte[] ($chunkSizeBytes)
$startTime = Get-Date

$fileStream = [System.IO.File]::OpenWrite($filePath)

for ($i = 1; $i -le $chunks; $i++) {
#
#   Write the chunks

    if ($i -eq $chunks) {
      #
      # Last chunk, write remaining bytes only

        $remainingBytes = $bytesToWrite % $chunkSizeBytes
        if ($remainingBytes -gt 0) {
            $byteArray = new-object byte[] ($remainingBytes)
        }
    }

    $fileStream.Write($byteArray, 0, $byteArray.Length)
#   write-host "Chunk $i written ($($byteArray.Length / 1MB) MB)"
}

$fileStream.Close()

$endTime = get-date

$timeTaken = $endTime - $startTime

write-host "File created: $filePath"
write-host "Size        : $sizeInMB MB"
write-host "Chunk size  : $chunkSizeMB MB"
write-host "Time taken  : $($timeTaken.totalSeconds) seconds"

Misc

The first sector on a harddisk is the MBR. (Is this still true? Has it ever been true)

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/hardware...', 1737202561, '3.129.23.179', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/hardware/harddisk/index(84): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78