Labeling micro-SD cards ?

Oct 17, 2022 Last reply: 3 years ago 105 Replies

Jan,

Yes, you can - but as mentioned only the "boot" and "root" partitions are auto-mounted when its inserted, both the Windows "W95" FAT16 and FAT32 partitions stay invisible.

Under Windows I can not see the Linux "boot" and "root" partitions at all, and only one of the "W95" FAT16 and FAT32 partitions (not yet sure which one, likely the first, FAT16 one).

And although I'm, as written, quite sure that the RPi can access the "W95" FAT16 and/or FAT32 partitions, I'm not at all sure how I can do that in an easy fashion (a shell script perhaps?).

I might try to figure it out some day, but currently I'm happy with being able to physically label it.

Regards, Rudy Wieser

Find out their labels, and edit /etc/mnttab to mount them at boot time. Or find out their labels and write a one line script to mount them under user control.

If you have a GUI on the pi they should be visible to whatever partition editor you have.

And should be mountable from there also

On a sunny day (Mon, 24 Oct 2022 13:10:24 +0200) it happened "R.Wieser" snipped-for-privacy@not.available wrote in <tj5rmc$uvl$ snipped-for-privacy@gioia.aioe.org>:

Yea, my error perhaps Many many years ago I bought a book on Unix Then much later when I found a CD with SLS Linux (maybe around 1998 or so?) it took me about an hour to get into it and never left Unix again FIle structure, shells, basic commands is something you SHOULD really learn when using a raspberry IMO to get out of it what's in there. I hardly ever use the GUI other than for programs I wrote that use one and webbrowser Replaced the whatever GUI that came with the latest raspbian release with fvwm and xfm and do everything (almost) from the command line.

9 virtual screens, easy to switch between those with the keyboard or mouse, dmesg mount unmount ls cd grep gcc!! So many things that make using a raspberry or Unix system so nice.

I started using QR codes printed on a labelling machine - that can point to either the card's .local address if it's something like Homebridge or pi-hole. Extendable idea to point to a locally-hosted more descriptive web page maybe.

Obviously the amount of data you can encode on what is probably a 9mm square code is limited.

Binaries,

Although that could certainly work, its also means that you would always need the QR code scanning hardware and a computer pulling up the associated information active/running. Not really something I would be doing for a once-in-a-while (might be weeks apart) situations.

Thank you for the suggestion though.

Regards, Rudy Wieser

Chris,

Thanks. As it so happens I, while looking for something simpler than WSL, found it too. Might even try to use it. :-)

On the other hand, the RPi /should/ be able to access a W95 FAT16/32 partition without the need of any additional software ...

Regards, Rudy Wieser

Your phone may already have the "QR scanning hardware" and you could keep the associated information on your Web site. The QR code could be just the URL.

It is, assuming the partition is in good order. I just do:

sudo mount /dev/sda1 /mnt

(assuming the USB drive is sda, which it probably is if you booted from SD card)

and then poke around in /mnt to see what's there. Then:

sudo umount /mnt

Rinse and repeat for the remaining sda2, sda3, etc.

That works irrespective of distro, desktop environment, fancy GUI automounter, etc etc.

If it fails to detect the partition type it suggests something is quite wrong with the partition, as most common formats can be autodetected.

Theo

David,

Neither of which I have. :-)

I've just taken a peek at the different QR types. The smallest one, "Micro QR" has 35 "numerical characters". I'm not sure if those are automatically translated to characters / a string.

But assuming those "numerical characters" contain 4 bits a piece and the character encoding would use 6 bits per char you would be left with about 23 chars - which is enough for an URL.

The biggest problem is that even that "Micro QR" is a 15x15 grid, making, on a 9x9mm surface, its squares less than a mm across ...

Regards, Rudy Wieser

Theo,

Thanks. I guessed as much, but had nothing to go on.

And I read somewhere I had to create that "mnt" directory first ? You do not seem to do so.

And a question : do you know wat happens when you (try to) eject the USB dongle containing the uSD card you just mounted a partition of ? I would not like to have either the boot uSD or the mounted one trashed.

Regards, Rudy Wieser

Most distros already have an empty /mnt directory there, ready for something to be mounted.

If you use the desktop environment 'eject' button, it may or may not remove the mountpoints. In the above it's done as root, and a regular user won't be able to unmount something mounted by root, so the eject complains something is still using the device.

If you 'sudo umount' it first, everything should be fine.

You can also just forcibly do 'sudo umount /dev/sda1; sudo umount /dev/sda2; ...' to make sure everything is unmounted first, irrespective of whatever the desktop does.

If in doubt, 'sync' to ensure anything unwritten is flushed to the disc before removing it.

Theo

It almost certainly can. Certainly my desktop can see everything on my PIs SD card - or could when it was inserted to build it. The PI doesn't mount more than the boot and root partitions though by default.

If you want it to, edit /etc/mnttab

umount /mnt

/mnt may or may not be created by default - I think /media/<username> is often used to mount removable drives at least on my desktop linux

This is all superstructure though - as root you can mount a drive partition any damn where you please, even to the point of screwing up your machine if e.g. you decide to mount it over /bin!!!!

Much more subtle fun is to be had by mounting something over /tmp on a running system - there will usually be processes with files open on the masked filesystem which can cause no end of confusion.

Theo,

Ah. Understood.

Thats currently what I know too. "it may or may not". :-)

So, either unmount or flush. I had hoped to hear (for sure) that under raspberian the "eject" would automatically unmount first. The less stuff you have to remember the better.

I had not considered that. Hmm... Not being able to eject some removable USB stick "root" forgot to take with him. Oh well. I guess nothing a shutdown won't solve. :-)

Regards, Rudy Wieser

Eject is equivalent to unmount on any device that doesnt have a physical eject mechanism

TNP,

Yes, thats what theo already said. I was asking about what happens when you forget to do so.

Both can ofcourse be checked.

On my RPi : /mnt is present and seems to be empty. When I inserted an USB adapter for a second uSD card it was mounted on /media/pi

Hmm... Can't sudo mount anything on /mnt (owned by root), but can on /media/pi

dmseg was suggesting to do e2... something (I assume an chkdisk equivalent) on sda7, and now that partition isn't auto-mounted anymore. Oh well, I didn't pick that card for nothing. :-)

Regards, Rudy Wieser

Well unless yuou pull the live card out of its socket, nothing. If you IMMEDIASTELY pull it out, and you are writing to it, it may get corrupetd. But mostly the cards get data flushed to them quickly, so provided its idle, it may end up needin an fsck, bu thats all.

that is because it was mounted by pi the user not root.

should be able to

e2fsck? Means the partition is not internally consistent

On a sunny day (Tue, 25 Oct 2022 21:45:38 +0200) it happened "R.Wieser" snipped-for-privacy@not.available wrote in <tj9e8k$1m6g$ snipped-for-privacy@gioia.aioe.org>:

What I always do is: if dmesg shows say sdb2 mkdir /mnt/sdb2 mount /dev/sdb2 /mnt/sdb2 cd /mnt/sdb2 to view whts there

This seems to be common practice and never caues problems when finsished with that partition do umount /dev/sdb2

But I am always root, maybe be pees need to sudo ;-)

TNP,

Again, not the question. Imagine the following : I insert an USB adapter with an uSD card, off of which two partitions get auto-mounted. Than I open a console and manually mount a third. What happens when I click the "eject" button (at the top right-ish of the screen) ? Does the manually mounted partition get unmounted first too ? Or do I need to manually unmount it first (which would be a problem just waiting to happen) ?

In that case, how do I mount a partition as myself, the user "pi" ? The last time I forgot to prepend "sudo" before "mount" I got the reply "mount: only root can do that".

Hmm... I just retried it (double checking) and indeed the partition appeared there. I have no idea what, or even /if/ I did anything different. :-|

Yep, thats the one.

That is what I guessed from that message (and the errors shown below it in dmesg) too. What I didn't expect that it would be running for half an hour and, in the end, throwing the towel in the ring leaving me with an trashed partition / unusable installation.

Currently I can't even manually mount the partition anymore. :-(

One other question : Automount creates, before mounting the partition, a folder with with a name ("boot", "root") it probably gets from the to-be-mounted partition itself. Do you have any idea how I can retrieve the same (so I can take a swing at creating a simple bash script for it) ?

Regards, Rudy Wieser

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required