How to flush cache of hard-disk and flash-disk (or filesystem) from command line?
Does sync
suffice?
Edit: regarding your edit - you are trying to avoid sync because some guy on the internet put a CYA disclaimer on his post? Maybe there is something wrong with sync of which I am unaware but that might be worth a 2nd post in itself.
Still, from the linux info pages:
sync writes any data buffered in memory out to disk. This can
include (but is not limited to) modified superblocks, modified inodes,
and delayed reads and writes. This must be implemented by the kernel;
The sync program does nothing but exercise the 'sync' system call.
How to purge disk I/O caches on Linux?
Sounds like you want the sync command, or the sync() function.
If you want disk cache flushing: echo 3 | sudo tee /proc/sys/vm/drop_caches
How to flush the disk read cache under Windows?
The only solution I found so far was http://chadaustin.me/2009/04/flushing-disk-cache/ but this ones takes too much time so I hope we'll find a better one.
Disable or flush page cache on Windows
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 see line 239 in a program which does the same thing as the previously mentioned one, among other things.
For one file handle
Open the file with FILE_FLAG_NO_BUFFERING
: The documentation is lying insofar as it says that you open the file without buffering, but the true, observable behavior on all Windows versions from Windows 98 up to Windows 8 is that it simply throws away the complete cache contents for that file (for everyone!) and doesn't repopulate the cache from reads that use this handle.
For one complete volume
A volume handle is just a file handle (a somewhat special one, but still), so assuming you have appropriate privilegues to open a volume handle, you can do the same for a complete volume.
Also, as pointed out in the answer here, there seems to be a feature/bug (feature-bug?) which allows you to invalidate a volume's cache even without proper privilegues merely by attepting to open it without shared writes, at least under one recent version of Windows.
It makes perfect sense that this happens when any open which is valid for writing succeeds as you may change filesystem-internal data doing so (insofar it is a feature), but apparently it also works when opening the volume fails (which is a bug).
Sync File System command for windows
There is a similar command available for Windows at http://technet.microsoft.com/sv-se/sysinternals/bb897438(en-us).aspx
How to empty/flush Windows READ disk cache in C#?
Why DIY?
If you only need to determine drive speed and not really interested in learning how to flush I/O buffers from .NET, you may just use DiskSpd utility from http://research.microsoft.com/barc/Sequential_IO/. It has random/sequential modes with and without buffer flushing.
The page also has some I/O related research reports you might find useful.
Can't format Hard Disk Drives and install linux to Dell hybrid ultrabook
I finally figured it out myself.
Solution:
First I booted OpenSUSE from USBKEY in UEFI mode.
In the intaller partitioner, I removed all partitions from the SSD and HDD
Then I created a new partition table, still using the partitioner.
Booted up from Ubuntu 15.04 USBKEY installer and it finally could manage partitions and install the system properly.
Although it sounds simple, it took some time and required two operating systems to solve the issue.
Since I booted in UEFI mode, when I created a new partition table, I believe it converted the disks to GPT format, and Ubuntu could finally "detect" and manage the disks partitions.
It remains a mystery why it didn't work in MBR/Legacy mode at all, even after creating a new partition table, and why OpenSUSE couldn't format/mount the partitions it created.
Finally I got linux on it.
Determine if PostgreSQL query ran from disk or from memory cache?
A query never runs "from disk" or "from cache". The query itself is always in memory.
But if you mean you want to find out if the data was retrieved from the shared buffers or directly from the filesystem then you can use
explain (analyze on, buffers on, verbose on)
select ....
the execution plan will then show you how many block where fetched from the shared buffers and how many from the filesystem. Note that a "read" from the filesystem might actually be returned from a cache as well as the file system manages its own cache (something Postgres relies on).
Related Topics
List Files Recursively in Linux Cli With Path Relative to the Current Directory
A Way to Determine a Process'S "Real" Memory Usage, I.E. Private Dirty Rss
Rounding Numbers with Bc in Bash
Linux Join Utility Complains About Input File Not Being Sorted
Gdb Appears to Ignore Executable Capabilities
Finding an Ip Address from an Interface Name
Best Way to Overwrite File with Itself
Linux' Hrtimer - Microsecond Precision
Linux/Perl: Additional Output Buffers Other Than Stdout and Stderr
How to Allocate a New Tls Area with Clone System Call
Put Every N Rows of Input into a New Column
How to Start Node.Js on Port 80 on a Linux Server
What Is the Best Git Config Set Up When You Are Using Linux and Windows
Max Thread Per Process in Linux