An open community 
of Macintosh users,
for Macintosh users.

FineTunedMac Dashboard widget now available! Download Here

Previous Thread
Next Thread
Print Thread
many devices when booted to restore
#28538 04/03/14 08:59 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
So I was troubleshooting an issue and found myself unexpectedly booting to a recovery partition. (10.7.2) I dropped into terminal to see what all was on the internal hard drive, and found:

Code:
 df -ht hfs
Filesystem     Size   Used  Avail Capacity  Mounted on
/dev/disk2s3  1.3Gi  1.1Gi  197Mi    85%    /
/dev/disk3    512Ki  144Ki  368Ki    29%    /Volumes
/dev/disk4    512Ki  140Ki  372Ki    28%    /private/var/tmp
/dev/disk5    512Ki  156Ki  356Ki    31%    /private/var/run
/dev/disk6    512Ki  144Ki  368Ki    29%    /System/Installation
/dev/disk7    512Ki  252Ki  260Ki    50%    /private/var/db
/dev/disk8    6.0Mi  1.9Mi  4.1Mi    32%    /private/var/folders
/dev/disk9    2.0Mi  264Ki  1.7Mi    13%    /private/var/root/Library
/dev/disk10   1.0Mi  144Ki  880Ki    15%    /Library/ColorSync/Profiles/Displays
/dev/disk11   512Ki  160Ki  352Ki    32%    /Library/Preferences
/dev/disk12   512Ki  156Ki  356Ki    31%    /Library/Preferences/SystemConfiguration
/dev/disk13   1.0Mi  140Ki  884Ki    14%    /Library/Keychains
/dev/disk0s2  233Gi   53Gi  180Gi    23%    /Volumes/Macintosh HD
/dev/disk1s2  931Gi  128Gi  803Gi    14%    /Volumes/Image Volume


Huh. I wasn't really expecting it to list a DOZEN devices... weirdness? I imagine it's something to do with how the recovery partition boots, but that's not "normal"


I work for the Department of Redundancy Department
Re: many devices when booted to restore
Virtual1 #28552 04/06/14 02:20 AM
Joined: Aug 2009
Offline

Joined: Aug 2009
I also was surprised the first time I saw that. I went digging at the time to try to figure out what was going on.

There are certain directories that must be writeable. You have a list of them. (Specifically, all the mount points on your list that are not /, /Volumes, or inside /Volumes.) But the recovery partition is read-only. How can you have a writeable directory on a read-only volume?

The answer is that when you boot off a read-only volume (whether a recovery partition or a CD/DVD or a read-only disk image), the boot process creates a RAM disk for each of these directories, and mounts them where they need to be.

Background: in Unix, to mount any volume, you first choose or create a directory, called the mount point, somewhere in the file tree, then mount the volume at that directory. The directory need not have been empty, but once you mount the volume the directory's former content becomes inaccessible; instead, what you see inside the directory is whatever is on the volume. When you unmount the volume, the former contents of the directory become accessible again.

By convention, OS X creates that directory inside /Volumes, and deletes if after unmounting the volume, but that's only an OS X convention. Unix doesn't care where the directory is, doesn't care if it's empty, and doesn't care whether you delete it afterwards.

For example, /private/var/db would be an empty directory on the Recovery partition. The boot process mapped it to a 1024-sector RAM disk with the moral equivalent of:

mydev=$(hdiutil attach -nomount ram://1024)
newfs_hfs $mydev
mount -t hfs $mydev /private/var/db


I say moral equivalent, because until you make these directories writeable you can't run a shell. The boot process would be using the equivalent C API rather than issuing shell commands.


Moderated by  alternaut, dkmarsh, joemikeb 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.4.33 Page Time: 0.014s Queries: 18 (0.009s) Memory: 0.5734 MB (Peak: 0.6253 MB) Data Comp: Zlib Server Time: 2024-04-19 11:43:35 UTC
Valid HTML 5 and Valid CSS