There are many boards that work with CircuitPython. You may find yourself in a situation where you're working with more than one board at the same time. What happens when you have multiple boards plugged into your computer? You have multiple CIRCUITPY drives! How do you know which one is which? You can rename each CIRCUITPY drive to avoid confusion.

When you rename CIRCUITPY, it writes the name to the filesystem. This means that the name change will persist through disconnecting the board, as well as reloading CircuitPython!

The name must be 11 characters or less! This is a limitation of the filesystem. You will receive an error if you choose a name longer than 11 characters.

Renaming CIRCUITPY on Mac

Renaming your CIRCUITPY drive on Mac is simple. Click on the drive in Finder so you can see the contents. Then, right click on the drive in Finder and choose "Rename".

Once you click "Rename", in the right-click menu, the drive name will show up in a text box where you can rename the drive. Type in the new name.

Renaming CIRCUITPY on Windows

Renaming the CIRCUITPY drive on Windows is easy. Open File Explorer and find the CIRCUITPY drive. Right click on it, and click "Rename".

You can also rename the drive through the "Properties" menu, which can be opened several different ways through the Windows File Explorer, including right clicking on the CIRCUITPY drive and choosing "Properties".

Once you click "Rename" in the right-click menu, the drive name will show up in a text box where you can rename the drive. Type in the new name.

Renaming CIRCUITPY on Linux

Renaming CIRCUITPY on Linux requires a couple of steps. You'll need to identify the mount point, and then run a command to rename the drive.

Open a terminal program. Run the following to find out where your board is mounted:

df | grep CIRCUITPY

You will see CIRCUITPY on the right end of the resulting line. The dev/foo (where foo is the name of the mount point) on the left end of that line is the mount point.

Next you can run the following to unmount the board, replacing foo with your specific mount point.

sudo umount /dev/foo

To rename the board, run the following:

sudo fatlabel /dev/foo NEW_NAME

Then, eject your board, unplug it, and plug it back in to force it to remount with the new name.

To check to see if it worked, look for the drive in your file manager. Or, you can run the following:

df | grep NEW_NAME
The name must be 11 characters or less! This is a limitation of the filesystem. You will receive an error if you choose a name longer than 11 characters.

Renaming CIRCUITPY through CircuitPython

You can also rename the board using CircuitPython. Create a new file on your CIRCUITPY drive called boot.py. Copy the following code into the new boot.py file:

import storage

storage.remount("/", readonly=False)

m = storage.getmount("/")
m.label = "NEW_NAME"

storage.remount("/", readonly=True)

storage.enable_usb_drive()

Eject your board, and reboot the board either by pressing the reset button once, or unplugging it and plugging it back in. After a moment, it should show up in your file explorer with the NEW_NAME you chose for it! You can delete boot.py after the newly named board shows up in your file explorer.

Reverting to CIRCUITPY

You can follow the same processes above to rename the drive back to CIRCUITPY.

You will also revert to CIRCUITPY by erasing the filesystem. If you are in a situation where you need to erase the filesystem on your CircuitPython board, the drive name will revert to CIRCUITPY on completion.

This guide was first published on Dec 19, 2017. It was last updated on 2021-12-01 16:32:33 -0500.

This page (Renaming CIRCUITPY) was last updated on Dec 09, 2021.

Text editor powered by tinymce.