Tag Archives: storage

Mounting Jumpdrives in FreeBSD

After my fiasco trying to get FBSD to auto mount when the jumpdrive was inserted, I ended up just creating a little perl script to take care of it for now (being finals week and all). It’s not much and does absolutely no error checking, but if anyone has any suggestions, they are more than welcome.

Keep in mind, you must have the proper settings active in your kernel for this to work.

Here it is:

#!/usr/bin/perl -w

use strict;

# If no arguments are given, print a brief help message
if (!defined($ARGV[0]))
print “\n”;
print “Help:\n”;
print “Lexar Jumpdrive mounting script\n”;
print “\n”;
print “You must provide one of the following arguments:\n”;
print “m Mounts the Jumpdrive.\n”;
print “u UnMounts the Jumpdrive.\n”;
print “\n”;
print “Example: lexar m\n”;
print “\n”;

# m mounts the jumpdrive
elsif ($ARGV[0] eq “m”)
# mounting the jumpdrive at /lexar
# this can be set to whatever you like
system “/sbin/mount -t msdos /dev/da0s1 /lexar”;
print “Jumpdrive mounted at /lexar.\n”;

elsif ($ARGV[0] eq “u”)
# umounts the jumpdrive
system “/sbin/umount /lexar”;
print “Jumpdrive unmounted.\n”;