Working with Multiple Volumes in OS X

From the standpoint of the user, a volume is any disk, drive, partition, image, or server that appears on your computer as a location for data storage. For example, if you open a new Finder window at the Computer level, you'll see the available volumes—maybe just your hard drive, if you only have a single drive with a single partition, and no removable media or servers mounted. In fact, in many cases, a volume is the same thing as a hard drive, a CD, or a disk image.

However, from a technical standpoint—that is, the way OS X sees things—a volume is any separately identifiable unit of data storage. For example, a hard drive that has been divided into two or more partitions is seen by OS X as multiple units of storage. OS X then mounts those units as separate volumes. If you type sudo autodiskmount -v <RETURN> in Terminal, you'll see a list of currently mounted volumes. As an example, below are the results of this command on my computer:

   /Users/frakes % sudo autodiskmount -v   Password:   DiskDev  FileSys Fixed Write Volume Name     Mounted On   disk0s9  hfs     yes   yes   SystemX         /   disk0s10 hfs     yes   yes   System9         /Volumes/System9   disk0s11 hfs     yes   yes   Scratch         /Volumes/Scratch   disk1s9  hfs     yes   yes   SystemXBackup   /Volumes/SystemXBackup   disk1s10 hfs     yes   yes   iTunes          /Volumes/iTunes   disk3s9  hfs     yes   yes   Backup          /Volumes/Backup   disk5    hfs     no    yes   Test Image      /Volumes/Test Image 

The first column lists the device ID, which is a way for OS X to keep track of which disk is which. disk0 is the first internal hard drive, disk1 is a second internal hard drive, disk3 is a FireWire drive, and disk5 is a mounted disk image. In addition, some disks have multiple volumes. For example, disk0, the boot drive, has been partitioned into three volumes: SystemX, System9, and Scratch. The second internal hard drive, disk1, is also partitioned into two volumes, SystemXBackup and iTunes. The display also tells you how each volume is formatted, whether it's fixed or removable, whether it's writable, the name of the volume, and, finally, where the drive has been mounted in terms of OS X's filesystem. (I'll talk about this location in the next section.)

(In case you're wondering, SystemX is my regular OS X volume. System9 is a volume I use when I need to boot into OS 9. Scratch is a volume I use for downloads, browser caches, and temporary files in order to reduce fragmentation on my main OS X volume. SystemXBackup keeps a daily mirror of my main SystemX drive, and, the iTunes volume holds MP3s of my CD collection; we share this volume over our home network so that any of our computers can play the music.)

Although my drive setup is a bit more complex than most, as I mentioned earlier, you don't have to be a high-end user to work with multiple volumes. Any time you insert a CD, DVD, floppy, or magneto-optical disk; connect to a file server; mount your iDisk; or even mount a disk image, you're mounting a new volume, and you need to be aware of how working with files on multiple volumes differs from working with files on a single volume.

Accessing Non-Boot Volumes

Before I get into some of the issues that come with using multiple volumes, here's how you actually access files and folders that reside on non-boot volumes from the Finder, in Open/Save dialogs, and from within Terminal.

  • In the Finder If you've checked the boxes next to "Hard disks," "Removable media (such as CDs)," and "Connected servers" in Finder preferences, any mounted volume will show up on your Desktop. However, if you've unchecked any of these boxes, another way is to open a new Finder window and click the Computer item in the toolbar (or choose Go Computer, or press shift+command+C). This will present all mounted volumes, along with the Network icon, in a single Finder window. You can then access any volume as you would your boot volume or a folder.

  • In Open/Save dialogs From within Open/Save dialogs, you can access any volume via the file browser (which is probably showing by this point in the book, but, if not, is accessible by clicking the downward-pointing triangle). Click the horizontal scrollbar at the bottom of the file browser, and drag it all the way to the left. You'll see a list of all mounted volumes, which you can then browse.

  • From within Terminal Accessing volumes via the Finder and Open/Save dialogs is fairly intuitive, since volumes are generally hard drives, CDs, servers, etc., so it follows that you would access them at the top level of the Finder and file browsers. However, accessing non-boot volumes in Terminal is a bit different. If you flip back to the example I provided using the autodiskmount command, and look at the Mounted On column of the Terminal output, you'll see why. The boot volume is always located at /, whereas non-boot volumes are located in /Volumes. So to access a non-boot volume in Terminal, you need to use the path /Volumes/volumename. For example, using the volumes in that example, if I wanted to save the output of the manual page for the mv command to a file named mv.txt on the disk named Scratch, I'd type man mv > /Volumes/Scratch/mv.txt <RETURN>, where /Volumes/Scratch is the destination for the new file. (Don't worry if you don't understand this command right now; you can read Chapter 15 for some help.)

Tip 

You can also access non-boot volumes using any of the tips I showed you in Chapter 5, the Online Bonus Chapter, and Chapter 6.

Copying versus Moving with Multiple Volumes

User Level:

any

Affects:

individual user

Terminal:

no

To many users this will be old hat, but users whom I consider to be quite competent have asked me about this, so it's definitely not obvious. When you drag an item (file, folder, application, etc.) from one place to another on the same volume, it will be moved (provided you haven't held down any modifier keys as explained in Chapter 5). However, when you drag an item from one volume to another volume, it will be copied. In other words, it will still exist on the first volume, but a copy of it will be made on the second.

If you want to move an item from one volume to another, hold down the command key as you drag it between volumes. This will copy the file to the new volume and delete it from the original volume simultaneously.

Warning 

Unfortunately, the move command (command+drag) isn't 100% safe at the time of this writing. If you attempt to move an item and for some reason the copy cannot complete (because of a disk error, or because there's not enough room on the destination volume), the copy will fail, but the original will still be deleted, leaving you with a missing file! So be careful about using this feature until Apple fixes this bug.

Permissions on Non-Boot Volumes

I mentioned this earlier in the book, but it's worth mentioning here. The default permissions for non-boot volumes are Read & Write for Owner, Group, and Others. In other words, everyone has full access. This means that non-boot volumes are, by default, just like the Shared user folder.

On the other hand, items copied to a non-boot volume retain their original permissions, and you can always change the permissions on a particular document or folder to restrict access. In addition, an administrative user can also change the permissions for an entire volume. Here are a couple ways to do so.

Creating a "Private" Volume

User Level:

admin

Affects:

computer

Terminal:

no

Consider the example I used in Chapter 1 where parents could create a group called "Parents," and then set the permissions for those items they wanted to keep private from their children to Group: Parents, Read & Write and Others: No Access. You can use a similar procedure to make an entire volume—a second hard drive, a CD-RW or DVD-R, or even a mounted disk image—private.

  1. Select the mounted volume in the Finder (from the Desktop or a Finder window showing the Computer view).

  2. Choose File Get Info (or press command+I).

  3. Click the triangle next to Ownership & Permissions to expand the panel.

  4. For the Group setting, choose the appropriate group name, and give it Read & Write access.

  5. For the Others setting, choose No Access.

  6. Make sure "Ignore ownership on this volume" is not checked.

  7. To ensure that any items already on the volume are also inaccessible to those not in your group, click the "Apply to enclosed items" button.

Users not in your group will not even be able to view the top-level contents of the volume, but those in the group will have full access.

Tip 

If you want a personal private volume—one that no user but you can access—follow the instructions above but set the Group name to "nogroup" or "nobody." These groups have no users in them, so no one but you will have access to files on the volume. (You can also set Group Access to No Access, but this technically doesn't offer you any extra protection.)

Creating a "Universal Access" Volume

User Level:

admin

Affects:

computer

Terminal:

no

At the opposite end of the security spectrum from a private volume, you can set up a volume where all users can access and modify all files. I call this a "universal access" volume, but some people call it a "shared" volume. (I don't like calling it a shared volume because OS X already has a Shared user folder, and that folder has different permissions.) These types of volumes are often used to share files and folders that multiple users need to edit.

To do this, simply follow Steps 1–3 above, but instead of setting any groups or permissions, check the box next to "Ignore ownership on this volume." This tells OS X to disregard ownership and permissions for any and all files on the volume.

"Ignore ownership on this volume" does just that—it allows unfettered access to any file on the volume by any user. (Technically, it's not even doing that; permissions and ownership simply do not apply.) So make sure you only use the volume for files that you are sure you want anyone to be able to modify. Just to be safe, you may want to make backup copies of files before moving them to the universal access volume.

Permissions on Removable Volumes

For the most part, permissions on removable volumes (FireWire hard drives, floppy disks, magneto-optical drives) work as described in the previous section ("Permissions on Non-Boot Volumes"), provided you use that volume on the computer that formatted it and/or first applied file ownership and permissions to it. However, any other Mac will always treat the volume as if the "Ignore ownership on this volume" box is checked in the volume's Ownership & Permissions info panel.

The reason for this is that Unix—and thus OS X—keeps track of users and groups via user IDs and group IDs; since every OS X computer uses the same ID system, there's no way for OS X to know if user ID 500 on one computer is the same person as user ID 500 on another. Thus, whenever you mount a removable volume on a computer other than the one used to format it, the "Ignore ownership on this volume" box will automatically be set.

Sharing a Non-Boot Volume

User Level:

admin

Affects:

computer

Terminal:

no

As I discussed in Chapter 10, by default OS X only shares user directories (to the respective user) and user Public folders (to all users). However, you can manually create additional shares using tools like SharePoints. You can use the same technique I described in Chapter 10 to share entire non-boot volumes (or just directories on a non-boot volume).

For example, as mentioned earlier in this appendix, my desktop Mac has an extra hard drive that holds all of the MP3s we've ripped from our CD collection—about 40GB worth. Rather than copy all 40GB of files to our iBook's hard drive, I've set up the iTunes music volume as a Personal File Sharing share, and then configured the iBook so that all accounts mount the iTunes music volume at login. Anyone using iTunes on the iBook can listen to all 40GB of music even though it's located on the desktop Mac.

Tip 

You can also combine this tip with the previous two to create private shares or universal shares that are accessible remotely.

Changing the Startup Volume

If you have OS X installed on multiple volumes, or if you have a mix of OS 9 and OS X installations on multiple volumes, you'll need to switch startup disks when you want to boot from another disk. I mention this topic here because it's a logical place for it, but I'm going to refer you to Chapter 3, where I've already covered it under "Choosing a Startup Volume or System."

Installing OS X on FireWire Volumes

User Level:

admin

Affects:

computer

Terminal:

no

You can install OS X on additional volumes using the OS X installer, or by copying an existing OS X installation using Carbon Copy Cloner, as I covered in Chapter 4. However, if you install or copy OS X to an external FireWire drive, you may initially have difficulty booting off of that drive. A possible solution is to make sure the FireWire drive is mounted and then type the following command in Terminal: sudo bless -folder /Volumes/volumename/System/Library/CoreServices <RETURN>, where volumename is the name of the FireWire drive. This command blesses the volume, which means it forces OS X to see it as a legitimate startup volume. You should then be able to select it as a startup volume.




Mac OS X Power Tools
Mac OS X Power Tools
ISBN: 0782141927
EAN: 2147483647
Year: 2005
Pages: 152
Authors: Dan Frakes

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net