Getting a list of logical drives
System.IO.DriveInfo.GetDrives()
System.IO.DriveInfo.GetDrives()
As mentioned elsewhere, under *NIX systems, block devices like /dev/sda can be accessed as plain files. Note that if file system is mounted from the device, opening it as file for writing would fail. If you want to play with block devices, I would advise to first use the loop device, which presents a plain … Read more
Hm, looking at your first set of code, I think you have retrieved (maybe?) the hard drive model. The serial # comes from Win32_PhysicalMedia. Get Hard Drive model ManagementObjectSearcher searcher = new ManagementObjectSearcher(“SELECT * FROM Win32_DiskDrive”); foreach(ManagementObject wmi_HD in searcher.Get()) { HardDrive hd = new HardDrive(); hd.Model = wmi_HD[“Model”].ToString(); hd.Type = wmi_HD[“InterfaceType”].ToString(); hdCollection.Add(hd); } Get … Read more
Finally a reliable solution! Two of them, actually! Check /sys/block/sdX/queue/rotational, where sdX is the drive name. If it’s 0, you’re dealing with an SSD, and 1 means plain old HDD. I can’t put my finger on the Linux version where it was introduced, but it’s present in Ubuntu’s Linux 3.2 and in vanilla Linux 3.6 … Read more
The ENOSPC (“No space left on device”) error will be triggered in any situation in which the data or the metadata associated with an I/O operation can’t be written down anywhere because of lack of space. This doesn’t always mean disk space – it could mean physical disk space, logical space (e.g. maximum file length), … Read more
#WMIC wmic is a very complete tool wmic diskdrive list provide a (too much) detailed list, for instance for less info wmic diskdrive list brief #C Sebastian Godelet mentions in the comments: In C: system(“wmic diskdrive list”); As commented, you can also call the WinAPI, but… as shown in “How to obtain data from WMI … Read more