Python – writing to a file on a fileystem to test I/O

Posted on Updated on

This is very useful Python script that will allow you to test writing to a file on a filesytem. This can be used to verify that their are no I/O read or write failures during an extend or migration of a filesystem.

#!/usr/bin/python

import time
testfile = "/dbbackup-01/testfile.txt"

for i in range(100):
    print i
    fo = open(testfile, "a")
    fo.write('test write while the filesystem is being modified\n')
    print fo.name
    fo.close()
    time.sleep(0.2)
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s