MacOS – How to write-protect (make read-only) a USB drive in OS X

external-diskmacos

I have a USB drive with some archive data on it that I'd like to access from a Mac running Snow Leopard. However, I want to ensure that the data on the drive is preserved and no modifications are made to the drive. The drive is FAT32 formatted and does not have a write-protect switch on it. How can I make the drive read-only or otherwise write-protect it by the OS so that I can ensure nothing is modified on the drive?

Best Answer

Option 1: Mount drive read-only

You can mount the USB drive read-only by using Diskutil.

  • First, insert/mount the drive once, run diskutil list from Terminal.app and take note of the device representing the drive (should be something like /dev/diskN with N being any number).
  • Eject the disk by running diskutil unmountDisk /dev/diskN replacing N by the number noted in the first step
  • Mount the disk read-only by running diskutil mountDisk readOnly /dev/diskN

This of course requires that you actively run these commands every time you want to use the archive stick. For an automated solution, have a look at MarcoPolo or write a launchd command (see e.g. here for inspiration).

Option 2: Use access control on the drive

Does the drive really need to be formatted in FAT32 or do you only access it from a Mac OSX system anyway? In the later case, you can save the drive content on another drive, reformat it as a Mac OSX drive, move/copy the content back and take away any write rights from anybody.