[macosx-unix] grabbing volume info in single user mode without using diskutil

KLW antispam at brokenhill.net
Tue Oct 10 15:36:54 EDT 2006


Background: When booted into single user mode, diskutil doesn't work 
unless you've already started up a bunch of services--either through 
SystemStarter (Jaguar), /etc/mach_init.d (Panther), or launchd 
daemons (Tiger).

I would like to devise a way to automatically scan all disk devices, 
find their volume info (label, UUID, and file system) so that I can 
mount all connected disks without having to launch a bunch of 
supporting services. The method would look something like this:

for d in `ls /dev/disk*s* | grep -v disk0`;do
     dlabel=command_to_find_disk_label
     dfs=command_to_find_file_system_type (hfs, etc)
     echo "mounting $dlabel";
     mkdir "/Volumes/$dlabel"
     if mount -vw -t hfs $dfs "/Volumes/$dlabel";then
         echo "successfully mounted at /Volumes/$dlabel"
     else
         echo "bah!"
     fi;
done

I am not finding a good method (via bash, which is where I would like 
to stay) of finding the disk label and file system type. Anyone have 
any clues?

Thanks.

Kristofer
-- 
~~~~~~~~~<http://brokenhill.net>~~~~~~~~~~~
"Why should we limit computers to the lies
people tell them through keyboards?"

Bill Gospar, 1965, MIT


More information about the macosx-unix mailing list