USB SD mass storage question


sepulep

Member
Joined
Nov 18, 2008
Messages
367
I encountered the following weird behaviour:

- I mounted an sdcard (the system disk, booted from SD) through a USB connection on a linux machine (using USB SD mass storage item in the applet)

- then I created a file in the root of the card

- then unmount

- l look for the file on the pandora...oops..it is not there??? (not in /, nor in /media/sdcard/)

question: what is going on here?
 
Try restarting your Pandora after you unmount.

I say this because this has happened to me a time or two.
 
Last edited:
what worries me a bit is that while I could find the file after turning off,  fsck-ing the card gave errors..I think using usb mass storage on the system disk is dangerous (it doesn't unmount while if I do the same thing on the non-system sd it unmounts while mounted in sd-storage mode..)
 
Wait, you booted from an SD card and then shared that SD card via mass storage? Yeah, that's very dangerous. I'm actually surprised it let you. Usually, if it can't umount the disk it'll give an error and refuse to let it go through to mass storage.
 
No, I mean literally, it is not supposed to let you do that. If you managed to do so then you I have no idea how. It absolutely will not activate SD mass storage unless it can unmount the card. You have done something impossible.
 
well, it lets me do it :wacko: maybe someone can confirm either way??  
 
I agree, if it is not safe it should not be possible..
This is Linux, it should be possible. It's the responsibility of the person operating the unit to know whether or not it's a wise idea. I've regularly had times over the years where Windows would prevent me from mounting something because it thought it was a bad idea, but the OS had a bug that caused the assessment to be wrong. Most of the time it was with drives being viewed as in use, when the process had been closed or a file in use, but no way of determining which process was using it.

That being said, a warning on something like this wouldn't be a bad idea.

That being said, there does seem to be something funky going on with the card reader on mine, but a quick reboot got it detected again. I just hope that it's my card, and not the other hardware.
 
This is Linux, it should be possible.
Well yeah, it is technically possible to mount a device and share it to an external system but it's extremely dangerous and requires the user to explicitly tell it "yes, I know what I'm doing". The mass storage script doesn't do that, it attempts to unmount the drive (to remove the risk of the device being broken from multiple modification points), and if it can't for any reason it throws up a warning and aborts. It should not be doing what Sepulep is saying it is. You can try it yourself by starting a PND and then trying to put the SD card that that PND is on into mass storage: it won't let you. If you want to share a card without unmounting it then dig yourself into the script and change it, but know that you'll be risking the corruption that Sepulep has mentioned.Looks like it does as expected for regular SD cards, but ignores the error when it is trying to share the system card. Bizarre.
 
Its actually cool if your are prohibited from booting it on another machine because it goes into lock mode, like on some ssd controllers, you can load it, then transfer your OS to ramdisk, (and at this point you should unmount), but you could omit that and go ahead i suppose.

Nope, i couldnt think of a reason.

Edit: I suppose it could work if you have it mounted as NFS locally and use the mount point from the other computer.
 
Last edited by a moderator:
Its actually cool if your are prohibited from booting it on another machine because it goes into lock mode, like on some ssd controllers, you can load it, then transfer your OS to ramdisk, (and at this point you should unmount), but you could omit that and go ahead i suppose.

Nope, i couldnt think of a reason.

Edit: I suppose it could work if you have it mounted as NFS locally and use the mount point from the other computer.
NFS, iSCSI or SMB would probably all work. I tend to dislike NFS because it can be a bit of a hassle to get properly set up.

The important thing here is that with those options, the local computer is what's managing the read and the write, rather than counting on two different machines to coordinate things in a safe manner. As I recall, with firewire, sometimes a disk plugged into one computer would be visible as if plugged into the other. Which is preferable to the case where it's connected to both computers, if a bit odd.
 
First check the validity of my impression from the next bullets, if false, ignore my comments on the "allow USB mass media access or not"-matter...

  • There is a nifty "turn your Pandora into an expensive 2 slot SD card reader"-feature available in the Pandora
  • This nifty feature is implemented in a direct way: the SD card (block device) becomes accessible as a USB mass media device to the client accessing it via the Pandora
    (if this nifty feature really is a daemon magically "converting" a mounted partition to USB mass media compliance, where can I have the sources please? I need them... in fact I need them like 5 years ago already, but better late than never... :p )
[*]It has turned out now, that in some configurations this nifty feature can be turned on by the user while some or all partitions on the SD card are in use by the Pandora OS, meaning, some or all partitions are mounted
[*]This can be done via GUI
If this impression is correct then allowing that is just bloody stupid... a bug if you ask me...

I agree, if it is not safe it should not be possible..
This is Linux, it should be possible.
It is possible anyway... With Linux everything is always possible... actually is often with Windows too, but sometimes not with MS tools or even without a utility you quickly hack up yourself. That's probably partially also because MS spends good money to ensure things remain that way and their tools do not allow whoopsies!

But allowing it in an end user GUI is definitely not a good idea, it is not a "nice to have feature" like you make it sound, it is so dangerous it needs to be buried behind at least two or three "really really sure" queries.

Point being: People who insist on messing up their filesystems can practice their insistence on command line where, in linux, practically everything is always possible.

Biggest problem is that the average user has no idea what is writing to the device.

Simple example: full text search engine or trashcan creates a hidden directory at an inconvenient moment and you just got some work for fsck without even even realizing there's a risk involved, after all, you initiated no writes yourself, did you, you just read?

So the only scenario where this is safe is if you manually mount the filesystem ro in the device reading it.

That would boil down to a non-auto-mounting-OS.

They are quite rare. Even the "you and your mom too"-linuxes automount these days...

Windows would prevent me from mounting something because it thought it was a bad idea, but the OS had a bug that caused the assessment to be wrong. Most of the time it was with drives being viewed as in use, when the process had been closed or a file in use, but no way of determining which process was using it.
Are you sure you're not mixing mounting and unmounting?

(I cannot readily see why an OS would have locks to a filesystem it has not yet mounted and is thus trying to mount :blink: .)

Windows has so far never "lied" to me about files being open on a filesystem when I unmount. The trick has been to find the process to kill. These days I automatically aim for cmd.exes and explorer.exe before even starting troubleshooting... quickest done via command line with pskill...

NFS, iSCSI or SMB ...
One of these does not fit in this bunch: iSCSI is not a network filesystem.

Or to put it another way: you don't create an smb share to initialize it in the client machine with fdisk .

In fact, iSCSI very closely resembles the SD card to USB mass media scenario. NFS and SMB are a totally different world.

The important thing here is that with those options, the local computer is what's managing the read and the write,
But in case of iSCSI the local computer often has no clue whatsoever about what it is it is doing in terms of files, folders and all the other rather important tidbits. iSCSI does not manage concurrent connections, it just stupidly writes what is asked to write where it is asked to write and if two computers start competing between each other for, for example, the partition table, then that's just too bad... that's also almost surely the end of the partition table... iSCSI has no concept of a partition table, it doesn't care.

 As I recall, with firewire, sometimes a disk plugged into one computer would be visible as if plugged into the other. Which is preferable to the case where it's connected to both computers, if a bit odd.
I don't understand what you mean? If it is anything related to Apple, ignore my question, in that case I don't even want to know ;) ...
 
Back
Top