You are not logged in.

#1 2013-01-09 22:32:32

dbarthel
Member
Registered: 2013-01-09
Posts: 3

[SOLVED] Mounting FAT32 USB Drive or Stick for Read/Write

For newbies like me. First, plug in the drive and figure out the drive name with this command:

dmesg

It shows a kind of log file, near the end look for something like this:

[    4.346919] sd 7:0:0:0: [sdc] Attached SCSI removable disk

sdc is the drive name ('c' implies the third drive after 'a' and 'b'). Assuming one partition, the partition name is sdc1. Now determine your login user id and group id:

cat /etc/passwd

You're looking for a line like this where 'dbarthel' is my login id:

dbarthel:x:1000:100::/home/dbarthel:/bin/bash

In this case '1000' is my user id and 100 is my group id. Now create a dummy directory onto which you'll graft the drive's directories:

sudo mkdir /mnt/usb

You only have to do this once in the machine's lifetime. Then mount the drive:

sudo mount -t vfat /dev/sdc1 /mnt/usb -o uid=1000,gid=100

'-t vfat' is the FAT32 filesystem type.
'/dev/sdc1' is the device partition ('sdc' comes from dmesg).
'/mnt/usb' is the part of the directory tree to graft the drive onto.
'-o uid=1000,gid=100' is who owns the files on the drive since FAT32 is dumb [or flexible! (comes from cat /etc/passwd)]

I'm lazy so I haven't figured out how to automount the drive when inserted (something to do with the /etc/fstab). Its easy to be lazy when you can ctrl-R on a bash command line then type 'mount' to arrow up through prior mount commands, even across logins.

Offline

#2 2013-01-10 00:48:08

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,058

Re: [SOLVED] Mounting FAT32 USB Drive or Stick for Read/Write

First, I think this information might be better placed in the wiki somewhere.

Secondly, for your automounting needs, theres many threads about it. Just search the forum and wiki.

Offline

#3 2013-01-10 01:03:23

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,810
Website

Re: [SOLVED] Mounting FAT32 USB Drive or Stick for Read/Write

In addition to what anonymous_user said...

You can use:

id $yourusername

instead of cat'ting /etc/passwd


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB