Apple Pro Training Series: OS X Lion Support Essentials: Supporting and Troubleshooting OS X Lion: Data Management
- Understanding the System File Structure
- Managing Font Resources
- Managing Hidden Items
- Using Aliases and Links
- Understanding File System Metadata
- Managing Launch Services
- Using Spotlight and Quick Look
- Using File Archives and Disk Images
- Managing Time Machine
- What You've Learned
- Review Quiz
Using File Archives and Disk Images
Archiving and backup are both synonymous with copying data to another location for safekeeping, yet in the context of this chapter, they are different processes serving different purposes. In Lion, archiving is typically a manual process that involves creating compressed copies of selected data. Archive formats are efficient from a storage and data transfer perspective, but they generally require user interaction. On the other hand, the backup service introduced with Mac OS X v10.5, Time Machine, is an automated process that allows users to easily browse the backup history of their entire file system. As you can imagine, maintaining a history of your file system is not space efficient, but it is extremely useful.
Understanding Archive versus Disk Image
At its essence, archiving is the practice of saving copies of important information to another location or format better suited for long-term storage or network transfer. Large amounts of hard disk drive storage have become much less expensive in the last few years, but this type of storage is still not as reliable as tape or optical media in terms of longevity. This type of archival media has not kept up with the tremendous growth of hard drives, so storing archival data in a more efficient form by compressing it is still relevant. Also, no matter how robust your Internet connection is, there never seems to be enough bandwidth, so compressing items in preparation for data transfer is almost always a time-saver. Lion includes two archival technologies, archives and disk images, that allow you to combine multiple files and compress the data into a more efficient file suited for long-term storage or network data transfer.
First, the Mac’s Finder will allow you to create zip archives from a selection of files or folders. This is an efficient method for archiving relatively small amounts of data quickly. The zip archive format is also widely compatible, as many operating systems include software to decompress zip archives back to their original items. However, zip archives in Lion do not offer the flexibility provided by disk images.
Disk images, created using Disk Utility, are more widely used in Lion for archival purposes because they offer many features not available from zip archives. Primarily, disk images allow you to archive the contents of an entire file system into a single file that can be compressed, encrypted, or both. Disk images can also be created as read/write so you can easily make changes to them over time. The only downside to disk images created using Disk Utility is that, by default, only Macs can access the content—other systems require third-party software to access Mac disk image content.
Creating Zip Archives
Lion’s Finder allows you to quickly create a compressed zip archive from any number of selected items. By default, creating a zip archive in the Finder will not delete the original items you’ve selected to compress.
To create a zip archive in the Finder:
Select the items you wish to archive and compress in the Finder.
You can hold down the Shift key to quickly select contiguous lists of items, or hold down the Command key to quickly select noncontiguous items. It’s best to put all of the items in one folder and then compress that, as opposed to selecting multiple items.
Choose File > Compress “Items” from the menu bar.
The word “Items” in the menu will be replaced by the name of a single item you have selected or the number of items you have selected.
If the archival process is going to take more than a few seconds, the Finder will show a progress dialog with the estimated time required to complete the erase task. You can also choose to cancel the archive by clicking the small X button on the far right.
- When the archival process has completed, you will be left with a zip archive named either Archive.zip or Item.zip, where Item is the name of the single item you chose to archive and compress.
Once the archive process is complete, it’s always interesting to compare the original items’ size with the archive’s size using the Get Info or Inspector windows in the Finder. In many cases, you can expect at least a 50 percent decrease in file size. On the other hand, many media formats are already quite compressed in their original form, so you may not experience very good results when compressing these types of files.
Expanding Zip Archives
Expanding a zip archive in the Finder is as simple as double-clicking on the zip archive file. The Finder will decompress the entire archive file and place the resulting files and folders in the same folder as the original zip archive. The Finder cannot list or extract individual items from a zip archive. By default, the Finder will not delete the original zip archive.
Understanding Disk Images
Disk images are files that contain entire virtual drives and volumes. Lion relies on disk images for several core technologies, including software distribution, system imaging, NetBoot, Legacy FileVault, and network Time Machine backups. Disk images are also useful as a personal archive tool. Though Mac-created disk images work only on Mac computers by default, they are much more flexible to use than zip archives. Disk images provide advanced compression and encryption, but their greatest benefit is that they can be treated like a removable volume.
To access the contents of a disk image, you simply double-click on the disk image file in the Finder. This will mount the volume inside the disk image file as if you had just connected a normal storage device. Even if the disk image file is located on a remote file server, you can still mount it as if it were a local drive. You can treat the mounted disk image volume as you would any other storage device by navigating through its hierarchy and selecting files and folders as you need them. Further, if the disk image is read/write, you can add to the contents of the disk image by simply dragging items to the volume.
Using /Applications/Utilities/Disk Utility to make disk images allows you to create blank images, or images containing copies of selected folders or even entire file systems. Lion supports disk images up to 2 terabytes. Disk images also feature a number of configuration options, including:
- Image format—Disk images can be read-only or read/write. They can also be a set size or expandable as a sparse disk image. Sparse disk images will take up only as much space as necessary and automatically grow as you add items to them.
- Compression—Read-only disk images can be compressed to save space. With a compressed disk image, any free space becomes negligible in size, and most other files average a 50 percent reduction in size.
- Encryption—Any disk image can be protected with a password and encrypted with strong 128-bit or 256-bit AES encryption. Choosing a higher bit rate is more secure but degrades performance. This feature is useful for securing data stored on otherwise unsecure volumes like removable drives and network shares. The encryption always happens on the local computer, so even if the disk image file is physically stored externally, as on a network file share, the data is always encrypted as it travels across the connection.
- File system—Disk images can contain any partition scheme or volume format that Lion supports, including optical media formats. Details regarding the differences between file system options are covered in Chapter 3, “File Systems.”
Creating Empty Disk Images
To create an automatically resizing empty disk image that you can fill with content over time:
Open /Applications/Utilities/Disk Utility, and then choose File > New > Blank Disk Image from the menu bar. Or with nothing selected in the drives list, you can click the New Image button in the toolbar.
Enter a name for the disk image file, and then select a destination for the disk image file from the Where pop-up menu. Also enter a name for the volume inside the disk image.
The disk image file and volume names do not have to match but should be similar so that you can recognize their relationship.
Select a volume size from the Size pop-up menu, or select Custom to specify a disk image of arbitrary size.
Remember, this disk image will occupy only as much space as the files you copy inside it. Obviously if you’re going to save it on an external volume of limited size, that should define your maximum size.
- You can select a different volume format or partition scheme from the pop-up menus, but in most cases you will want to stick with the default Mac OS Extended (Journaled) and Apple Partition Map selections.
You can also select an encryption at this point from the pop-up menu. For most uses, 128-bit AES is secure enough and still provides good performance.
Choose “sparse disk image” from the Image Format pop-up menu to create an automatically resizable disk image.
- Click the Create button to create the disk image.
- If you have selected an encrypted disk image, you will be prompted to enter a password for the disk image. After you have selected a secure password, click the OK button to finish the disk image creation process.
After the system has created the new blank disk image, it will automatically mount it. From the Finder, you can open Get Info windows on both the disk image file and the disk image volume to verify that the volume size is much larger than the image size. As you copy files to the volume, the disk image file will grow accordingly.
Creating Disk Images from Items
To create a disk image that contains copies of selected items:
- Open /Applications/Utilities/Disk Utility.
At this point you can choose to create a new disk image from the contents of a folder or the contents of a volume.
To create a disk image from the contents of a folder, choose File > New > Disk Image from Folder from the menu bar, and then select the folder you wish to copy into a new disk image from the file browser window. Once you have made your selection, click the Image button to continue.
To create a disk image from the contents of an entire volume, use the same menu option, Disk Image from Folder, and then simply choose the volume. It may be tempting to choose Disk Image from (Select a Device), but this option will copy the empty space on the volume as well, making the resulting disk image artificially large. The only time you should create an image of a device is when creating images of optical media.
Enter a name for the disk image file, and then choose a destination for the disk image file from the Where pop-up menu.
Again, the disk image file and volume names do not have to match but should be similar so that you can recognize their relationship.
Choose an image format from the pop-up menu. Remember that compressed images are also read-only.
You can also choose an encryption at this point from the pop-up menu.
For most uses, 128-bit AES is secure enough and still provides good performance.
- Click the Save button to create the disk image.
If you have selected an encrypted disk image, you will be prompted to enter a password for the disk image. After you have selected a secure password, click the OK button to start the disk image creation process.
Depending on the amount of data that has to be copied and the image format you chose, it can take anywhere from minutes to hours for the disk image copy process to complete. Disk Utility will open a small progress dialog that will also allow you to cancel the disk image copy by clicking the Cancel button.