private void initBlocks(String dir, int initNumberOfBlocks) throws IOException {
        for (int i = 0; i < initNumberOfBlocks; i++) {
            freeBlocks.offer(createBlock(i));
            blockCount.incrementAndGet();
        }

        activeBlock = freeBlocks.poll();
        if (activeBlock == null) {
            activeBlock = new DefaultStorageBlock(dir, blockCount.incrementAndGet(), capacityPerBlock, storageMode);
        }
    }