ejfield
Posts: 17
Joined: Fri Oct 19, 2012 10:21 am

Mounting USB Memory

Wed Apr 30, 2014 7:17 am

It's possible I'm going mad, but I seem to be having odd things happening when I mount a USB memory stick. Typically, I plug the stick in, and look at it's device name with "df -h". This is USUALLY either "/dev/sda", or "/dev/sda1". I havn't worked out what the difference between them is, or why sometimes it's one and sometimes the other, but I thought it might have been something to do with the way it was formatted.

HOWEVER, yesterday, a stick which had happily been mounted via /etc/fstab as "/dev/sda /mnt/usb0........" seemed to suddenly decide that it's device name was now "/dev/sda1", and therefore the fstab mount failed!

Does anyone know what controls this behaviour, and how to stop it?

Thanks
Ed

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Mounting USB Memory

Wed Apr 30, 2014 7:40 am

• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Tarcas
Posts: 741
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: Mounting USB Memory

Wed Apr 30, 2014 2:08 pm

The difference between sda and sda1 is that sda is the drive, and sda1 is the first partition on that drive. sda2 will be the second partition and so on.

ejfield
Posts: 17
Joined: Fri Oct 19, 2012 10:21 am

Re: Mounting USB Memory

Wed Apr 30, 2014 7:25 pm

ghans: I cant use UUIDs because I want to be able to mount different USB sticks at the same mount point.

Tarcas: Thanks for that clarification, but what determines which device name is used? Normally, I wouldn't have thought a USB stick, formatted at FAT32 I think, would contain any partitions, so I would have thought /dev/sda would be used. Why would it suddenly change to /dev/sda1?

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

Re: Mounting USB Memory

Wed Apr 30, 2014 7:44 pm

Most USB sticks will contain at least one partition. That is standard practice. Some devices don't have a partition table and just use the whole device for the file system. This can give you an extra 0.5KB of storage, or more.

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

Re: Mounting USB Memory

Wed Apr 30, 2014 9:37 pm

ejfield wrote:ghans: I cant use UUIDs because I want to be able to mount different USB sticks at the same mount point.
Curiouser and curiouser ... why?
What happens if, when you format the sticks, you give them the same 'label', and use that? (And perhaps use the label as the "mount point name" too).
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

ejfield
Posts: 17
Joined: Fri Oct 19, 2012 10:21 am

Re: Mounting USB Memory

Thu May 01, 2014 10:04 am

Curiouser and curiouser ... why?
What happens if, when you format the sticks, you give them the same 'label', and use that? (And perhaps use the label as the "mount point name" too).
Trev.
Well, I want to be able to plug in any USB stick containing my data, and expect to find it at the same mount point. Is this unreasonable? If I understand correctly, using UUID would not allow this, and using the 'label' seems an unnecessary restriction, though it might be a work around.

When I said earlier that I thought a USB memory stick wouldn't have any partitions, I meant of course that it would normally only have one, primary partition.

So I still dont understand why in one case, it appears as "/dev/sda", and in another as "/dev/sda1"..

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Mounting USB Memory

Thu May 01, 2014 1:24 pm

Can't you assign several UUIDs on the same mountpoint ?

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

ejfield
Posts: 17
Joined: Fri Oct 19, 2012 10:21 am

Re: Mounting USB Memory

Thu May 01, 2014 5:40 pm

ghans wrote:Can't you assign several UUIDs on the same mountpoint ?

ghans
Well I could, if I knew the UUID of every USB stick I'm ever likely to use. Unfortunately, I dont.

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Mounting USB Memory

Sun May 04, 2014 2:47 pm

The "usbmount" tool uses udev internally , and allows to set
a fixed mountpoint for any stick it automounts.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Return to “Advanced users”