[CRIU] post-dump / pre-restore scripts

Andrei Vagin avagin at gmail.com
Sat Oct 12 22:40:05 MSK 2019


On Fri, Oct 11, 2019 at 09:24:17AM -0400, Eliot Moss wrote:
> Dear CRIU-ers --
> 
> I am interested in periodically taking a snapshot of a collection of
> running processes that use pipes and FIFOs to communicate with each
> other, and that are creating large traces files as output.  My goal
> is to be able to restart after a system failure or shutdown.
> 
> From my reading of the documentation, I will need to record current
> position in the output trace files using a post-dump action script,
> and truncate the files back to those positions in a corresponding
> pre-restore script.

Hello Eliot,


I don't think that you need to use criu scripts for your problem.

You can get the current posion in the file from criu images. We have the
crit tool which allows to convert images into the json format.

$ ./crit/crit show files.img | grep -B 14 -A 4 file_append.test  
        {
            "type": "REG", 
            "id": 7, 
            "reg": {
                "id": 7, 
                "flags": "O_RDWR | O_APPEND | O_LARGEFILE", 
                "pos": 130, 
                "fown": {
                    "uid": 0, 
                    "euid": 0, 
                    "signum": 0, 
                    "pid_type": 0, 
                    "pid": 0
                }, 
                "name":
"/root/git/main/criu/test/zdtm/static/file_append.test", 
                "size": 130, 
                "mode": 33188
            }
        },

So for your case, you can get a file size from files.img and truncate
the file before calling "criu restore".

> 
> It would be very helpful to see an example of such a script.  The
> documentation is (ahem) a bit minimal on how to accomplish this
> presumably straightforward intent.  Can someone help me out on this?
> 
> Regards - Eliot Moss
> Professor, Information and Computer Sciences
> Univ of Massachusetts Amherst
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list