Way to mount a disk directly to a specific folder

disk-volumemount

Using Mac OS X 10.4

I made a script a while ago for my linux box in order to take archived data off of 300 floppies that automated the process. I would make an image of the floppy and copy the files directly off of the floppy. I managed to install xcode on the machine (in order to install ddrescue)

The thing is on a linux box I mounted each floppy to /media/floppy and unmounted it to ddrescue it and copied it directly to a usb drive.

I'm trying to port my script to the mac, and it seems that it's default behavior is to automatically mount each zip floppy to the /Volumes folder, which is fine, except it uses the volume's name as it's mount point folder name. So if a floppy's volume name is, "Jimmy Bo Bobs" it will mount to /media/Jimmy /Bo /Bobs.

So my question is I need to get the volume name either consistent to one name, or adaptable to the volume's name.

So my initial question is can I some how mount a drive to a specific folder, Like I would normally do in linux?

 #Linux
 mount /dev/sd1 /media/floppy
 #Mac
 diskutil mount /dev/disk1s1 /media/floppy #Doesn't work

If it's not possible, is there an easy way to extract the volume's name so that I can then link the script like this.

 Volumename=Jimmy Bo Bobs
 do stuff to /Volume/$Volumename

I'm guessing if it's not possible I'll have to grep the mount command to the /dev/ pointer and then somehow parse that string which is what I want to avoid since it would require even more research.

Best Answer

"So my initial question is can I some how mount a drive to a specific folder, Like I would normally do in linux?"

Absolutely. The caveat is that the user who is mounting the volume must be the mount-point owner. You do NOT need to be root or use sudo to mount a disk.

The first thing is to identify your raw device. diskutil list will do that nicely.

For example, if I have a FAT32 USB stick that I want to mount in my home dir, I list my devices and see that my raw device is /dev/disk5s1. As a normal user, I can mount it in my home directory by:

mkdir ~/mount
mount -r -t msdos /dev/disk5s1 ~/mount

If you then cd ~/mount ; ls, you'll see the contents of the USB stick.

In this example, I mounted it read-only, but you can mount your device any way you like.

When you're done with the device, don't forget to unmount it, e.g.:

diskutil unmount ~/mount