hard-drive

How can I find hard disk speed

删除回忆录丶 提交于 2019-12-06 05:19:28
How can I find hard disk speed? I can not use System.IO.File.Copy and use timer to get hard disk speed, because after caching file, the speed will be really higher than real time. What can I do instead? The reason the subsequent read speed is much higher than expected after writing a file, is that the file is cached by the OS in the disk system cache when it is written i.e. in-memory. The subsequent file read is in effect being read from memory, rather than disk. Please see this code project article which provides a solution for bypassing the OS disk cache by leveraging the FILE_FLAG_NO

Disk seek time measurement method

随声附和 提交于 2019-12-06 04:27:11
问题 I write a script to measure seek times on a HDD and a small change in how its done results in dramatically different times. First cycle makes jumps within an area at beginning of the disk. Second cycle selects random areas (of same size) on disk where seeks are performed. This approach is clearly different but I dont understand why it would change results? Notice that for large areas measurements converge for both methods. Bytes* methods just format numbers nicely (1024 <-> "1KB"). Script

using c# how can I extract information about the hard drives present on the local machine

时光总嘲笑我的痴心妄想 提交于 2019-12-05 21:19:53
I'm looking to get data such as Size/Capacity, Serial No, Model No, Heads Sectors, Manufacturer and possibly SMART data. You can use WMI Calls to access info about the hard disks. //Requires using System.Management; & System.Management.dll Reference ManagementObject disk = new ManagementObject("win32_logicaldisk.deviceid=\"c:\""); disk.Get(); Console.WriteLine("Logical Disk Size = " + disk["Size"] + " bytes"); Console.WriteLine("Logical Disk FreeSpace = " + disk["FreeSpace"] + "bytes"); You should use the System.Management namespace: System.Management.ManagementObjectSearcher ms = new System

Calculating hard drive throughput

江枫思渺然 提交于 2019-12-05 21:12:01
My app creates a 2GB file and needs to select the fastest drive on the system with enough space. I am trying to calculate throughput by creating the file, setting the length, then writing data to it sequentially as follows: FileInfo file = null; var drives = DriveInfo.GetDrives(); var stats = new List<DriveInfoStatistics>(); foreach (var drive in drives) { do { file = new FileInfo(Path.Combine(drive.RootDirectory.FullName, Guid.NewGuid().ToString("D") + ".tmp")); } while (file.Exists); try { using (var stream = file.Open(FileMode.CreateNew, FileAccess.Write, FileShare.None)) { var seconds = 10

c# - How to list all files and folders on a hard drive?

余生颓废 提交于 2019-12-05 02:43:32
问题 I want to list all files and folders that my program has access to and write them to a text file. How would I get the list? I need a way that will catch or not throw UnauthorizedAccessExceptions on folders that are not accessible. 回答1: Please try using the code: private static IEnumerable<string> Traverse(string rootDirectory) { IEnumerable<string> files = Enumerable.Empty<string>(); IEnumerable<string> directories = Enumerable.Empty<string>(); try { // The test for

Why is average disk seek time one-third of the full seek time?

假装没事ソ 提交于 2019-12-05 02:15:01
问题 I have read in many books and papers, considering disk performance, that the average seek time is roughly one-third of the full seek time, but no one really offers any explanation about that. Where does this come from? 回答1: The average is calculated mathematically using calculus. We use the very basic formula for calculation of average. Average seek time = (Sum of all possible seek times)/(Total no. of possible seek times) The disk is assumed to have N number of tracks, so that these are

Volume to physical drive

こ雲淡風輕ζ 提交于 2019-12-05 00:18:09
问题 QueryDosDevice(L"E:", DeviceName, MAX_PATH); (E: is a SD card) DeviceName is "\Device\HarddiskVolume3" How do I "convert" it to something like "\\.\PHYSICALDRIVE1" 回答1: Volumes are made up of one or more partitions, which reside on disks. So, E: doesn't necessarily map to a single disk in the system (think software RAID). The way you map volumes to the PhysicalDrive names in Win32 is to first open the volume and then send IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS. This will give you a structure

How to read individual sectors/clusters using DeviceIoControl() in Windows?

廉价感情. 提交于 2019-12-04 16:51:31
I dropped my laptop while Windows was preparing to hibernate and as a result, I got a head crash on the hard drive. (Teaches me to get a hard drive and/or laptop with a freefall sensor next time around.) Anyway, running SpinRite to try to recover the data has resulted in all the spare sectors on the disk to all be all used up for all the recoverable sectors so far. SpinRite is still going right now, but since there won't be anymore spare sectors to be used, I think it'll be a fruitless exercise except to tell me where all the bad sectors are. Anyway, I'm planning on writing an application to

Non-file FileSystems?

送分小仙女□ 提交于 2019-12-04 14:49:39
问题 I've been thinking on this for a while now (you know, that dangerous thing programmers tend to do) and I've been wondering, is the method of storing data that we're so accustomed to really all that efficient? The trouble with answering this question is that I really don't have anything to compare it to, since it's the only thing I've ever used. I don't mean FAT or NTFS or a particular type of file system, I mean the filesystem structure as a whole. We are simply used to thinking of "files"

How does one map physical sectors of a disk to the files that contain them on an HFS+ volume on Mac OS X

泄露秘密 提交于 2019-12-04 13:01:37
I've been recovering a hard disk using dd_rescue , which provides me a list of all of the device sectors it could not copy due to hardware errors. I'd like to take that list, and write a tool to give me all of the files that contain these bad sectors so I can delete them. I'm not sure what APIs I can use to do this--essentially i want to get a list of all files on disk and for each file, a list of the ranges of sectors it occupies on disk. My first guess is that I will iterate over each directory entry on the disk and check to see if the file overlaps one of these bad sectors. Maybe there's a