Wednesday, February 26, 2014

OS X Floppy Disk Access

floppyoutline

In OS X, it used to be possible for users to get raw access to removable disks, including floppy disks.

In recent versions of the OS, Apple changed the permissions and only root can now access floppy disks at the low level necessary to be able to read non-Mac and non-PC disks.

This change may have closed a potential security hole, but it also means that emulators are no longer able to access floppy disks without the root user authorizing the access at some point.

On OS X Mavericks, for example, Q-emuLator by default will not be able to gain access to QL floppy disks. The easiest solution is for root to grant access to the floppy disk to everyone.

In OS X all disks are visible (“mounted”) as subdirectories of the /dev directory, so to enable Q-emuLator to access a floppy disk you may use the following procedure:

  1. Open a terminal window.
  2. To go to the disk mount directory, type: cd /dev
  3. The raw devices for all disks are visible here as rdisk followed by a number. As for security purposes you don’t want to grant raw access to one of your hard disks by mistake, first take a look at what disks are available on your system by typing: ls rdisk*
  4. Now insert a QL floppy disk. The Finder will complain that it cannot read it and offer to initialize or eject the disk. Click the Ignore button instead to tell the Finder to mind his own business and leave the disk in the drive.
  5. Now take a look at the available disks again: ls rdisk*
    You should notice an additional disk listed (compared to the first time you run the same command). Take a mental note of the disk number for the floppy disk. For example, in my case the floppy appeared as rdisk2.
  6. Grant read/write access to the disk to everyone by typing the following command and entering the password (of course, replace the <n> at the end with the number that you noted at the previous step):  sudo chmod a+rw rdisk<n>

Now Q-emuLator will be able to access the QL floppy disk (as it did by default on previous versions of OS X).

If you insert another disk in the floppy drive, OS X will likely assign to it a different device name, so keep the terminal window open and repeat steps 4-6 for the new disk.

To avoid having to repeat this procedure often, it may be a good idea to use the emulator to copy the contents of your QL disks to folders on your hard disk (I use a different folder for each disk) and from now on use the folders instead of the floppy disks. Your software will load from the folders exactly as if it was still on the floppy disk (you can even continue to use the FLP device name), only much faster.