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?


See diskutil

sudo diskutil rename USB\ DISK MYDISK 
  • 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.


install it and every thing done :D https://github.com/rueckstiess/mtools/wiki/mtools-Installation-on-Ubuntu-12.04

  • 2
    How does this help on OSX?
    – nohillside
    Aug 15 '15 at 6:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .