Project 66. Manage File Systems"How do I find out what local disks and remote volumes are mounted?" This project explains what a file system is and then shows you how to list and obtain information about currently mounted file systems. It covers the commands lsvfs, df, and du. Projects 67 and 68 show what you can do with Apple's diskutil command. Systems and SharingWe think of a disk in terms of the files and directories it contains and perhaps other properties, such as owners, permissions, and file metadata. The way this information is represented on the disk is a consequence of the system software that creates, reads, and writes files on the disk. This software defines the type of file system employed on the disk. The native file system in Mac OS X is Apple's HFS+ (Hierarchical File System); in other Unix systems, it's UFS (Unix File System). File systems are not limited to local drives. If we mount a share from another Mac by using AppleShare, another file system is needed to manage the remote volume in accordance with the protocol by which the local and remote machines communicate. In the case of AppleShare, the file system and the protocol are called AFP (Apple File Protocol). List File SystemsUse the lsvfs command to list all file systems currently loaded (but not necessarily in use). For example: $ lsvfs Filesystem Refs Flags ------------------------- ----- --------------- ufs 0 local nfs 5 fdesc 1 cd9660 0 local union 0 hfs 3 local, dovolfs volfs 1 devfs 1 afpfs 2 webdav 1 udf 1 local The Refs column refers to the number of currently mounted volumes (disks, partitions, and shares) of that file-system type. When a file system is flagged as local, it means that the device is attached to the local machine and not a remotely mounted share from another machine. Reading the output from lsvfs, we see that the local file systems comprise no UFS volumes, no CD-ROMs (file system cd9660), tHRee HFS+ volumes, and one DVD (file system udf). We also see three remote shares: two AppleShare (afpfs) mounts and a WebDAV mount. WebDAV is the protocol used by dot-Mac to mount your iDisk. The supposed five NFS (Network File System) shares reflect (I think) four NFS IO daemons launched at system startup and an FTP (File Transfer Protocol) server mounted by the Finder. Note: The remainder (fdesc, union, volfs, and devfs) are special file systems that map device names to the device drivers in /dev and also manage the mysterious /.vol directory. Discover Mounted DrivesThe lsvfs command shows the active file systems and how many mounted volumes each of them services. Use df to discover what is actually mounted, displaying the device and its path, or mount point. The df command also displays the size and available capacity of each mounted volume. (Option -h displays the capacity data in human-readable form, with size-unit abbreviations; omit the flag to see how nonhumans read the data.) $ df -h Filesystem Size ... Mounted on /dev/disk0s3 234G ... / devfs 100K ... /dev fdesc 1.0K ... /dev <volfs> 512K ... /.vol automount -nsl [188] 0B ... /Network automount -fstab [192] 0B ... /automount/Servers automount -static [192] 0B ... /automount/static /dev/disk1s3 20G ... /Volumes/Macintosh HD /dev/disk1s5 129G ... /Volumes/Backup-sauron afp_0TQCUU0QrZsg00vJDV... 12G ... /Volumes/saruman afp_0TQCUU0QrZsg00vJDV... 12G ... /Volumes/OSX-saruman /dev/disk2 4.9G ... /Volumes/MONTY_PYTHON https://secure/webdav/ -512.0B ... /Volumes/share ftp://carcharoth 1.0G ... /Volumes/carcharoth Learn More
The Mounted on column shows the Unix pathname of the mounted volume. The automount volumes control remote volumes that you'll observe below the Network icon in the top-left pane of the Mac OS X Finder.
You may use Apple's diskutil command to list mounted volumes, but it shows only local disk drives. $ diskutil list /dev/disk0 #: type name size identifier 0: Apple_partition_scheme *233.8 GB disk0 1: Apple_partition_map 31.5 KB disk0s1 2: Apple_HFS OSX-sauron 233.6 GB disk0s3 /dev/disk1 #: type name size identifier 0: Apple_partition_scheme *149.1 GB disk1 1: Apple_partition_map 31.5 KB disk1s1 2: Apple_HFS Macintosh HD 19.8 GB disk1s3 3: Apple_HFS Backup-sauron 129.0 GB disk1s5 Tip
Tip
|