How to simulate a twisted task in Linux?

I just changed the following configurations in /etc/sysctl.conf:

# Reboot 5 seconds after panic
kernel.panic = 5

# Panic if a hung task was found
kernel.hung_task_panic = 1

# Setup timeout for hung task to 300 seconds
kernel.hung_task_timeout_secs = 300

      

I want to check if kernel.hung_task_panic = 1

and kernel.hung_task_timeout_sec = 300

. How to simulate a hanging task in linux to test two configurations. I am using Ubuntu 16.04 server

+3


source to share


1 answer


You can freeze the filesystem and then start recording, for example:

# fsfreeze --freeze /path/to/mountpoint
# echo crap > /path/to/mountpoint/file

      



since you intend to cause a crash, I highly recommend that you write some MB files to the tmpfs mount point, losetup (get / dev / loop0 or so), mkfs and finally mount that.

+4


source







All Articles