Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

fstab entry for usb memory stick

669 views
Skip to first unread message

Tony McGuinness

unread,
Feb 20, 2012, 12:56:04 PM2/20/12
to
Does anybody know the correct fstab entry for a usb memory
stick?

Sylvain Robitaille

unread,
Feb 20, 2012, 1:05:34 PM2/20/12
to
On Mon, 20 Feb 2012 17:56:04 GMT, Tony McGuinness wrote:

> Does anybody know the correct fstab entry for a usb memory
> stick?

Here's what I use, though I can't say for sure it's "the correct" entry;
it does work as intended, though ...

# device mountpoint fs-type options frq pass
/dev/sdg1 /mnt/usb auto noauto,owner,user,relatime 0 0
/dev/sdf1 /mnt/usb auto noauto,owner,user,relatime 0 0

I hope this helps ...

--
----------------------------------------------------------------------
Sylvain Robitaille s...@encs.concordia.ca

Systems analyst / AITS Concordia University
Faculty of Engineering and Computer Science Montreal, Quebec, Canada
----------------------------------------------------------------------

Helmut Hullen

unread,
Feb 20, 2012, 1:57:00 PM2/20/12
to
Hallo, Tony,

Du meintest am 20.02.12:

> Does anybody know the correct fstab entry for a usb memory
> stick?

???
"/etc/fstab" is the place for devices which are hard connected to the
computer (like FDs, HDs).

An USB stick may be a "superfloppy" type, may have 1 partition, may have
10 partitions. If you have 2 USB sticks the first connected stick may be
/dev/sdb (if your machine has only 1 HD), the second may be /dev/sdc.

You define the device names with choosing the first stick.

Nothing for a "hard coded" fstab.

Viele Gruesse
Helmut

"Ubuntu" - an African word, meaning "Slackware is too hard for me".

Tony McGuinness

unread,
Feb 20, 2012, 2:27:55 PM2/20/12
to
Thank you for your prompt reply.

Tony McGuinness

unread,
Feb 20, 2012, 2:29:01 PM2/20/12
to
Thank you for your prompt response.

Eef Hartman

unread,
Feb 21, 2012, 4:45:11 AM2/21/12
to
Tony McGuinness <tony.j.m...@gmail.com> wrote:
> Does anybody know the correct fstab entry for a usb memory
> stick?

Unless you want to create multiple entries for each of the possible
devices it could be connected TO, my favorite way has always been
by label (but you DO have to uniquely label all of your USB sticks
for that:
LABEL=DANEELEC_2G /mnt/DaneElec vfat noauto,users,fmask=0133 0 0
(that is: mount the stick, labelled as DANEELEC_2G - a DaneElec 2 GB
stick I've got - on /mnt/DaneElec, applying the 0133 mask to all
the files (this removes Write rights to everyone BUT the mounting
id and eXecute rights for everyone). The "noauto,users" part makes
it possible to mount it as a normal user, do not need su or sudo.
As its a fat-type of stick, the label is all-caps. It was created
with "dosfslabel":
NAME
dosfslabel - set or get MS-DOS filesystem label
SYNOPSIS
dosfslabel DEVICE [LABEL]
(from the man-page). I ported this from source, but newer Slackware
releases may have this util standard, I never looked.
--
******************************************************************
** Eef Hartman, Delft University of Technology, dept. SSC/ICT **
** e-mail: E.J.M....@tudelft.nl - phone: +31-15-27 82525 **
******************************************************************

HeadLessBoot

unread,
Feb 21, 2012, 5:28:36 AM2/21/12
to
Tony McGuinness, on 02/20/2012 06:56 PM, wrote:
> Does anybody know the correct fstab entry for a usb memory
> stick?

Don't bother with fstab for usb keys. Slackware uses udev by
default. It creates in /dev/disk/ many useful symlinks that remain
constant for each device, as long as you don't alter its partition
table.
See
~$ ls -hal /dev/disk/
It's easy to mount usb keys with a command like this one:

~$ sudo mount /dev/disk/by-id/usb-UsbKeyMakeModel-0\:0-part1
/mnt/yourmountpoint/ -o uid=youruser,gid=yourgroup

You don't need "sudo" if you are root.

See also
~$ man udev

Bud

unread,
Feb 21, 2012, 2:24:53 PM2/21/12
to
Hmmm, mine, 8Gig, are plugged in all the time and I use,
/dev/sdb1 /mnt/sdb1 vfat auto,users,rw 0 0

Works fine for me.
--
Bud

jim dorey

unread,
Feb 22, 2012, 3:07:10 AM2/22/12
to
Eef Hartman wrote:

> Unless you want to create multiple entries for each of the possible
> devices it could be connected TO, my favorite way has always been
> by label (but you DO have to uniquely label all of your USB sticks
> for that:

i use disk id's, for everything i can, it's unlikely a decent disk
supplier would use the same serial for everything.

Eef Hartman

unread,
Feb 22, 2012, 3:51:37 AM2/22/12
to
jim dorey <sk...@ns.sympatico.ca> wrote:
> i use disk id's, for everything i can, it's unlikely a decent disk
> supplier would use the same serial for everything.

We were talking about USB sticks, not "real disks", which don't
always have that habit. For instance my current stick only identifies
itself as "SanDisk Cruzer Switch", no serial nr or whatever.
The mount entry for that (I reformatted it as ext3) is:
LABEL=SanDisk_16G /mnt/SanDisk ext3 noauto,users 0 0

HeadLessBoot

unread,
Feb 22, 2012, 4:46:59 AM2/22/12
to
Bud, on 02/21/2012 08:24 PM, wrote:

> Hmmm, mine, 8Gig, are plugged in all the time and I use,
> /dev/sdb1 /mnt/sdb1 vfat auto,users,rw 0 0
>
> Works fine for me.

I agree. Looks like if you never touch your usb keys, they keep
getting assigned the same /dev/sd* address at every boot.

Olive

unread,
Feb 22, 2012, 5:03:04 AM2/22/12
to
Yes but this is a fragile solution. If you once boot your computer with
another memory stick/hard disk plugged in, the /dev/sdb1 might well
refer to the other disk. Better to use labels or UUID.

Olive

Eef Hartman

unread,
Feb 22, 2012, 5:19:57 AM2/22/12
to
HeadLessBoot <head...@seattle.us.maybe> wrote:
> I agree. Looks like if you never touch your usb keys, they keep
> getting assigned the same /dev/sd* address at every boot.

The problem in THIS workstation is that when the stick is present
during reboot, it gets assigned sdb, but when not, the "cardreader"
devices are assigned sdb thru sde, so a stick becomes sdf.
If I got my external eSata docking station ON during reboot it
becomes even worse as the SATA driver gets loaded first, so IT
becomes sdb and all the rest get moved up by 1 letter.

PS: this HP xw4600 workstation got one internal disk AND a eSata
plug at the back; the docking station mostly is switched off
(external power supply) so doesn't get seen by the kernel,
the multi-card reader is internal, but normally doesn't contain
any cards IN it. But it does make for many possible drive orders:
sda - always internal disk WDC WD5000AAKS
eSata - current WDC WD15EARS (but I'm taking the disk out again
tonight, to take it home)
cardreader - CompactFlash, SmartMedia/xD, MemoryStick/MS-Pro and
SecureDigital/MultiMediaCard slots,
takes up FOUR device names, even with no cards present
usb slots - any "next" devices

Current device assignments are sdb thru sde for the cardreader,
sdf for the docking station and sdg for the SanDisk stick, but when
I would now reboot, de eSata connection will become sdb, the usb stick
sdc and the cardreader devices will move up to sdd-sdg (the driver
for it is loaded rather late in the bootup cycle, after the USB ones).

My computer at home is of the same type (so with eSata plug, which
also is connected to a docking station) but without the cardreader.
But there I normally have a MP3 player and possible an external USB
disk drive (250 GB) connected (it also has two internal disks).

jim dorey

unread,
Feb 23, 2012, 1:12:26 AM2/23/12
to
Eef Hartman wrote:
> jim dorey <sk...@ns.sympatico.ca> wrote:
>> i use disk id's, for everything i can, it's unlikely a decent disk
>> supplier would use the same serial for everything.
>
> We were talking about USB sticks, not "real disks", which don't
> always have that habit. For instance my current stick only identifies
> itself as "SanDisk Cruzer Switch", no serial nr or whatever.
> The mount entry for that (I reformatted it as ext3) is:
> LABEL=SanDisk_16G /mnt/SanDisk ext3 noauto,users 0 0

oddly, all mine have a uuid...

Mikhail Zotov

unread,
Feb 23, 2012, 3:55:01 AM2/23/12
to
Just a tiny "addon". When using an fstab entry
for flash sticks, I add "noatime" to the mount options:

/dev/sdc1 /mnt/usb1 auto noauto,user,noatime,nosuid,nodev 0 0

I tried to use "1 2" instead of "0 0" to avoid reminders about
a need to run fsck but don't remember if this helped :-) Probably yes.

For vfat, "noexec,showexec,codepage=XXXX" might be handy.

As it has been explained, for "automatic" mounts, udev works fine
and one doesn't need an entry in fstab.

--
M.

Mikhail Zotov

unread,
Feb 23, 2012, 4:03:31 AM2/23/12
to
On Thu, 23 Feb 2012 12:55:01 +0400
Mikhail Zotov <invalid...@lenta.ru> wrote:

> On Mon, 20 Feb 2012 17:56:04 GMT
> Tony McGuinness <tony.j.m...@gmail.com> wrote:
>
> > Does anybody know the correct fstab entry for a usb memory
> > stick?
>
> Just a tiny "addon". When using an fstab entry
> for flash sticks, I add "noatime" to the mount options:
>
> /dev/sdc1 /mnt/usb1 auto noauto,user,noatime,nosuid,nodev 0 0

Sylvain's suggestion to use "relatime" might be a better idea :-)
[man mount]

--
M.

Eef Hartman

unread,
Feb 24, 2012, 1:46:42 PM2/24/12
to
jim dorey <sk...@ns.sympatico.ca> wrote:
> oddly, all mine have a uuid...

A UUID is assigned by the linux fs creator, I don't believe vfat
sticks have them (although I admit I never looked for it).
Unlike that UUID rhe disk ID is assigned by the manufacturer and
that's what I thought you were talking about.

Eef Hartman

unread,
Feb 24, 2012, 1:48:24 PM2/24/12
to
Mikhail Zotov <invalid...@lenta.ru> wrote:
> I tried to use "1 2" instead of "0 0" to avoid reminders about
> a need to run fsck but don't remember if this helped :-) Probably yes.

As that check is only done at bootup time, and probably _before_
the USB storage support has been loaded: probably not.

Kees Theunissen

unread,
Feb 25, 2012, 12:28:47 AM2/25/12
to
Eef Hartman wrote:

> A UUID is assigned by the linux fs creator, I don't believe vfat
> sticks have them (although I admit I never looked for it).

They do have them. Even plain msdos floppies (FAT12) formatted
with msdos 4.01 or later have UUID's. These numbers are most
likely not "Universally Unique" though.

In dos and windows this is know as the "Volume serial number"
and it is a 32 bit number derived from the date and time.

Regards,

Kees.

--
Kees Theunissen.

Vlad D. Markov

unread,
Feb 25, 2012, 11:49:03 PM2/25/12
to
On 2012-02-24, Eef Hartman <E.J.M....@tudelft.nl> wrote:
> jim dorey <sk...@ns.sympatico.ca> wrote:
>> oddly, all mine have a uuid...
>
> A UUID is assigned by the linux fs creator, I don't believe vfat
> sticks have them (although I admit I never looked for it).
> Unlike that UUID rhe disk ID is assigned by the manufacturer and
> that's what I thought you were talking about.
My linux box is not available right now but I have labeled my
vfat USB sticks using some utility in Slackware. Then I set up
a mount point and an fstab entry so I could always mount the
same usb stick on the same mount point.

The labeling utility did not destroy any data on the usb
stick either.

I either learned about doing this from this group or googling.

Mikhail Zotov

unread,
Feb 28, 2012, 12:45:39 PM2/28/12
to
On Fri, 24 Feb 2012 19:48:24 +0100
Eef Hartman <E.J.M....@tudelft.nl> wrote:

> Mikhail Zotov <invalid...@lenta.ru> wrote:
> > I tried to use "1 2" instead of "0 0" to avoid reminders about
> > a need to run fsck but don't remember if this helped :-) Probably
> > yes.
>
> As that check is only done at bootup time, and probably _before_
> the USB storage support has been loaded: probably not.

OK, thank you :-)

--
M.

0 new messages