User avatar
Offcenter
Posts: 182
Joined: Wed Jul 31, 2013 4:57 pm
Location: Northwestern New Jersey USA

Trying to mount a flash drive...help

Tue Aug 20, 2013 7:31 pm

Hey gang, I'm trying to mount a 64 gig flash drive.
It came from the package formatted FAT32. (I know this because I put it in my Windoze computer and clicked "properties".
After some reading here: http: //www.jeremymorgan.com/tutorials/raspberr ... le-server/
I tried this command:
sudo mount -t fat32 -o uid=pi,gid=pi /dev/sda1 /media/usbdrive/
(I have no idea what any of that means. I got it from the above page)
I got the message:
"unknown filesystem type "fat32" "


Simple question: Can this be mounted or does it need to be reformatted.
Keep in mind that, in the future, I may want to plug this flash drive into
my Windoze computer again to copy files from it or to it.
PLEASE, keep responses to plain english. I'm brand new at this and have
no idea what I'm doing....yet. But I'm trying to learn.

In another thread I asked about this three days ago. While the I'm sure
the responders were trying to help, the answers I got were in "computerese"
and only confused me further.
So I got disgusted and gave up for a bit.
Baby steps please.

Thank you very much
George in New Jersey.
(learning a little bit every day.)
(and darned confused most of the time!)

lazarus78
Posts: 236
Joined: Thu Jul 25, 2013 5:16 pm

Re: Trying to mount a flash drive...help

Tue Aug 20, 2013 8:43 pm

I can tell you it CAN be mounted, so I hope that puts your mind at ease a bit. I messed with mounting NTFS network drives recently, and it was a tough cookie to crack.

As for exactly how I did it... it is still mostly magic to me.

So ill do my best to help.

So for starters, mounting isn't like windows where it will show up like a new letter drive. Instead, mounting makes the connected drive appear like it is just another file on your system for you to browse. So first and foremost, you need to decide where you want to mount the USB flash drive. Typically people make their own directory somewhere, maybe in their home directory, something like "/home/pi/mount".

Might take a look at this. I am terrible at explaining things.
http://azaleasays.com/2012/05/22/mount- ... tu-server/

The -t is an option flag used to tell the mount command you are going to be using a specific file system (Fat32, NFS, etc.).

If you are interested in automatically mounting something like an external hard drive, I can try explaining that if you would like.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5052
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Trying to mount a flash drive...help

Tue Aug 20, 2013 8:57 pm

If you're using Raspbian and have run "startx" to get the desktop I would expect the (desktop) file manager to (auto-)mount the flash drive for you. However you should also be able to mount the drive with the command you quoted but the file system type should be "vfat" (not fat32) and you may have to have (initially) created a dummy directory (ie. "/media/usbdrive) with the "mkdir' command before tyring to mount for the first time. FWIW there is more info. and examples of other ways of mounting usb drives within my webpages at http://www.cpmspectrepi.webspace.virgin ... ticks.html .
Trev.
Still running Raspbian Jessie on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W) but Stretch on my 2xP3A+, P3B+, P3B, B+, A+ and a B2. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
Offcenter
Posts: 182
Joined: Wed Jul 31, 2013 4:57 pm
Location: Northwestern New Jersey USA

Re: Trying to mount a flash drive...help

Tue Aug 20, 2013 9:01 pm

Great, Lazarus. So it appears I'm on the right track.
According to the link you gave me, it should be possible to
mount fat32.
So why did I get back the message that the file system type is unknown?

And....What does the -o mean?
and what does the uid=pi,gid=pi mean?

I'm sure that once I figure this out it will seem easy.
But getting started is the hard part when you have never
worked with this before.
Thanks Lazarus.
George in New Jersey.
(learning a little bit every day.)
(and darned confused most of the time!)

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: Trying to mount a flash drive...help

Tue Aug 20, 2013 9:04 pm

Offcenter wrote: After some reading here: http: //www.jeremymorgan.com/tutorials/raspberr ... le-server/
I tried this command:
sudo mount -t fat32 -o uid=pi,gid=pi /dev/sda1 /media/usbdrive/
(I have no idea what any of that means. I got it from the above page)
That isn't what that page says at the time of writing. ( 22.00 UK time, Tues 20th Aug.)
I got the message:
"unknown filesystem type "fat32" "
So, use the system to help you. Most linux utilities are documented through a set of man(ual) pages installed on every system. Have a look at

Code: Select all

man mount
Sure, it's incomprehensible. But look through it and you will find the valid filesystem types for the type option. 'fat32' isn't among them. That's what the error message tells you.

But vfat is listed, and that's what Jeremy Morgan's tutorial currently advises using.


Baby steps please.
I hope I've explained the what and the why.
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

User avatar
Offcenter
Posts: 182
Joined: Wed Jul 31, 2013 4:57 pm
Location: Northwestern New Jersey USA

Re: Trying to mount a flash drive...help

Tue Aug 20, 2013 9:10 pm

FTrevorGowen wrote:If you're using Raspbian and have run "startx" to get the desktop I would expect the (desktop) file manager to (auto-)mount the flash drive for you. However you should also be able to mount the drive with the command you quoted but the file system type should be "vfat" (not fat32) and you may have to have (initially) created a dummy directory (ie. "/media/usbdrive) with the "mkdir' command before tyring to mount for the first time. FWIW there is more info. and examples of other ways of mounting usb drives within my webpages at http://www.cpmspectrepi.webspace.virgin ... ticks.html .
Trev.
Hi Trevor. One simple question at a time.....
Why would type be vfat if the flash drive is fat32? (It is. I checked it in my Windoze machine.)

And thanks for trying to help. I appreciate it.

....and just so you understand, what I'm working towards is using the Pi
as a home webserver where the flash drive will contain all the files
and websites stuff.
But I have a LOOONG way to go. So first I just want to figure out how
to mount the flash drive.
George in New Jersey.
(learning a little bit every day.)
(and darned confused most of the time!)

lazarus78
Posts: 236
Joined: Thu Jul 25, 2013 5:16 pm

Re: Trying to mount a flash drive...help

Tue Aug 20, 2013 9:12 pm

the -o flag is for additional options.

The uid stands for user ID, in this case, the user of Pi.
The gid stands for group ID, again, in this case, the group of Pi

This is used, if I remember correctly, to assign permissions to the files within the mounted drive. If you are familiar with the "ls -l" command to list the files, every file has a section on the left that says something like "-rwxr-xr-x". These are the permissions, read, wright, and execute, split into three groups for user, group, and other.

So with your particular mount command, you are mounting the flash drive to be used for the Pi user of the Pi group.

Don't quote me on that however. I would bet money I have misunderstood some of it.

When I had to mount the network drives for my project, I used the -o flag to set login username, password, and a domain.

lazarus78
Posts: 236
Joined: Thu Jul 25, 2013 5:16 pm

Re: Trying to mount a flash drive...help

Tue Aug 20, 2013 9:13 pm

Offcenter wrote:
FTrevorGowen wrote:If you're using Raspbian and have run "startx" to get the desktop I would expect the (desktop) file manager to (auto-)mount the flash drive for you. However you should also be able to mount the drive with the command you quoted but the file system type should be "vfat" (not fat32) and you may have to have (initially) created a dummy directory (ie. "/media/usbdrive) with the "mkdir' command before tyring to mount for the first time. FWIW there is more info. and examples of other ways of mounting usb drives within my webpages at http://www.cpmspectrepi.webspace.virgin ... ticks.html .
Trev.
Hi Trevor. One simple question at a time.....
Why would type be vfat if the flash drive is fat32? (It is. I checked it in my Windoze machine.)

And thanks for trying to help. I appreciate it.

....and just so you understand, what I'm working towards is using the Pi
as a home webserver where the flash drive will contain all the files
and websites stuff.
But I have a LOOONG way to go. So first I just want to figure out how
to mount the flash drive.
vfat supports both fat16 and fat32, that is why.

If you would like, we can converse over Skype and I can help you more directly with whatever my experience allows.

flyinghappy
Posts: 115
Joined: Mon Nov 05, 2012 5:31 pm

Re: Trying to mount a flash drive...help

Tue Aug 20, 2013 9:15 pm

Offcenter wrote:Great, Lazarus. So it appears I'm on the right track.
According to the link you gave me, it should be possible to
mount fat32.
So why did I get back the message that the file system type is unknown?

And....What does the -o mean?
and what does the uid=pi,gid=pi mean?

I'm sure that once I figure this out it will seem easy.
But getting started is the hard part when you have never
worked with this before.
Thanks Lazarus.
This site has a good layout of what all the options are (basically just an online man page...) http://linux.die.net/man/8/mount

basically the -o means options, which in this case are uid=pi,gid=pi which tells Linux that the device should be mounted so that the user pi and group pi has read/write access to the device. (uid=user id gid=group id)

Edit: Man pages can be a pain in the butt to understand, but they are worth looking at and learning what they tell you as you can gain a ton of useful information from them.
Pi with ArchLinux running a minidlna/samba home server

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5052
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Trying to mount a flash drive...help

Tue Aug 20, 2013 9:19 pm

Offcenter wrote: Hi Trevor. One simple question at a time.....
Why would type be vfat if the flash drive is fat32? (It is. I checked it in my Windoze machine.)

And thanks for trying to help. I appreciate it.

....and just so you understand, what I'm working towards is using the Pi
as a home webserver where the flash drive will contain all the files
and websites stuff.
But I have a LOOONG way to go. So first I just want to figure out how
to mount the flash drive.
It's simply because "vfat" is Linux's name for Windows FAT16 or FAT32 filesystems (IIRC FAT16 does not support file/disk sizes greater than ~4Gb). W.r.t. your "long term plans" it happens that the first example within my webpage I pointed you to was for a "NAS box" that had been "converted" into a webserver. If you haven't done so already take a look at the "man pages" for "mount" and "fstab" ("man mount" or "man fstab")
Trev.
Still running Raspbian Jessie on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W) but Stretch on my 2xP3A+, P3B+, P3B, B+, A+ and a B2. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
Offcenter
Posts: 182
Joined: Wed Jul 31, 2013 4:57 pm
Location: Northwestern New Jersey USA

Re: Trying to mount a flash drive...help

Tue Aug 20, 2013 9:41 pm

Ah HA! So Vfat covers both fat32 and fat16. Now we're getting somewhere! Thanks!
(I had assumed that vfat was another file system entirely.)

Next question: If I leave out the "uid=pi,gid=pi", will that mean that
anyone can use the flashdrive? I don't need users or groups. I am the only
one that has access to my Pi. (permissions are another thing that's driving
me nuts)

FlyingHappy: Good site! I bookmarked it. Still confusing but I'm sure it
will come in handy in the future. Thanks.
George in New Jersey.
(learning a little bit every day.)
(and darned confused most of the time!)

lazarus78
Posts: 236
Joined: Thu Jul 25, 2013 5:16 pm

Re: Trying to mount a flash drive...help

Tue Aug 20, 2013 9:46 pm

Technically, yes, you could leave it out. I think -t is the only required flag

User avatar
Offcenter
Posts: 182
Joined: Wed Jul 31, 2013 4:57 pm
Location: Northwestern New Jersey USA

Re: Trying to mount a flash drive...help

Tue Aug 20, 2013 10:29 pm

Great! I'll try it that way.
Thanks everybody!

Edit: Entered the command and it seems to be accepted.
Now, how do I check available disk space to make sure
that Raspian is seeing all 64 gigabytes?
Thanks again, gang!

P.S. I wish this stuff had been around when I was a kid.
It would have been SOOO much easier learning it at 12 or 15
instead of doing it at 63. :lol:
Last edited by Offcenter on Tue Aug 20, 2013 10:42 pm, edited 1 time in total.
George in New Jersey.
(learning a little bit every day.)
(and darned confused most of the time!)

flyinghappy
Posts: 115
Joined: Mon Nov 05, 2012 5:31 pm

Re: Trying to mount a flash drive...help

Tue Aug 20, 2013 10:33 pm

Offcenter wrote:Ah HA! So Vfat covers both fat32 and fat16. Now we're getting somewhere! Thanks!
(I had assumed that vfat was another file system entirely.)

Next question: If I leave out the "uid=pi,gid=pi", will that mean that
anyone can use the flashdrive? I don't need users or groups. I am the only
one that has access to my Pi. (permissions are another thing that's driving
me nuts)

FlyingHappy: Good site! I bookmarked it. Still confusing but I'm sure it
will come in handy in the future. Thanks.
You can leave out the uid/gid but since mount usually requires root privileges (su or sudo) the drive will only be writable by the root user, which you probably don't want I would think. Permissions can be a bear to get through but once you understand them, they aren't that crazy to work with.

Edit: Also, I found that ext4 reads/writes faster on my pi than ntfs/fat file systems. I have a 500GB drive formatted as ext4 connected to my pi and it is readable under windows with samba even though windows doesn't support ext4 file systems, you can't put the stick directly into the windows machine to copy to it, but you can do it over your LAN just fine with samba and avoid having to remove it at all. The only time I have disconnected the HDD from my pi is when I moved it from one room to another, It also comes in handy for moving files from my computer to my phone/tablet or the other way around that way, it also serves all my movies over a minidlna server to my smart tv and tablet. That way you can put a line in fstab to mount it automatically at boot and not really have to worry about it.
Pi with ArchLinux running a minidlna/samba home server

User avatar
Offcenter
Posts: 182
Joined: Wed Jul 31, 2013 4:57 pm
Location: Northwestern New Jersey USA

Re: Trying to mount a flash drive...help

Tue Aug 20, 2013 10:45 pm

Ok, FlyingHappy. I'll start reading up on permissions next.
I have to go out now, but at least I learned a little bit.

I'll attack permissions when I get home. (Oh! I feel another
headache coming on! :lol: )
George in New Jersey.
(learning a little bit every day.)
(and darned confused most of the time!)

User avatar
rpdom
Posts: 15019
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Trying to mount a flash drive...help

Wed Aug 21, 2013 4:49 am

Offcenter wrote:Entered the command and it seems to be accepted.
Now, how do I check available disk space to make sure
that Raspian is seeing all 64 gigabytes?
That would be the df command (short for "Disk Free"). For example, if your FAT32 drive is mounted on /media/usbdrive, you would do something like:

Code: Select all

pi@raspberrypi:~$ df -h /media/usbdrive
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              63G  5.0M   63G   8% /media/usbmount
pi@raspberrypi:~$
The figures will probably be slightly different to the ones I've used as an example. You won't see the full 64GB, as the filesystem itself uses a bit of space.

The "-h" option means "display sizes in human-friendly format (B, KB, MB, GB, TB, PB... as appropriate)". Other options are "-k", which means "display in KB" and "-m" = "display in MB". "man df" or "df --help" will display all the available options and formats.
P.S. I wish this stuff had been around when I was a kid.
It would have been SOOO much easier learning it at 12 or 15
instead of doing it at 63. :lol:
Me too! Although I'm slightly younger and started working with Unix (which is almost the same, but not as flexible) about 20 years ago, which does give me a head start. I've only been using Linux since 2002 though.

User avatar
Offcenter
Posts: 182
Joined: Wed Jul 31, 2013 4:57 pm
Location: Northwestern New Jersey USA

Re: Trying to mount a flash drive...help

Wed Aug 21, 2013 6:28 pm

Thanks for that, RPDOM. Worked perfectly.
George in New Jersey.
(learning a little bit every day.)
(and darned confused most of the time!)

tomhalv
Posts: 36
Joined: Wed Apr 24, 2013 11:10 pm

Re: Trying to mount a flash drive...help

Wed Aug 28, 2013 9:07 pm

rpdom wrote:
Offcenter wrote:Entered the command and it seems to be accepted.
Now, how do I check available disk space to make sure
that Raspian is seeing all 64 gigabytes?
That would be the df command (short for "Disk Free"). For example, if your FAT32 drive is mounted on /media/usbdrive, you would do something like:

Code: Select all

pi@raspberrypi:~$ df -h /media/usbdrive
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              63G  5.0M   63G   8% /media/usbmount
pi@raspberrypi:~$
The figures will probably be slightly different to the ones I've used as an example. You won't see the full 64GB, as the filesystem itself uses a bit of space.

The "-h" option means "display sizes in human-friendly format (B, KB, MB, GB, TB, PB... as appropriate)". Other options are "-k", which means "display in KB" and "-m" = "display in MB". "man df" or "df --help" will display all the available options and formats.
P.S. I wish this stuff had been around when I was a kid.
It would have been SOOO much easier learning it at 12 or 15
instead of doing it at 63. :lol:
Me too! Although I'm slightly younger and started working with Unix (which is almost the same, but not as flexible) about 20 years ago, which does give me a head start. I've only been using Linux since 2002 though.

If I mount a USB stick like this, it seems that to use it I must always use "sudo" for copying or moving files to it. It won't let me change any ownership. Is that right?

itimpi
Posts: 1088
Joined: Sun Sep 25, 2011 11:44 am
Location: Potters Bar, United Kingdom
Contact: Website

Re: Trying to mount a flash drive...help

Thu Aug 29, 2013 9:14 am

tomhalv wrote:If I mount a USB stick like this, it seems that to use it I must always use "sudo" for copying or moving files to it. It won't let me change any ownership. Is that right?
It depends on what user/group the drive was mounted as. It sounds as if yours is being mounted as if owned by root? You do need sudo to be able to mount the drive, but there are parameters to the mount command to allow the user/group to be specified.
Last edited by itimpi on Thu Aug 29, 2013 3:26 pm, edited 1 time in total.

User avatar
rpdom
Posts: 15019
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Trying to mount a flash drive...help

Thu Aug 29, 2013 9:47 am

itimpi wrote:
tomhalv wrote:If I mount a USB stick like this, it seems that to use it I must always use "sudo" for copying or moving files to it. It won't let me change any ownership. Is that right?
It depends on what user/group the drive was mounted as. It sounds as if yours is being mounted as if owned by toot? You do need sudo to be able to mount the drive, but there are parameters to the mount command to allow the user/group to be specified.
Indeed, and these parameters are discussed in detail earlier on in this post.

Return to “Beginners”