df | Display available space on mounted filesystems. |
diskutil | Perform operations on disks and partitions: mounting, formatting, renaming, and more. |
mount | Mount remote (or local) disks and partitions. |
fsck_hfs | Check a Macintosh HFS disk partition for errors. |
hdiutil | Work with disk images, such as ISO and DMG files. |
tmutil | Perform Time Machine operations. |
sync | Flush all disk caches to disk. |
rsync | Mirror a set of files onto another device or host. |
Macs can have multiple disks or disk partitions. In casual conversation, these are variously called disks, partitions, filesystems, volumes, even directories. We’ll try to be more accurate.
A disk is a hardware device, which may be divided into partitions that act as independent storage devices. You might think of disks and partitions as icons on the desktop or in the /Volumes folder, but in fact OS X represents them as special files in the directory /dev. For example, a typical Mac could have its system disk partition on /dev/disk0s2, a DVD drive on /dev/disk1, and an ancient SCSI tape drive on /dev/st0.
Before a partition can hold files, it is “formatted” by a program that writes a filesystem on it. A filesystem defines how files are represented; examples are HFS Plus (the traditional OS X filesystem) and NTFS (Microsoft Windows NT filesystem). Formatting is done by applications like Disk Utility, in the Mac’s Utilities folder. We will examine several command-line tools that do disk operations.
Once a filesystem is created, you can make it available for use by mounting it on an empty directory. For example, if you mount a Windows filesystem on a directory /Volumes/win, it becomes part of your system’s directory tree, and you can create and edit files like /Volumes/win/myfile. Mounting is generally done automatically, either at boot time or upon attaching a portable drive. Filesystems can also be unmounted to make them inaccessible, say, for maintenance.
3.134.78.106