Marc Pawlowsky
2017-Nov-23 04:06 UTC
[Libguestfs] RFE: ctime byte-for-byte reproducible qcow2 ext2/3/4 FS
Problem: Want to be able to produce a qcow2 file with multiple ext4 File Systems. Days later want to reproduce the production of the qcow2 and have the exact same byte-for-byte file, to prove my build is reproducible. Currently the ctime attributes of the inodes will differ and thus the qcow2 files will differ. Since the file times are subsecond the trick of setting the system time and chmoding the files will not work. In https://stackoverflow.com/questions/47440618/changing-qcow2-st-ctime I mention how debugfs can be used to change the ctimes. Two possible usages come to mind: 1. A global flag that would indicate the ctime that should be used for all file operations, e.g. a fake system clock. 2. A new command to specifically change the ctime, like debugfs's set_inode_field. Thanks Marc
Richard W.M. Jones
2017-Nov-23 09:00 UTC
Re: [Libguestfs] RFE: ctime byte-for-byte reproducible qcow2 ext2/3/4 FS
On Wed, Nov 22, 2017 at 11:06:36PM -0500, Marc Pawlowsky wrote:> Problem: Want to be able to produce a qcow2 file with multiple ext4 > File Systems. > Days later want to reproduce the production of the qcow2 and have the > exact same byte-for-byte file, to prove my build is reproducible. > Currently the ctime attributes of the inodes will differ and thus the > qcow2 files will differ. Since the file times are subsecond the trick > of setting the system time and chmoding the files will not work. > > In > https://stackoverflow.com/questions/47440618/changing-qcow2-st-ctime > I mention how debugfs can be used to change the ctimes. > > Two possible usages come to mind: > > 1. A global flag that would indicate the ctime that should be used > for all file operations, e.g. a fake system clock. > 2. A new command to specifically change the ctime, like debugfs's > set_inode_field.I suspect #2 is better. Changing the system time in the appliance would have unintended consequences -- for instance commands like ‘yum install’ would fail and the wrong dates would be written into the superblocks on shutdown. It should be fairly trivial to add the new API. Suggest looking at these two documents: http://libguestfs.org/guestfs-building.1.html http://libguestfs.org/guestfs-hacking.1.html#extending-libguestfs Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/