2

I was wondering, is it possible to have my Raspberry Pi mount the SD that is also mounted by an digital camera?

I have a scenario where I take pictures relatively fast (Raspberry Pi triggers the shutter), and sometimes the pictures get flushed out of the buffer before then end up on SD card. So, I would like to check the SD card's content upon every shutter release to be sure that picture is taken, so the mounting would be read-only, so maybe this can be done safely?

Maybe the answer is SD card extension cable?

I already have bought wireless Transcend SD card, but the polling for the directory's content is unreliable an can be slow.

Dmitry Grinberg, the person who hacked Transcend Wifi SD card claims that there is linux runnig on the SD card, and that SD's storage is simultaniously mounted by embedded linux runnig on SD and by digital camera (probably some kind of linux as well). He has his concerns about two devices mounting the same storage.

That is to say two operating systems (linux in the card and whatever is connected to it externally) both have the same FAT32 filesystem mounted read-write. If this does not scare you, it should - the external filesystem can cache reads and buffer writes at will, so no matter how clever the internal driver is, it can never have the whole picture. The lesson here is do NOT write to /mnt/sd without carefully considering the repercussions.

I am wondering if perhaps something similar could be done between raspberry pi and digital camera.

Regards, Vlatko

  • Have you tried using nfs? – YoMismo Apr 24 '15 at 10:22
2

@Celada's answer is correct, but there are ways to do what you want if you're willing to play with fire and risk corrupting your data.

First, the second system MUST mount the file system read-only. If you don't do this, you'll corrupt the file system. You already seem to know that.

Second, any attempt to access the file system from the second system is going to be out-of-date. The second system will always "see" the system as it was at some time in the past, because of caching. You won't see updates to the file system - new files, deletions, files growing as they're written to.

But, if you drop caches on your second system, you can "update" the second system's view of the "shared" file system:

echo 3 > /proc/sys/vm/drop_caches

Pretty? No. Kludgey? Certainly. Especially for file systems not designed to be shared at the device level.

But then again, Oracle's high-performance QFS file system kind of does this in its "multireader" configuration, where a single file system can be read by many hosts:

http://docs.oracle.com/cd/E22586_01/html/E22571/gkxer.html

If you can find the source online, Sun Microsystems open-sourced the base QFS file system code prior to being acquired by Oracle.

4

The only way you can mount a block device on more than one system at the same time is if the block device contains a filesystem designed for this purpose, such as OCFS2. "Normal" filesystems like ext4 or vfat cannot support this. Since the digital camera almost certainly only supports vfat as a filesystem type, it is not possible.

There are some products that exist on the market that claim to do this (such as SD cards with wifi), but they are stupendously ugly hacks. They pull tricks like trying to detect when the camera is finished writing a file by checking if the JPEG data in the file is complete, and then hoping that the camera stops accessing the file, which is never guaranteed. It is possible that those products will work for you, but then again it is also possible that they will do nothing or horribly corrupt your data. YMMV.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.