disk

Disable or flush page cache on Windows

拟墨画扇 提交于 2019-11-29 03:59:43
I assume Windows has a similar concept to Linux's page cache for storing in memory data from disks, like files, executables and dynamic libraries. I wonder if it is possible at all to disable such cache or to the very least to clear/flush it. Damon This is called Standby List under windows. You can purge it globally, or for one volume, or for one file handle. Globally You can do it using a readily available program from Microsoft Technet, by selecting Empty → Empty Standby List Programmatically, you can achieve the same thing using the undocumented NtSetSystemInformation function, for details

How to correctly convert filesize in bytes into mega or gigabytes?

拟墨画扇 提交于 2019-11-29 03:03:32
I'm using the DriveInfo class in my C# project to retrieve the available bytes on given drives. How to I correctly convert this number into Mega- or Gigabytes? Dividing by 1024 will not do the job I guess. The results always differ from those shown in the Windows-Explorer. Adam Davis 1024 is correct for usage in programs. The reason you may be having differences is likely due to differences in what driveinfo reports as "available space" and what windows considers available space. Note that only drive manufacturers use 1,000. Within windows and most programs the correct scaling is 1024. Also,

Detect disk activity in Delphi

江枫思渺然 提交于 2019-11-28 23:24:47
问题 I'm using Delphi 2007. I am copying files to a remote drive. When the copying ends, I shutdown/standby the machine. It can happen that some files don't get copied from buffer to disk, and the remote disk gets disconnected, so the backup is not completed. I need to detect disk activity on that disk to properly be able to take the close action on the machine. Is there a way to detect disk activity in this scenario? 回答1: (Please move the additional information from the comment to your question.)

Difference between sequential write and random write

自古美人都是妖i 提交于 2019-11-28 15:48:35
What is the difference between sequential write and random write in case of :- 1)Disk based systems 2)SSD [Flash Device ] based systems When the application writes something and the information/data needs to be modified on the disk then how do we know whether it is a sequential write or a random write.As till this point a write cannot be distinguished as "sequential" or "random".The write is just buffered and then applied to the disk when we will flush the buffer. Please correct me if I am wrong. When people talk about sequential vs random writes to a file, they're generally drawing a

Is it safe to delete the journal file of mongodb?

空扰寡人 提交于 2019-11-28 15:17:29
问题 If I delete the 3.1G journal file, sudo service mongodb restart will fail. However, this file is taking too much space. How can I solve this problem? How can I remove it? bash$ du -sh /var/lib/mongodb/* 4.0K _tmp 65M auction_development.0 128M auction_development.1 17M auction_development.ns 3.1G journal 4.0K mongod.lock 回答1: TL;DR: You have two options. Use the --smallfiles startup option when starting MongoDB to limit the size of the journal files to 128MB, or turn off journalling using the

disk space is full by `vda` files, how to clear them?

时光总嘲笑我的痴心妄想 提交于 2019-11-28 12:01:38
问题 So I have a VPS and it has whm / cpanel installed. For some reason its giving an error when ever I login to cpanel or visit a site on my server which says the disk space is full. When i check the desk space in WHM it says /dev/vda3 is 100% full. I don't know how to track that folder or what files i need to delete. Also on SSH it says root@server [~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda3 48G 47G 0 100% / tmpfs 939M 0 939M 0% /dev/shm /dev/vda1 485M 112M 348M 25% /boot

Find System Hard Disk Drive from Python?

点点圈 提交于 2019-11-28 10:08:37
问题 I am working on a software installer for my current application. It needs to be installed to the System HDD. How owuld I detect the system drive and return the letter from Python? Would the win32 extensions be useful? How about the os module pre packaged with Python? 回答1: This is how to return the letter of the System drive on a Win32 platform: import os print os.getenv("SystemDrive") The above snippet returns the system drive letter. In my case ( and most cases on windows) C: 回答2: If you

Physical disk size not correct (IoCtlDiskGetDriveGeometry)

懵懂的女人 提交于 2019-11-28 09:28:09
I use the code below to get the physical disk size , but the size returned is not correct. I've checked the size with other tools. The code below reports Total disk space: 8.249.955.840 bytes and it should be Total disk space: 8.254.390.272 bytes How can I retrieve the actual/correct physical disk size? Tested on USB drives and normal hard drives. The code is long, here separate it in parts to show. The structure: [StructLayout(LayoutKind.Sequential)] internal struct DiskGeometry { public long Cylinders; public int MediaType; public int TracksPerCylinder; public int SectorsPerTrack; public int

Programmatically getting per-process disk io statistics on Windows?

纵饮孤独 提交于 2019-11-28 08:46:32
I would like to display a list of processes (Windows, C++) and how much they are reading and writing from the disk in KB/sec. The Resource Monitor of Windows 7 has the ability so I should be able to do the same. However I have unable to find a relevant API-call or find anything in the perfmon counters. Could anyone point me in the direction? You can call GetProcessIoCounters to get overall disk I/O data per process - you'll need to keep track of deltas and converting to time-based rate yourself. This API will tell you total number of I/O operations as well as total bytes. WMI can do it, as

Why overwrite a file more than once to securely delete all traces of a file?

自作多情 提交于 2019-11-28 06:58:28
Erasing programs such as Eraser recommend overwriting data maybe 36 times. As I understand it all data is stored on a hard drive as 1s or 0s. If an overwrite of random 1s and 0s is carried out once over the whole file then why isn't that enough to remove all traces of the original file? A hard drive bit which used to be a 0, and is then changed to a '1', has a slightly weaker magnetic field than one which used to be a 1 and was then written to 1 again. With sensitive equipment the previous contents of each bit can be discerned with a reasonable degree of accuracy, by measuring the slight