On Thu, Oct 15, 2009 at 08:06:08PM -0400, PJ wrote:
> Polytropon wrote:
> > On Thu, 15 Oct 2009 18:19:16 -0400, PJ <af.gour...@videotron.ca> wrote:
> >   


> Anyway, I found the solution on the web... couldn't belive it was that
> simple: just ignore the crap spewed out on the screen and just mount iit
> as you would any other disk.
> # mount  -t msdosfs /dev/da0s1 /mnt
> and that's it
> I don't know if it makes any difference, but I did delete everything on
> the key and formatted with Fat32. That got rid of everything and only
> took up 4k instead of 32 when not formatted and I could put my own label
> on the disk.
> Yea!
> Now to see how I can use it to restore stuff. :-D

The SanDisk keys include two devices, a umass disk device and and usb
psuedo CD-ROM drive. The CD-ROM drive only works properly in windows. It
doesn't work in FreeBSD and throws errors at key-insertion time.

Downthread a poster suggested putting a FreeBSD filesystem on this drive:

     # newfs /dev/da0
     # mount /dev/da0 /mnt

The advantage to this is that you get full FreeBSD filesystem sematics
from the drive. The disadvantage is that you have to make sure to
umount it before unplugging it in. If you don't umount it you will be
asked to fsck it on next insert. I don't find the disadvantage that
heinous so I keep a few sticks around with UFS filesystems on them. If
you choose to use UFS here's two things that are really helpful: 

Use a label so your drive doesn't appear in different places. When you
make your filesystem ensure that you put a unique (to you) label on

     # newfs -L my_usb_stick /dev/da0
     # mount /dev/ufs/my_usb_stick /mnt

Use amd to mount the stick rather than doing it manually. Amd is
designed to automatically mount and dismount transient filesystems. It
was originally built with NFS filesystems involved but it adapts well
to UFS filesystems on transient devices with a workaround. I use the
following configuration spread through three files:

     $ cat /etc/amd/amd.conf
     [ global ]
             search_path = /etc/amd
             auto_dir = /.amd
             cache_duration = 30
             ## log_file = syslog:daemon
             ## log_options = fatal,error
             print_pid = yes
             pid_file = /var/run/amd.pid
             restart_mounts = yes

     [ /media ]
             map_name = /etc/amd/media.map

     $ cat /etc/amd/media.map 
     ## ----------------------------------------------------------------------
     ## Create a map that will allow mounts of appropriately labeled
     ## UFS filesystems.  We have to use the 'program' mount type
     ## because amd predates hot-pluggable removable storage. Thus amd
     ## will never timeout a volume that it knows is UFS.

     /default   type:=program

     *          rfs:=/dev/ufs/${key};fs:=${autodir}/${key};\
                mount:="/sbin/mount mount -o nodev,noexec ${rfs} ${fs}";\
                unmount:="/sbin/umount umount ${rfs}"

     $ grep "^amd" /etc/rc.conf
     amd_enable="YES"                # Run amd service with $amd_flags (or NO).
     amd_flags="-F /etc/amd/amd.conf" 

Those three config snippets pretty much do it for me. The first sets
some parameters on how amd runs. The second tells amd how to manage
the /media directory which is where you usb stick(s) will show up. It
also has the workaround. As noted above amd knows about UFS mounts but
for some reason it never times them out. Using the 'program'
filesystem gets around that. The third is the portion of /etc/rc.conf
that automatically starts amd using the config above. I created a
directory in /etc: /etc/amd to manage everything in one place. The
mount is done without exec and without devices for security

The technique works for any transient filesystem. USB, Firewire,
eSata. With this configuration users can force a mount an attached the
above filesystem, my_usb_stick, by doing the following:

     $ ls -l /media/my_usb_stick

Note well that you can do this as a normal user. The filesystem will
be automatically unmounted in 30 seconds. If you want to unmount the
filesystem "forcefully" you can do:

     $ amq -u /media/my_usb_stick

Again note that you don't have to transistion to root to do the

This works well for me. Your mileage may vary.

-- Chris

freebsd-questions@freebsd.org mailing list
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to