
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? Thanks Daniel.

Hi Daniel, On Wed, September 3, 2014 4:34 pm, Daniel J Jitnah wrote:
is it possible for a file to be written to and the time stamp not changed?
You use the touch command to revert back to the time before the change cf. http://askubuntu.com/questions/62492/how-can-i-change-the-date-modified-crea... Not exactly elegant, but it could work in a pinch. -- Lev Lafayette, BA (Hons), GradCertTerAdEd (Murdoch), GradCertPM, MBA (Tech Mngmnt) (Chifley) mobile: 0432 255 208 RFC 1855 Netiquette Guidelines http://www.ietf.org/rfc/rfc1855.txt

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?
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. Certainly this is the case if you do the writing at the device level without the filesystem unmounted, but that is just plain tedious. It should be easy for you to experiment.

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 It appears that using the swap file doesn't operate in the same manner as other filesystem access. 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. -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/

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.

On 04/09/14 11:19, Trent W. Buck wrote:
Daniel J Jitnah <djitnah@greenwareit.com.au> writes:
That does raise more questions on having swap on a ssd only system. As a rule, I don't recommend swap.
For small VPS say 1gb ram or less, swap is desirable. Why not zram? Thanks for that. Will definitely investigate further!
D.
_______________________________________________ luv-main mailing list luv-main@luv.asn.au http://lists.luv.asn.au/listinfo/luv-main

Daniel J Jitnah wrote:
Why not zram? Thanks for that. Will definitely investigate further!
I drop this bodge into rc.local. It turns a quarter of your RAM into compressed swap (using DEFLATE). Using LZ4 would probably be better if you have a new kernel. modprobe zram && awk '/^MemTotal/{printf("%dk",$2*0.25)}' /proc/meminfo >/sys/block/zram0/disksize && mkswap /dev/zram0 && swapon /dev/zram0 && sysctl vm.swappiness=80 This is how it looks in action: total used free Mem: 1884 954 930 -/+ buffers/cache: 222 1662 Swap: 511 0 511 So you see, I have no experience about whether it's any GOOD :-) IIRC the swappiness=80 was to encourage that last zero to grow.

On Wed, 3 Sep 2014 18:08:36 Daniel J Jitnah wrote:
It makes sense! When you think about it, the time stamp on a swap file is hardly useful information.
The fact that you wanted to see it in the first place indicates that it is useful on occasion.
Besides updating the time stamp each time swap is written to could be regarded as wasted critical cpu cycles.
CPU is not an issue. Disk access is an issue. For small writes if the mtime is updated you can double the disk IO requirement and worse than double it in the case of filesystems with journalled metadata.
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.
Not providing swap by default doesn't stop you from setting it up in most cases. It's possible for a VPS provider to force you to use a kernel compiled without swap support but I'm not aware of examples of anyone doing that. I've been using linode.com for a long time, they have always supported swap partitions through the management GUI. Recently they transitioned to using SSD for everything. -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/ -- Sent from my Samsung Galaxy Note 2 with K-9 Mail.

On 3 September 2014 15:34, Daniel J Jitnah <djitnah@greenwareit.com.au> wrote:
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?
I think [1] pswpin in /proc/vmstat reports swap usage, if that helps you. [1] http://www.linuxinsight.com/proc_vmstat.html
participants (6)
-
Allan Duncan
-
Daniel J Jitnah
-
David
-
Lev Lafayette
-
Russell Coker
-
trentbuck@gmail.com