Sparse image
Encyclopedia
A sparse image is a type of disk image
Disk image
A disk image is a single file or storage device containing the complete contents and structure representing a data storage medium or device, such as a hard drive, tape drive, floppy disk, CD/DVD/BD, or USB flash drive, although an image of an optical disc may be referred to as an optical disc image...

 file that can be created under Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

 using Disk Utility
Disk Utility
Disk Utility is the name of a utility created by Apple for performing disk-related tasks in Mac OS X. These tasks include:*the creation, conversion, compression and encryption of disk images from a wide range of formats read by Disk Utility to .dmg or—for CD/DVD images—.cdr, which is identical to...

. Encrypted sparse image files are used to secure a user's home directory by the FileVault
FileVault
FileVault is a system which encrypts files on a Macintosh computer. It can be found in the Mac OS X v10.4 "Tiger" operating system and later....

 feature in Mac OS X Snow Leopard and earlier.

Unlike a full image file (.dmg), which takes up as much actual space as the real disk it represents (regardless of the amount of unused space), a sparse image file (.sparseimage) takes up only as much actual disk space as the data contained within.

This can be advantageous when backing up data. For example, assume a user would like to make a backup of a hard disk volume named "INFO" that is 5GB in size, yet only contains 2.5GB of actual data. While a single layer DVD-R (with around 4.7GB capacity) would be too small to store a full-sized "INFO.dmg" image file, an "INFO.sparseimage" image file will fit. This is because the unused 2.5GB from the original volume is not actually allocated within the sparse image file. The "INFO.sparseimage" file will occupy only 2.5GB.

Note that if the 2.5GB "INFO.sparseimage" backup on the DVD is subsequently opened and mounted as a "clone" of the source volume, the Finder will report the clone as having the original 5GB capacity, with 2.5GB available, but the virtual disk will be "read-only", because the source image file resides on read-only media. However, the first-generation 2.5GB "INFO.sparseimage" on a hard drive, when mounted, may have files added to it until the originally designated 5GB capacity is reached. The ".sparseimage" file will expand in size to accommodate the additional data. Deleting files from the mounted virtual volume will not result in a reduction in the size of the corresponding ".sparseimage" file. However, the size of the image can be reduced when the volume is not mounted.

Two limitations are therefore worth noting regarding the use of this image file format:
  1. A customized ".sparseimage" image file can be assigned a larger total capacity than the physical volume (or HD partition) on which it originally resides. While the virtual volume will seem to make that capacity available, attempting to exceed the physical capacity of the underlying volume will result in a disk error: "ran out of space". The ".sparseimage" file must first be moved to a larger physical disk or partition.
  2. As noted above, while mounted ".sparseimage" image files automatically expand to their preassigned limit if and when data is added, they cannot be arbitrarily resized without the use of Disk Utility
    Disk Utility
    Disk Utility is the name of a utility created by Apple for performing disk-related tasks in Mac OS X. These tasks include:*the creation, conversion, compression and encryption of disk images from a wide range of formats read by Disk Utility to .dmg or—for CD/DVD images—.cdr, which is identical to...

    , hdiutil, or other such software.


When the sparseimage file is not mounted, the .sparseimage file may be resized using Disk Utility’s Resize Image function. Sparseimages may also be resized from the Terminal. The following example resizes a .sparseimage so that it can expand to a maximum size of 50 gigabytes:

hdiutil resize -size 50g MyFile.sparseimage

Similarly, a .sparseimage file that has expanded in size but then had files deleted, can be "compacted" to a smaller size with the following command:

hdiutil compact MyFile.sparseimage

Additional information about the hdiutil command may be seen by typing the following in the Terminal:

man hdiutil

Sparse bundle

Mac OS X v10.5
Mac OS X v10.5
Mac OS X Leopard is the sixth major release of Mac OS X, Apple's desktop and server operating system for Macintosh computers. Leopard was released on 26 October 2007 as the successor of Tiger , and is available in two variants: a desktop version suitable for personal computers, and a...

 (Leopard) introduced the concept of the sparse bundle. Instead of a monolithic file, a sparse bundle is a bundle
Bundle (NEXTSTEP)
In NEXTSTEP, OPENSTEP, their lineal descendants Mac OS X, iOS, and in GNUstep, a bundle is a directory that allows related resources such as an application's executable and its graphics to be grouped together, appearing as a single file to the user....

 (directory) that stores the disk image as banded data files. When the content of the image changes, one or more band files is changed, created, or deleted. This allows backup software (such as Time Machine
Time Machine (Apple software)
Time Machine is a backup utility developed by Apple. It is included with Mac OS X and was introduced with the 10.5 "Leopard" release of Mac OS X. The software is designed to work with the Time Capsule as well as other internal or external drives.-Overview:...

) to operate more efficiently. You may use a tool such as rsync
Rsync
rsync is a software application and network protocol for Unix-like and Windows systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate. An important feature of rsync not found in most similar...

to keep your disk image(s) consistent across various systems
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK