Can I "Speed Up" a VM to emulate the passage of time?

9

I'd like to put a VM into "fast forward" so that I can see several days (or weeks, or months) worth of logs and temp files build up and analyse them.

Is that possible with virtualbox & ubuntu 12.04 VM?

Dean Rather

Posted 2013-07-15T05:45:05.603

Reputation: 2 499

I doubt it's possible :-( – stommestack – 2013-07-15T09:48:18.597

1Just open the computer to the Internet and watch the logs fill and your hair grow whiter. – Paulo Almeida – 2013-07-15T10:30:21.277

Answers

2

Apparently it can be done by playing with the jiffies in the kernel, by adding a speedup ratio. There is a document with a presentation about a quick 10 year test. It boils down to this:

Add a parameter to Kconfig (SPEEDUP_RATIO, ~1-1000), modify do_timer():

 void do_timer(...) {
        jiffies_64 = jiffies_64 + speedup_ratio;
    }

Finally, control ratio via procfs (echo 100 > /proc/accel). Then he had lots of timeouts on boot and had to adjust all the timeouts in the kernel (timeout * speedup_ratio). He says most of these values can be found with grep jiffies, but the "most" means it may involve some trial and error.

Also, according to man 7 time: "The size of a jiffy is determined by the value of the kernel constant HZ". It is configurable, but only takes the values 100, 250, 300 and 1000.

EDIT: If time leaps are acceptable, libfaketime may be a much simpler alternative. But I don't know how logging software will deal with that.

Paulo Almeida

Posted 2013-07-15T05:45:05.603

Reputation: 694