2

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?

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

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

6

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
1

Install homebrew and then:

$ brew install mtools

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

-4

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 .