Re: usb key problem

2009-10-19 Thread Christopher Sean Hilton
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:


[snip...]

 
 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
it:

 # 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
reasons. 

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
unmount. 

This works well for me. Your mileage may vary.

-- Chris

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: usb key problem

2009-10-16 Thread James Phillips

 
 Message: 11
 Date: Fri, 16 Oct 2009 01:32:46 +0200
 From: Polytropon free...@edvax.de
 Subject: Re: usb key problem
 To: PJ af.gour...@videotron.ca
 Cc: freebsd-questions@freebsd.org
 Message-ID: 20091016013246.c0e022e5.free...@edvax.de
 Content-Type: text/plain; charset=US-ASCII
 
 On Thu, 15 Oct 2009 19:18:45 -0400, PJ af.gour...@videotron.ca
 wrote:
  Now that I  have had a few moments to think about
 it, maybe I have to
  give good old cruze and enema and format it under XP
 ... maybe all it
  needs is a clean system on it. ;-)
 
 I'm not sure if USB sticks tend to degrade
 filesystem-wise,
 but when you put such a stick into random Windows PCs,
 it's
 quite possible that data gets messed up. The most ideal
 solution of course is to simply newfs the stick and give
 it
 a UFS file system, but sadly, Windows PC are resistent
 to
 standards, so they won't read it, but will force you to
 use
 old-fashioned MS-DOS-like file systems. :-)
 
To be fair, Windows XP supports the NTFS filesystem that is very feature-rich. 
Although, I recall making a XP machine unbootable trying to format removable 
media with NTFS because only the installer woulds use that filesystem. The 
format utility let me choose between Fat16 and FAt32 or something :P

A better tool, under both Windows (via Cygwin) and BSD, would be ntfsprogs.

http://www.linux-ntfs.org/doku.php?id=ntfsmount

Regards,

James Phillips

 
 -- 
 Polytropon
 Magdeburg, Germany
 Happy FreeBSD user since 4.0
 Andra moi ennepe, Mousa, ...
 
 



  __
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your 
favourite sites. Download it now
http://ca.toolbar.yahoo.com.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: usb key problem

2009-10-16 Thread Polytropon
On Fri, 16 Oct 2009 11:05:01 -0700 (PDT), James Phillips 
anti_spam...@yahoo.ca wrote:
 To be fair, Windows XP supports the NTFS filesystem that is
 very feature-rich.

And prone to file system corruption, as well as not very
performant speed-wise (which doesn't count in regards of
backups). :-)



 Although, I recall making a XP machine unbootable trying
 to format removable media with NTFS because only the
 installer woulds use that filesystem. The format utility
 let me choose between Fat16 and FAt32 or something :P

What a bug... erm, feature! :-)


 A better tool, under both Windows (via Cygwin) and BSD, would be ntfsprogs.
 
 http://www.linux-ntfs.org/doku.php?id=ntfsmount

Yes, FreeBSD let's you even mount NTFS volumes via smbfs,
so you don't have to care for the file system used. This
is because Windows does not support standard NFS out of
the box. This way would be interesting if your machine that
holds the backup files is a Windows PC.

As far as I know, there's a fuse module (ntfs3g?) in the
ports. But I have to admit that I've never tried it.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: usb key problem

2009-10-16 Thread PJ
Polytropon wrote:
 On Thu, 15 Oct 2009 20:06:08 -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
 

 Additionally, when you use mount_msdosfs, you can specify
 masks (-m and -M) in order not to have +x attributes on all
 the files; the MS-DOS file system on the stick could give
 you unwanted results, for example if you have a .jpg file
 on the stick and want to open it (with the default app for
 .jpg file type), the system will try to execute it.



   
 Now to see how I can use it to restore stuff. :-D
 

 If you want to use the stick for FreeBSD operations, why not
 give it a real file system (i. e. UFS) instead of some old
 FAT? You can simply

   # newfs /dev/da0

 and then access it in the standard way:

   # mount /dev/da0 /mnt

 See that file owner:group, permissions and flags are now
 supported, and files that are not supposed to be executables
 don't have +x attribute (as in opposite to FAT / msdosfs).

 You could even add an entry in /etc/fstab like this:

   /dev/da0s1 /media/stick msdosfs rw,noauto,noatime 0 0

 or, for proper UFS:

   /dev/da0 /media/stick ufs rw,noauto,noatime 0 0

 Keep in mind that when using device names, it's a matter of
 in which sequence device are detected that result in the
 corresponding device name (da0, da1 etc.); using labels is
 the more elegant way here.
   
How do you mean, using labels; could you illustrate or clarify? for the above, 
I mean.

I'm trying to set up labels for my normal systems with glabel and struggling...


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: usb key problem

2009-10-15 Thread PJ
PJ wrote:
 I am running 7.2 but cannot properly attach/detach cruze 8gb and 4gb USB
 keys.
 When inserted, generate errors:
 da0 seems to be read correctly
 but then comes arow of
 (probe0:umass-sim0:0:0:1): snip CAM Status: SCSI Status Error
 snip NOT READY asc:3a,0
 Medium not present
 Unretryable error
 then
 cd0 at umass-sim0 dada,dada,dada
 attempt to query device size failed; UNIT ATTENTION, Not ready to ready
 change, medium may have changed

 # camcontrol devlist
 SanDisk U3 Cruzer Micro 4.04 at scbus1 target 0 lun 0 (da0,pass0)
 same as above - ---   lun 1 (pass1,cd0)

 Something is not functioning  I don't understand. It did function a
 while (some weeks) ago but now, no go...
 I did look on the web, but...
 

   
Now that I  have had a few moments to think about it, maybe I have to
give good old cruze and enema and format it under XP ... maybe all it
needs is a clean system on it. ;-)

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: usb key problem

2009-10-15 Thread Polytropon
On Thu, 15 Oct 2009 18:19:16 -0400, PJ af.gour...@videotron.ca wrote:
 I am running 7.2 but cannot properly attach/detach cruze 8gb and 4gb USB
 keys.
 When inserted, generate errors:
 da0 seems to be read correctly
 but then comes arow of
 (probe0:umass-sim0:0:0:1): snip CAM Status: SCSI Status Error
 snip NOT READY asc:3a,0
 Medium not present
 Unretryable error
 then
 cd0 at umass-sim0 dada,dada,dada
 attempt to query device size failed; UNIT ATTENTION, Not ready to ready
 change, medium may have changed
 
 # camcontrol devlist
 SanDisk U3 Cruzer Micro 4.04 at scbus1 target 0 lun 0 (da0,pass0)
 same as above - ---   lun 1 (pass1,cd0)

It would be good if you provide the full dmesg lines that
are corresponding with this problem.

By the way, I had problems with defective by design SanDisk
USB sticks, too. This is how it looked:

% dmesg | tail
umass0: SanDisk Cruzer Micro, class 0/0, rev 2.00/2.00, addr 2 on uhub2
da0 at umass-sim0 bus 0 target 0 lun 0
da0: SanDisk Cruzer Micro 8.02 Removable Direct Access SCSI-0 device 
da0: 40.000MB/s transfers
da0: Attempt to query device size failed: UNIT ATTENTION, Medium not present
umass0: at uhub2 port 2 (addr 2) disconnected
(da0:umass-sim0:0:0:0): lost device
(da0:umass-sim0:0:0:0): removing device entry
umass0: detached

I could not access the stick, /dev/da0 was the only device
that appeared, and I could only dump the partition table
(in terms of DOS primary partitions, i. e. slices) with
the fdisk da0 command. But I could not access it.

Finally, I printed out dmesg on a line printer (looks very
impressing), marked the lines shown above and returned it to
the shop. I'm now happy with a Sony USB stick which works
excellently.



 Something is not functioning  I don't understand. It did function a
 while (some weeks) ago but now, no go...

It did function, and now no more? I would say that if you didn't
change anything on your system, the SanDisk stick is broken.

Could you try the stick in another system for reference?



 I did look on the web, but...
 

Did you see a spider that made the web? :-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: usb key problem

2009-10-15 Thread Polytropon
On Thu, 15 Oct 2009 19:18:45 -0400, PJ af.gour...@videotron.ca wrote:
 Now that I  have had a few moments to think about it, maybe I have to
 give good old cruze and enema and format it under XP ... maybe all it
 needs is a clean system on it. ;-)

I'm not sure if USB sticks tend to degrade filesystem-wise,
but when you put such a stick into random Windows PCs, it's
quite possible that data gets messed up. The most ideal
solution of course is to simply newfs the stick and give it
a UFS file system, but sadly, Windows PC are resistent to
standards, so they won't read it, but will force you to use
old-fashioned MS-DOS-like file systems. :-)


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: usb key problem

2009-10-15 Thread PJ
Polytropon wrote:
 On Thu, 15 Oct 2009 18:19:16 -0400, PJ af.gour...@videotron.ca wrote:
   
 I am running 7.2 but cannot properly attach/detach cruze 8gb and 4gb USB
 keys.
 When inserted, generate errors:
 da0 seems to be read correctly
 but then comes arow of
 (probe0:umass-sim0:0:0:1): snip CAM Status: SCSI Status Error
 snip NOT READY asc:3a,0
 Medium not present
 Unretryable error
 then
 cd0 at umass-sim0 dada,dada,dada
 attempt to query device size failed; UNIT ATTENTION, Not ready to ready
 change, medium may have changed

 # camcontrol devlist
 SanDisk U3 Cruzer Micro 4.04 at scbus1 target 0 lun 0 (da0,pass0)
 same as above - ---   lun 1 (pass1,cd0)
 

 It would be good if you provide the full dmesg lines that
 are corresponding with this problem.

 By the way, I had problems with defective by design SanDisk
 USB sticks, too. This is how it looked:

 % dmesg | tail
 umass0: SanDisk Cruzer Micro, class 0/0, rev 2.00/2.00, addr 2 on uhub2
 da0 at umass-sim0 bus 0 target 0 lun 0
 da0: SanDisk Cruzer Micro 8.02 Removable Direct Access SCSI-0 device 
 da0: 40.000MB/s transfers
 da0: Attempt to query device size failed: UNIT ATTENTION, Medium not present
 umass0: at uhub2 port 2 (addr 2) disconnected
 (da0:umass-sim0:0:0:0): lost device
 (da0:umass-sim0:0:0:0): removing device entry
 umass0: detached

 I could not access the stick, /dev/da0 was the only device
 that appeared, and I could only dump the partition table
 (in terms of DOS primary partitions, i. e. slices) with
 the fdisk da0 command. But I could not access it.

 Finally, I printed out dmesg on a line printer (looks very
 impressing), marked the lines shown above and returned it to
 the shop. I'm now happy with a Sony USB stick which works
 excellently.



   
 Something is not functioning  I don't understand. It did function a
 while (some weeks) ago but now, no go...
 

 It did function, and now no more? I would say that if you didn't
 change anything on your system, the SanDisk stick is broken.

 Could you try the stick in another system for reference?



   
 I did look on the web, but...
 
 

 Did you see a spider that made the web? :-)
   
Yeah, and it scared the shit out of me... ;-)

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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: usb key problem

2009-10-15 Thread PJ
Polytropon wrote:
 On Thu, 15 Oct 2009 19:18:45 -0400, PJ af.gour...@videotron.ca wrote:
   
 Now that I  have had a few moments to think about it, maybe I have to
 give good old cruze and enema and format it under XP ... maybe all it
 needs is a clean system on it. ;-)
 

 I'm not sure if USB sticks tend to degrade filesystem-wise,
 but when you put such a stick into random Windows PCs, it's
 quite possible that data gets messed up. The most ideal
 solution of course is to simply newfs the stick and give it
 a UFS file system, but sadly, Windows PC are resistent to
 standards, so they won't read it, but will force you to use
 old-fashioned MS-DOS-like file systems. :-)


   
I do hate MS, but can't totally avoid it.
Now, I hope the key works to transfer the dumpfiles even if it's in Fat32...

Anyway, thanks much for your guidance and patience. :-)
I think I'll be able to float by myself... for a while at least.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: usb key problem

2009-10-15 Thread Polytropon
On Thu, 15 Oct 2009 20:06:08 -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

Additionally, when you use mount_msdosfs, you can specify
masks (-m and -M) in order not to have +x attributes on all
the files; the MS-DOS file system on the stick could give
you unwanted results, for example if you have a .jpg file
on the stick and want to open it (with the default app for
.jpg file type), the system will try to execute it.



 Now to see how I can use it to restore stuff. :-D

If you want to use the stick for FreeBSD operations, why not
give it a real file system (i. e. UFS) instead of some old
FAT? You can simply

# newfs /dev/da0

and then access it in the standard way:

# mount /dev/da0 /mnt

See that file owner:group, permissions and flags are now
supported, and files that are not supposed to be executables
don't have +x attribute (as in opposite to FAT / msdosfs).

You could even add an entry in /etc/fstab like this:

/dev/da0s1 /media/stick msdosfs rw,noauto,noatime 0 0

or, for proper UFS:

/dev/da0 /media/stick ufs rw,noauto,noatime 0 0

Keep in mind that when using device names, it's a matter of
in which sequence device are detected that result in the
corresponding device name (da0, da1 etc.); using labels is
the more elegant way here.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: usb key problem

2009-10-15 Thread Polytropon
On Thu, 15 Oct 2009 20:12:06 -0400, PJ af.gour...@videotron.ca wrote:
 I do hate MS, but can't totally avoid it.

I'm totally MICROS~1 free for more than 15 years now. :-)



 Now, I hope the key works to transfer the dumpfiles even if it's in Fat32...

It should work, BUT... I think I remember that there was a
size limit of some GB so that larger files got truncated...
I am not sure if this is still the case. You should check
the backup files, but that won't be a problem because you
still have the source system. You shoudln't have problems
with the stupid +x attributes because the files are only
read.



 I think I'll be able to float by myself... for a while at least.

We all float down here. :-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org