Date: Wed, 6 Jun 2007 19:32:22 +0200 From: Roland Smith <rsmith@xs4all.nl> To: Oscar Chavarria <cyberbuzzard@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: How to mount USB key Message-ID: <20070606173222.GC59161@slackbox.xs4all.nl> In-Reply-To: <716841580706060957o4cae2a93lc24ef11c29c06af9@mail.gmail.com> References: <716841580706060957o4cae2a93lc24ef11c29c06af9@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--w7PDEPdKQumQfZlR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Wed, Jun 06, 2007 at 10:57:57AM -0600, Oscar Chavarria wrote:
> I want to copy files to it. I introduced the key and was recognized as d=
a0.
>=20
> I did ls dev/da0 =3D=3D> dev/da0
>=20
> Then
>=20
> mount /dev/da0 /home =3D=3D> incorrect super block.
You're trying to mount the drive as a UFS filesystem; this is the
default for mount.
Are there no other devices starting with da0? Because usually USB
keydrives are partitioned and then the first partition is formatted as
FAT32. So you probably want /dev/da0s1, or sometimes /dev/da0s4 if it exist=
s.
It is also not a good idea to mount on /home, because it will mask your
home directory.
If you want to mount a disk as a normal user instead of root, there are
some things that need to be set up correctly, see below.
It's better to use something like:
mount_msdosfs -m 644 -M 755 -o noatime,noexec,nosuid,sync /dev/da0s1 /mnt/m=
ydir
I've written a small shell script to do this for me;
----------------
#!/bin/sh
# Mount a thumbdrive with a MSDOS filesystem
DIR=3D/mnt/$USER
DEV=3D/dev/da0s1
# It is assumed that $DIR exists, and is owned by $USER.
# Check if $DIR is already used.
if mount|grep $DIR >/dev/null; then
echo "$DIR is already mounted!"
exit 1;
fi
# Check if $DEV is available.
if ! ls $DEV >/dev/null 2>&1; then
echo "$DEV does not exist!"
exit 1; =20
fi
# Everything OK, try to mount.
mount_msdosfs -m 644 -M 755 -o noatime,noexec,nosuid,sync $DEV $DIR
----------------
N.B.:
- /mnt/$USER should be an existing directory, and that you should be
it's owner.=20
- the script will fail if there is already an USB disk attached.=20
(it should use da1s1 in that case)
- the sysctl vfs.usermount should be set to 1 to allow normal users to
mount filesystems
- the permissions on the /dev/da0 device whould be set such as to allow
you access. See http://www.xs4all.nl/~rsmith/freebsd/index.html#devfs
Roland
--=20
R.F.Smith http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
--w7PDEPdKQumQfZlR
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.3 (FreeBSD)
iD8DBQFGZu+mEnfvsMMhpyURAvwTAJ9YJNKc2Xo5Bdt0AAC3dMke5BInDwCghp9p
Qq/Mz+XE4I1keaLzyJ4OLDU=
=vIq8
-----END PGP SIGNATURE-----
--w7PDEPdKQumQfZlR--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070606173222.GC59161>
