mercredi 29 avril 2015

How can I set file creation times in ZFS?

I've just got a NAS running ZFS and I'd like to preserve creation times when transferring files into it. Both linux/ext4 (where the data is now) and zfs store creation time or birth time. In the case of zfs it's even reported by the stat command. But I haven't been able to figure out how I can set the creation time of a file so it mirrors the creation time in the original file system. Unlike an ext4->ext4 transfer where I can feed debugfs a script to set the file creation times.

Is there a tool similar to debugfs for ZFS?

PS. To explain better:

  • I have a USB drive attached to a Ubuntu 14.04 laptop. It holds a file system where I care about the creation date (birth date) of the individual files. I consult these creation timestamps often using a script based on debugfs, which reports it as crtime.

  • I want to move the data to a NAS box running ZFS, but the methods I know (such as scp -p -r, rsync, tar/untar) preserve the modification time but not the creation time.

  • If I were moving to another ext4 file system I would say debugfs -w, to read a script with lines of the form

    set_inode_field filename crtime <value>

prepared with the help of find and stat. I've tested this and it works just fine. But my target filesystem is not ext4 but ZFS

  • When I try debugfson the target machine running ZFS, I can't figure out what argument (device name) debugfs will understand. For instance the output of zfs list gives the name of the newly created file system as tank/levy2. But when I say debugfs tank/levy2 I get "tank/levy2: No such file or directory while opening filesystem".

  • Another debug tool that lets you alter timestamps by editing an inode directly is fsdb; it too runs on the NAS box, but again I can't seem to get it to recognize a ZFS file system: fsdb -d tank/levy2 gives

    fsdb: cannot set up file system `tank/levy2'

  • I'm told by the folks who sold me the NAS box that debugfs and fsdb are not meant for ZFS filesystems, but they haven't been able to come up with an equivalent. So, after much googling and trying out things I finally decided to post a question here today, hoping someone might have the answer. The question of how to replicate a dataset so the timestamps are identical seems quite natural from an archival point of view.

Aucun commentaire:

Enregistrer un commentaire