
On 03/09/14 17:04, Russell Coker wrote:
On Wed, 3 Sep 2014 15:59:48 Allan Duncan wrote:
On 03/09/14 15:34, Daniel J Jitnah wrote:
Hi Luvers,
is it possible for a file to be written to and the time stamp not changed?
Specifically, is it possible for a swap file to be changed and the time stamp not changed? OR if the time stamp on a swap file has not changed for several days, does that mean that the system has not used swap for that time, since this is the only swap space available? or could it be that the kernel process that initiates swap does not update the filesystem fully? # free total used free shared buffers cached Mem: 12498384 11585772 912612 0 52412 1308840 -/+ buffers/cache: 10224520 2273864 Swap: 2097148 7260 2089888 # ls -l /root/swap -rw-r--r--. 1 root root 2.0G Oct 18 2012 /root/swap # uptime 07:01:40 up 66 days, 22:41, 1 user, load average: 0.61, 0.49, 0.59 Thats most useful! Thanks.
It makes sense! When you think about it, the time stamp on a swap file is hardly useful information. Besides updating the time stamp each time swap is written to could be regarded as wasted critical cpu cycles.
It appears that using the swap file doesn't operate in the same manner as other filesystem access. That does raise more questions on having swap on a ssd only system. There are VPS providers now that are offering VPS's using ssd's. It looks that they are not also providing swap. For small VPS say 1gb ram or less, swap is desirable.
Daniel.
I guess that the filesystem provides a list of blocks on disk that are then accessed without the filesystem. The above is from one of my systems, timestamp says that it was last written in 2012 but 7M of swap was written in the last 66 days.
I'm just surmising here so don't take it as gospel.
If you have a pre-existing file, as swap files usually are, then you can use dd to write into the guts of it without altering any of the time stamps. No, dd uses regular write mechanisms and the time stamp will be updated. However you could write to it and then set the time stamp back.
Certainly this is the case if you do the writing at the device level without the filesystem unmounted, but that is just plain tedious. swap is different.