Change name of CIRCUITPY Drive

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
puttley
 
Posts: 14
Joined: Wed Sep 21, 2022 10:42 am

Change name of CIRCUITPY Drive

Post by puttley »

Hello - I understand how to change the USB drive name using the storage and remount in boot.py.
However, I'd like to change it in the CP source and recompile? If possible, in which CP source file would I need to change?

Thank you -

User avatar
neradoc
 
Posts: 542
Joined: Wed Apr 27, 2016 2:38 pm

Re: Change name of CIRCUITPY Drive

Post by neradoc »

You can define CIRCUITPY_DRIVE_LABEL in a board's mpconfigboard.h, see for example:
https://github.com/adafruit/circuitpyth ... oard.h#L16
It will only change when the drive if formatted from Circuitpython (on first install from a unformatted flash or using storage.erase_filesystem()).
Note that you can also change the name from the host computer side.

User avatar
puttley
 
Posts: 14
Joined: Wed Sep 21, 2022 10:42 am

Re: Change name of CIRCUITPY Drive

Post by puttley »

Perfect -- thanks so much.

User avatar
tannewt
 
Posts: 3304
Joined: Thu Oct 06, 2016 8:48 pm

Re: Change name of CIRCUITPY Drive

Post by tannewt »

The name is the file system label and you can set it at runtime. CircuitPython only sets it when creating the filesystem. I've done it from boot.py with:

Code: Select all

import storage
storage.remount("/", readonly=False)
storage.getmount("/").label = "FEATHER"
storage.remount("/", readonly=True)


User avatar
blakebr
 
Posts: 956
Joined: Tue Apr 17, 2012 6:23 pm

Re: Change name of CIRCUITPY Drive

Post by blakebr »

!

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”