Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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 Jul 13 '12 at 11:56

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

4… – Gian Jul 13 '12 at 11:25
up vote 5 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

install it and every thing done :D

share|improve this answer
How does this help on OSX? – patrix Aug 15 '15 at 6:36

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.