Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'shell command to (re)mount volumes' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
shell command to (re)mount volumes
Authored by: zeorge on Apr 06, '04 01:17:57PM

:) this little script (re)mounts any unmounted volumes !
(auto detected - so you dont have to set any volume name)

1. copy/paste the script (starting with #!/usr/bin/perl) to bbedit
2. save it as "/bin/mountall" (may need admin password)
3. type "sudo chmod +x /bin/mountall" in the terminal
4. type "rehash" in the terminal
now you can use it with "mountall" in the terminal

for us who like to type instead of clicking ;)
zeorge 040406

[code]
#!/usr/bin/perl
# mountall [zeorge 04-2004]
@line_in = `disktool -l | grep volName`;
foreach $line (@line_in) {
$dev = extract($line,"Appeared ('","'");
$mp = extract($line,"Mountpoint = '","'");
$vn = extract($line,"volName = '","'");
if($mp eq "" && $vn ne "") {
print "mounting volume $vn ($dev) ... ";
print `diskutil mount $dev`;
}
}
sub extract {
my $string = shift;
my $start = shift;
my $end = shift;
my $pos = index($string,$start) + length($start);
$string = substr($string,$pos);
$pos = index($string,$end);
return substr($string,0,$pos);
}
[/code]



[ Reply to This | # ]