Solved it! You need to remount the file system before running the code. Marking thread as solved