Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am trying to write a program in Python that will rename a USB drive (from the standard "USB DISK" to my custom "MYDISK").

However, I can't find any way to do this neither in Python nor in OSX Terminal. (I figured, if I can make it work in Terminal, I can simply use os.system("command") in Python).

The USB drive is a FAT32 formatted flash drive on filesystem /dev/disk2s1, and it is by default mounted on /Volumes/USB DISK

What I have tried so far: (from http://techbu.com/2009/06/28/renaming-usb-drive-labels-in-linux)

sudo umount /Volumes/USB\ DISK            ## Works fine
sudo mlabel -i /dev/disk2s1 ::MYDISK      ## Command not found!

It seems that the "mlabel" command is not found in OSX Terminal. Is there an alternative?

share|improve this question

migrated from stackoverflow.com Jul 13 '12 at 11:56

This question came from our site for professional and enthusiast programmers.

superuser.com/questions/315220/… –  Gian Jul 13 '12 at 11:25

2 Answers 2

up vote 3 down vote accepted

See diskutil

sudo diskutil rename USB\ DISK MYDISK 
share|improve this answer
Great! I figured I shouldn't unmount it first. Thanks! –  user1227738 Jul 13 '12 at 11:27

Install homebrew and then:

$ brew install mtools

This gives you mlabel and various other GNU utilities for working with MS-DOS.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.