storage — storage management

The storage provides storage management functionality such as mounting and unmounting which is typically handled by the operating system hosting Python. CircuitPython does not have an OS, so this module provides this functionality directly.

storage.mount(filesystem, mount_path, *, readonly=False)

Mounts the given filesystem object at the given path.

This is the CircuitPython analog to the UNIX mount command.


Unmounts the given filesystem object or if mount is a path, then unmount the filesystem mounted at that location.

This is the CircuitPython analog to the UNIX umount command.

storage.remount(mount_path, readonly=False)

Remounts the given path with new parameters.


Retrieves the mount object associated with the mount path


Erase and re-create the CIRCUITPY filesystem.

On boards that present USB-visible CIRCUITPY drive (e.g., SAMD21 and SAMD51), then call microcontroller.reset() to restart CircuitPython and have the host computer remount CIRCUITPY.

This function can be called from the REPL when CIRCUITPY has become corrupted.


All the data on CIRCUITPY will be lost, and CircuitPython will restart on certain boards.

class storage.VfsFat(block_device)

Create a new VfsFat filesystem around the given block device.

Parameters:block_device – Block device the the filesystem lives on

The filesystem label, up to 11 case-insensitive bytes. Note that this property can only be set when the device is writable by the microcontroller.


Format the block device, deleting any data that may have been there

open(path, mode)

Like builtin open()


Return an iterator whose values describe files and folders within path


Like os.mkdir


Like os.rmdir


Like os.stat


Like os.statvfs

mount(readonly, mkfs)

Don’t call this directly, call storage.mount.


Don’t call this directly, call storage.umount.