Zfs - what does atime update?


 
Thread Tools Search this Thread
Operating Systems Solaris Zfs - what does atime update?
# 1  
Old 09-09-2015
Zfs - what does atime update?

It is widely documented that on zfs atime updates the access time on zfs.
Where is the access time updated on Solaris 11.2?

If I create file atimetest.txt under rpool/export/home:

Code:
# zfs list rpool/export/home
NAME                USED  AVAIL  REFER  MOUNTPOINT
rpool/export/home  13.3G  21.0G  13.3G  /export/home
#

Code:
# ls -lt /export/home/atimetest.txt
-rw-r--r--   1 root     root          15 Sep  9 09:31 /export/home/atimetest.txt
# cat /export/home/atimetest.txt
this is a test
#

The atime is set to on, so I set it to off:
Code:
# zfs get atime rpool/export/home
NAME               PROPERTY  VALUE  SOURCE
rpool/export/home  atime     on     default
# zfs set atime=off rpool/export/home
# zfs get atime rpool/export/home
NAME               PROPERTY  VALUE  SOURCE
rpool/export/home  atime     off    local
#

I then check the time, run ls -ld against the directory, run ls -tl against the file:
Code:
# date
Wednesday,  9 September 2015 09:39:10 BST
# ls -ld /export/home
drwxr-xr-x  11 root     root          12 Sep  9 09:31 /export/home
# ls -lt /export/home/atimetest.txt
-rw-r--r--   1 root     root          15 Sep  9 09:31 /export/home/atimetest.txt
#

Then cat the file from /:
Code:
# pwd
/
# cat /export/home/atimetest.txt
this is a test
#

Checking the directory with ls -ld and checking the file with ls -lt shows no update for the access time:
Code:
# ls -ld /export/home
drwxr-xr-x  11 root     root          12 Sep  9 09:31 /export/home
# ls -lt /export/home/atimetest.txt
-rw-r--r--   1 root     root          15 Sep  9 09:31 /export/home/atimetest.txt
#

So, where is the access time updated?
I can see the setting of atime=off in zpool history:
Code:
2015-09-09.09:36:17 zfs set atime=off rpool/export/home

but no update for access time.
I'd like to set atime=off for zfs on application servers, but would like a before and after image to access the change.
This behaviour is replicated on both solaris 10 and 11 x86.
# 2  
Old 09-09-2015
If you set atime=off, you are telling ZFS not to update access times on that filesystem. If you want to record access time updates, set atime=on.
# 3  
Old 09-09-2015
By using stat command, you can see that information.

Code:
# stat somefile.txt
  File: `somefile.txt'
  Size: 9               Blocks: 2          IO Block: 512    regular file
Device: 475001dh/74776605d      Inode: 1161        Links: 1
Access: (0664/-rw-rw-r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2015-09-09 13:14:00.384836768 +0200
Modify: 2015-09-09 13:14:00.385346153 +0200
Change: 2015-09-09 13:14:00.385994348 +0200

If you change atime to off, the Access part will not be update when you access the file and you will gain minor to none performance depending on the filesystem structure.

Hope that helps
Regards
Peasant.
# 4  
Old 09-09-2015
Alternatively, you can use the portable POSIX way to display the file access time:

Code:
ls -lu somefile.txt

Note that with certain workloads, disabling atime might have more than a "minor to none" performance gain. It can dramatically reduce the number of I/Os (possibly down to zero) if your applications are constantly reading a large set of small files.
# 5  
Old 09-10-2015
vielen Dank

Don,Peasant,jlliagre,

Thank-you for your replies; my post was to determine how I could see the effect of setting atime=off for zfs. Unfortunately I cannot install the gnu utils for solaris to get stat available, due to rigid change control. I have not come across ls -lu before; I have tried repeatedly catting the file atimetest.txt today, but that does not show any change in the ls -lu output.
I am happy to accept that the default setting for atime (=on) updates the inode data, which is something I cannot see easily, in my current setup.

J
# 6  
Old 09-10-2015
Quote:
Originally Posted by jabberwocky
Unfortunately I cannot install the gnu utils for solaris to get stat available, due to rigid change control.
Most GNU utils are already there but GNU stat is unfortunately not part of them. Solaris ls has been extended to support some GNU options though, and they provide the information required.
Quote:
I have not come across ls -lu before; I have tried repeatedly catting the file atimetest.txt today, but that does not show any change in the ls -lu output.
I am happy to accept that the default setting for atime (=on) updates the inode data, which is something I cannot see easily, in my current setup.
Here is a test showing the access time changing on Solaris 11.2:

Code:
$ ls -l foo
-rw-r-----   1 jlliagre staff          5 Mar 20 01:20 foo
$ ls -l --full-time foo
-rw-r-----   1 jlliagre staff          5 2015-03-20 01:20:15.576863674 +0100 foo
$ ls -lu --full-time foo
-rw-r-----   1 jlliagre staff          5 2015-04-25 08:52:32.741753870 +0200 foo
$ cat foo > /dev/null
$ ls -lu --full-time foo
-rw-r-----   1 jlliagre staff          5 2015-09-10 14:59:57.582793533 +0200 foo

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

How to update zfs-based flar?

Hello! I have ZFS-based flash archive (flar file). I need to install to it several additional packages and patches. As I know, it is possible for USF-based flar, but how to do it with ZFS-based one? (0 Replies)
Discussion started by: sluge
0 Replies

2. UNIX for Dummies Questions & Answers

Having a hell of atime with KSH -ftp automation

Following this thread: https://www.unix.com/ip-networking/1935-automated-ftp-task.html I have created the following script: #! /bin/ksh HOST=ftp.mywebsite2.com USER=astrocloud PASSWD=8**** exec 4>&1 ftp -nv >&4 2>&4 |& print -p open $HOST print -p user $USER $PASSWD print -p cd... (3 Replies)
Discussion started by: Astrocloud
3 Replies

3. UNIX for Advanced & Expert Users

Why updating atime doesn't update ctime?

Hi, ctime is the inode change time. If reading a file, its atime will be updated, which should cause inode member i_atime changed, which is an inode change. So ctime should also be updated. But if I try to ls a directory on redhat, only the directory atime gets updated, not ctime. Why? THANKS! (2 Replies)
Discussion started by: password636
2 Replies

4. UNIX for Dummies Questions & Answers

-atime not working as expected

I need to sort through a volume that contains video files by access time and delete files that have not been accessed over x days. I have to use the access time as video files are originals that do not get modified, just read Testing commands on a local test folder... $ date Wed Sep 28... (10 Replies)
Discussion started by: canon273
10 Replies

5. UNIX for Advanced & Expert Users

mtime VS atime VS ctime

hi, in trying to maintain your directories, one needs to do some housekeeping like removing old files. the tool "find" comes in handy. but how would you decide which option to use when it comes to, say, deleting files that are older than 5 days? mtime - last modified atime - last accessed... (4 Replies)
Discussion started by: pinoy43v3r
4 Replies

6. Shell Programming and Scripting

how to find ot ctime , mtime ,atime

Can any one tell me how to find out ctime , mtime ,atime for a file/directory on unix. Cheers, Nilesh (5 Replies)
Discussion started by: nilesrex
5 Replies

7. Tips and Tutorials

mtime, ctime, and atime

Unix keeps 3 timestamps for each file: mtime, ctime, and atime. Most people seem to understand atime (access time), it is when the file was last read. There does seem to be some confusion between mtime and ctime though. ctime is the inode change time while mtime is the file modification time. ... (2 Replies)
Discussion started by: Perderabo
2 Replies

8. Programming

read() without changing atime ?

Hey, First of all I want to know How do I see the atime of a file ?? Whats the command ?? I think ls -l shows the last modified time right ? Because when I use cat to read a file, the timestamp shown by ls -l does not change. Its not ls -lu ! man ls did not help ! How do I see the last... (8 Replies)
Discussion started by: tantric
8 Replies

9. UNIX for Dummies Questions & Answers

atime, ctime, mtime somewhere along csize..

i have used all forms of the unix find command.. and right now this is the only command i can think of that might have this option..: if i use mtime i am looking at a time interval.. but if i wanted to find out intervals of access, change and modification according to when a file changed size... (4 Replies)
Discussion started by: moxxx68
4 Replies
Login or Register to Ask a Question